From 176fbe525248fe85f7b4fb8c2cb1c606925e60c2 Mon Sep 17 00:00:00 2001 From: Imran teli Date: Tue, 10 Sep 2024 17:38:47 +0530 Subject: [PATCH 01/28] upgradejdk17 --- pom.xml | 370 +- .../com/visualpathit/account/Application.java | 11 + .../CustomAuthenticationFailureHandler.java | 18 + .../account/DatabaseException.java | 11 + .../account/GlobalExceptionHandler.java | 34 + .../account/MessagingRabbitApplication.java | 55 + .../com/visualpathit/account/Receiver.java | 20 + .../java/com/visualpathit/account/Runner.java | 26 + .../visualpathit/account/SecurityConfig.java | 47 + .../account/UserNotFoundException.java | 7 + .../controller/ElasticSearchController.java | 162 +- .../controller/RabbitMqController.java | 65 + .../account/controller/UserController.java | 229 +- .../com/visualpathit/account/model/Role.java | 5 +- .../com/visualpathit/account/model/User.java | 4 +- .../account/service/SecurityService.java | 2 +- .../account/service/SecurityServiceImpl.java | 30 +- .../service/UserDetailsServiceImpl.java | 14 +- .../account/service/UserServiceImpl.java | 53 +- .../account/utils/ElasticsearchUtil.java | 67 +- src/main/resources/accountsdb.sql | 18 +- src/main/resources/application.properties | 2 +- src/main/resources/logback.xml | 30 +- src/main/webapp/META-INF/MANIFEST.MF | 2 + src/main/webapp/WEB-INF/appconfig-data.xml | 53 +- src/main/webapp/WEB-INF/appconfig-mvc.xml | 52 +- .../webapp/WEB-INF/appconfig-rabbitmq.xml | 40 +- src/main/webapp/WEB-INF/appconfig-root.xml | 25 +- .../webapp/WEB-INF/appconfig-security.xml | 47 +- src/main/webapp/WEB-INF/views/error/404.jsp | 32 + src/main/webapp/WEB-INF/views/error/500.jsp | 63 + .../views/error/authentication-error.jsp | 13 + .../WEB-INF/views/error/database-error.jsp | 44 + src/main/webapp/WEB-INF/views/index_home.jsp | 108 +- src/main/webapp/WEB-INF/views/login.jsp | 214 +- .../webapp/WEB-INF/views/rabbitmq-error.jsp | 28 + src/main/webapp/WEB-INF/views/rabbitmq.jsp | 37 +- .../webapp/WEB-INF/views/registration.jsp | 205 +- src/main/webapp/WEB-INF/views/upload.jsp | 2 +- src/main/webapp/WEB-INF/views/user.jsp | 298 +- src/main/webapp/WEB-INF/views/userList.jsp | 192 +- src/main/webapp/WEB-INF/views/welcome.jsp | 142 +- src/main/webapp/WEB-INF/web.xml | 70 +- .../webapp/resources/Images/background1.jpg | Bin 0 -> 547652 bytes src/main/webapp/resources/Images/bg-01.jpg | Bin 0 -> 114272 bytes src/main/webapp/resources/Images/dev_img.jpeg | Bin 0 -> 198016 bytes .../webapp/resources/Images/devops_img.png | Bin 0 -> 297331 bytes .../webapp/resources/Images/icons/favicon.ico | Bin 0 -> 32038 bytes .../resources/Images/new-background.png | Bin 0 -> 374342 bytes .../webapp/resources/Images/new-logo1.png | Bin 0 -> 6659 bytes .../webapp/resources/css/bootstrap.min.css | 15 +- src/main/webapp/resources/css/common.css | 136 +- src/main/webapp/resources/css/login.css | 240 + src/main/webapp/resources/css/main.css | 497 + src/main/webapp/resources/css/profile.css | 349 +- src/main/webapp/resources/css/util.css | 2993 ++++++ .../fonts/font-awesome-4.7.0/HELP-US-OUT.txt | 7 + .../font-awesome-4.7.0/css/font-awesome.css | 2337 +++++ .../css/font-awesome.min.css | 4 + .../font-awesome-4.7.0/fonts/FontAwesome.otf | Bin 0 -> 134808 bytes .../fonts/fontawesome-webfont.eot | Bin 0 -> 165742 bytes .../fonts/fontawesome-webfont.svg | 2671 ++++++ .../fonts/fontawesome-webfont.ttf | Bin 0 -> 165548 bytes .../fonts/fontawesome-webfont.woff | Bin 0 -> 98024 bytes .../fonts/fontawesome-webfont.woff2 | Bin 0 -> 77160 bytes .../font-awesome-4.7.0/less/animated.less | 34 + .../less/bordered-pulled.less | 25 + .../fonts/font-awesome-4.7.0/less/core.less | 12 + .../font-awesome-4.7.0/less/fixed-width.less | 6 + .../font-awesome-4.7.0/less/font-awesome.less | 18 + .../fonts/font-awesome-4.7.0/less/icons.less | 789 ++ .../fonts/font-awesome-4.7.0/less/larger.less | 13 + .../fonts/font-awesome-4.7.0/less/list.less | 19 + .../fonts/font-awesome-4.7.0/less/mixins.less | 60 + .../fonts/font-awesome-4.7.0/less/path.less | 15 + .../less/rotated-flipped.less | 20 + .../less/screen-reader.less | 5 + .../font-awesome-4.7.0/less/stacked.less | 20 + .../font-awesome-4.7.0/less/variables.less | 800 ++ .../font-awesome-4.7.0/scss/_animated.scss | 34 + .../scss/_bordered-pulled.scss | 25 + .../fonts/font-awesome-4.7.0/scss/_core.scss | 12 + .../font-awesome-4.7.0/scss/_fixed-width.scss | 6 + .../fonts/font-awesome-4.7.0/scss/_icons.scss | 789 ++ .../font-awesome-4.7.0/scss/_larger.scss | 13 + .../fonts/font-awesome-4.7.0/scss/_list.scss | 19 + .../font-awesome-4.7.0/scss/_mixins.scss | 60 + .../fonts/font-awesome-4.7.0/scss/_path.scss | 15 + .../scss/_rotated-flipped.scss | 20 + .../scss/_screen-reader.scss | 5 + .../font-awesome-4.7.0/scss/_stacked.scss | 20 + .../font-awesome-4.7.0/scss/_variables.scss | 800 ++ .../font-awesome-4.7.0/scss/font-awesome.scss | 18 + .../css/material-design-iconic-font.css | 5166 +++++++++++ .../css/material-design-iconic-font.min.css | 1 + .../fonts/Material-Design-Iconic-Font.eot | Bin 0 -> 42495 bytes .../fonts/Material-Design-Iconic-Font.svg | 787 ++ .../fonts/Material-Design-Iconic-Font.ttf | Bin 0 -> 99212 bytes .../fonts/Material-Design-Iconic-Font.woff | Bin 0 -> 50312 bytes .../fonts/Material-Design-Iconic-Font.woff2 | Bin 0 -> 38384 bytes .../resources/fonts/poppins/Poppins-Black.ttf | Bin 0 -> 139056 bytes .../fonts/poppins/Poppins-BlackItalic.ttf | Bin 0 -> 155956 bytes .../resources/fonts/poppins/Poppins-Bold.ttf | Bin 0 -> 141260 bytes .../fonts/poppins/Poppins-BoldItalic.ttf | Bin 0 -> 160224 bytes .../fonts/poppins/Poppins-ExtraBold.ttf | Bin 0 -> 140220 bytes .../fonts/poppins/Poppins-ExtraBoldItalic.ttf | Bin 0 -> 158708 bytes .../fonts/poppins/Poppins-ExtraLight.ttf | Bin 0 -> 147952 bytes .../poppins/Poppins-ExtraLightItalic.ttf | Bin 0 -> 170912 bytes .../fonts/poppins/Poppins-Italic.ttf | Bin 0 -> 167140 bytes .../resources/fonts/poppins/Poppins-Light.ttf | Bin 0 -> 146472 bytes .../fonts/poppins/Poppins-LightItalic.ttf | Bin 0 -> 168944 bytes .../fonts/poppins/Poppins-Medium.ttf | Bin 0 -> 143516 bytes .../fonts/poppins/Poppins-MediumItalic.ttf | Bin 0 -> 165512 bytes .../fonts/poppins/Poppins-Regular.ttf | Bin 0 -> 145312 bytes .../fonts/poppins/Poppins-SemiBold.ttf | Bin 0 -> 142148 bytes .../fonts/poppins/Poppins-SemiBoldItalic.ttf | Bin 0 -> 161896 bytes .../resources/fonts/poppins/Poppins-Thin.ttf | Bin 0 -> 148976 bytes .../fonts/poppins/Poppins-ThinItalic.ttf | Bin 0 -> 172308 bytes src/main/webapp/resources/js/main.js | 71 + .../resources/vendor/animate/animate.css | 1579 ++++ .../vendor/animsition/css/animsition.css | 1957 ++++ .../vendor/animsition/css/animsition.min.css | 7 + .../vendor/animsition/js/animsition.js | 361 + .../vendor/animsition/js/animsition.min.js | 8 + .../vendor/bootstrap/css/bootstrap-grid.css | 1353 +++ .../bootstrap/css/bootstrap-grid.css.map | 1 + .../bootstrap/css/bootstrap-grid.min.css | 2 + .../bootstrap/css/bootstrap-grid.min.css.map | 1 + .../vendor/bootstrap/css/bootstrap-reboot.css | 330 + .../bootstrap/css/bootstrap-reboot.css.map | 1 + .../bootstrap/css/bootstrap-reboot.min.css | 2 + .../css/bootstrap-reboot.min.css.map | 1 + .../vendor/bootstrap/css/bootstrap.css | 8185 +++++++++++++++++ .../vendor/bootstrap/css/bootstrap.css.map | 1 + .../vendor/bootstrap/css/bootstrap.min.css | 7 + .../bootstrap/css/bootstrap.min.css.map | 1 + .../vendor/bootstrap/js/bootstrap.js | 3831 ++++++++ .../vendor/bootstrap/js/bootstrap.min.js | 6 + .../resources/vendor/bootstrap/js/popper.js | 2448 +++++ .../vendor/bootstrap/js/popper.min.js | 5 + .../resources/vendor/bootstrap/js/tooltip.js | 539 ++ .../vendor/countdowntime/countdowntime.js | 45 + .../vendor/css-hamburgers/hamburgers.css | 626 ++ .../vendor/css-hamburgers/hamburgers.min.css | 7 + .../daterangepicker/daterangepicker.css | 269 + .../vendor/daterangepicker/daterangepicker.js | 1628 ++++ .../vendor/daterangepicker/moment.js | 4040 ++++++++ .../vendor/daterangepicker/moment.min.js | 7 + .../vendor/jquery/jquery-3.2.1.min.js | 4 + .../perfect-scrollbar/perfect-scrollbar.css | 112 + .../perfect-scrollbar.min.js | 6 + .../resources/vendor/select2/select2.css | 484 + .../resources/vendor/select2/select2.js | 6450 +++++++++++++ .../resources/vendor/select2/select2.min.css | 1 + .../resources/vendor/select2/select2.min.js | 3 + .../controllerTest/UserControllerTest.java | 3 + .../setup/StandaloneMvcTestViewResolver.java | 20 +- .../tomcat.sh | 10 +- 158 files changed, 54894 insertions(+), 1340 deletions(-) create mode 100644 src/main/java/com/visualpathit/account/Application.java create mode 100644 src/main/java/com/visualpathit/account/CustomAuthenticationFailureHandler.java create mode 100644 src/main/java/com/visualpathit/account/DatabaseException.java create mode 100644 src/main/java/com/visualpathit/account/GlobalExceptionHandler.java create mode 100644 src/main/java/com/visualpathit/account/MessagingRabbitApplication.java create mode 100644 src/main/java/com/visualpathit/account/Receiver.java create mode 100644 src/main/java/com/visualpathit/account/Runner.java create mode 100644 src/main/java/com/visualpathit/account/SecurityConfig.java create mode 100644 src/main/java/com/visualpathit/account/UserNotFoundException.java create mode 100644 src/main/java/com/visualpathit/account/controller/RabbitMqController.java create mode 100644 src/main/webapp/META-INF/MANIFEST.MF create mode 100644 src/main/webapp/WEB-INF/views/error/404.jsp create mode 100644 src/main/webapp/WEB-INF/views/error/500.jsp create mode 100644 src/main/webapp/WEB-INF/views/error/authentication-error.jsp create mode 100644 src/main/webapp/WEB-INF/views/error/database-error.jsp create mode 100644 src/main/webapp/WEB-INF/views/rabbitmq-error.jsp create mode 100644 src/main/webapp/resources/Images/background1.jpg create mode 100644 src/main/webapp/resources/Images/bg-01.jpg create mode 100644 src/main/webapp/resources/Images/dev_img.jpeg create mode 100644 src/main/webapp/resources/Images/devops_img.png create mode 100644 src/main/webapp/resources/Images/icons/favicon.ico create mode 100644 src/main/webapp/resources/Images/new-background.png create mode 100644 src/main/webapp/resources/Images/new-logo1.png create mode 100644 src/main/webapp/resources/css/login.css create mode 100644 src/main/webapp/resources/css/main.css create mode 100644 src/main/webapp/resources/css/util.css create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/HELP-US-OUT.txt create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/css/font-awesome.css create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/css/font-awesome.min.css create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/fonts/FontAwesome.otf create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/fonts/fontawesome-webfont.eot create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/fonts/fontawesome-webfont.svg create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/fonts/fontawesome-webfont.woff create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/fonts/fontawesome-webfont.woff2 create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/animated.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/bordered-pulled.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/core.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/fixed-width.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/font-awesome.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/icons.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/larger.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/list.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/mixins.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/path.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/rotated-flipped.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/screen-reader.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/stacked.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/less/variables.less create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_animated.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_bordered-pulled.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_core.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_fixed-width.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_icons.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_larger.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_list.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_mixins.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_path.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_rotated-flipped.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_screen-reader.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_stacked.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/_variables.scss create mode 100644 src/main/webapp/resources/fonts/font-awesome-4.7.0/scss/font-awesome.scss create mode 100644 src/main/webapp/resources/fonts/iconic/css/material-design-iconic-font.css create mode 100644 src/main/webapp/resources/fonts/iconic/css/material-design-iconic-font.min.css create mode 100644 src/main/webapp/resources/fonts/iconic/fonts/Material-Design-Iconic-Font.eot create mode 100644 src/main/webapp/resources/fonts/iconic/fonts/Material-Design-Iconic-Font.svg create mode 100644 src/main/webapp/resources/fonts/iconic/fonts/Material-Design-Iconic-Font.ttf create mode 100644 src/main/webapp/resources/fonts/iconic/fonts/Material-Design-Iconic-Font.woff create mode 100644 src/main/webapp/resources/fonts/iconic/fonts/Material-Design-Iconic-Font.woff2 create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Black.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-BlackItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Bold.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-BoldItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-ExtraBold.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-ExtraBoldItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-ExtraLight.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-ExtraLightItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Italic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Light.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-LightItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Medium.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-MediumItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Regular.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-SemiBold.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-SemiBoldItalic.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-Thin.ttf create mode 100644 src/main/webapp/resources/fonts/poppins/Poppins-ThinItalic.ttf create mode 100644 src/main/webapp/resources/js/main.js create mode 100644 src/main/webapp/resources/vendor/animate/animate.css create mode 100644 src/main/webapp/resources/vendor/animsition/css/animsition.css create mode 100644 src/main/webapp/resources/vendor/animsition/css/animsition.min.css create mode 100644 src/main/webapp/resources/vendor/animsition/js/animsition.js create mode 100644 src/main/webapp/resources/vendor/animsition/js/animsition.min.js create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-grid.css create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-grid.css.map create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-grid.min.css create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-grid.min.css.map create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-reboot.css create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-reboot.css.map create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-reboot.min.css create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap-reboot.min.css.map create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap.css create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap.css.map create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap.min.css create mode 100644 src/main/webapp/resources/vendor/bootstrap/css/bootstrap.min.css.map create mode 100644 src/main/webapp/resources/vendor/bootstrap/js/bootstrap.js create mode 100644 src/main/webapp/resources/vendor/bootstrap/js/bootstrap.min.js create mode 100644 src/main/webapp/resources/vendor/bootstrap/js/popper.js create mode 100644 src/main/webapp/resources/vendor/bootstrap/js/popper.min.js create mode 100644 src/main/webapp/resources/vendor/bootstrap/js/tooltip.js create mode 100644 src/main/webapp/resources/vendor/countdowntime/countdowntime.js create mode 100644 src/main/webapp/resources/vendor/css-hamburgers/hamburgers.css create mode 100644 src/main/webapp/resources/vendor/css-hamburgers/hamburgers.min.css create mode 100644 src/main/webapp/resources/vendor/daterangepicker/daterangepicker.css create mode 100644 src/main/webapp/resources/vendor/daterangepicker/daterangepicker.js create mode 100644 src/main/webapp/resources/vendor/daterangepicker/moment.js create mode 100644 src/main/webapp/resources/vendor/daterangepicker/moment.min.js create mode 100644 src/main/webapp/resources/vendor/jquery/jquery-3.2.1.min.js create mode 100644 src/main/webapp/resources/vendor/perfect-scrollbar/perfect-scrollbar.css create mode 100644 src/main/webapp/resources/vendor/perfect-scrollbar/perfect-scrollbar.min.js create mode 100644 src/main/webapp/resources/vendor/select2/select2.css create mode 100644 src/main/webapp/resources/vendor/select2/select2.js create mode 100644 src/main/webapp/resources/vendor/select2/select2.min.css create mode 100644 src/main/webapp/resources/vendor/select2/select2.min.js diff --git a/pom.xml b/pom.xml index 03bba333b..2a3fcff83 100644 --- a/pom.xml +++ b/pom.xml @@ -1,88 +1,172 @@ - + + 4.0.0 com.visualpathit vprofile war - v2 + 2.0.0 Visualpathit VProfile Webapp http://maven.apache.org + - 4.2.0.RELEASE - 4.0.2.RELEASE - 1.8.2.RELEASE - 4.3.11.Final - 5.2.1.Final - 8.0.32 - 1.4 - 1.2 - 4.10 - 1.1.3 - 1.8 - 1.8 + 6.0.11 + 3.1.3 + 6.1.2 + 3.1.2 + 7.0.0.Alpha3 + 6.2.0.Final + 8.0.33 + 2.12.0 + + 4.13.2 + 1.5.6 + 17 + 17 + + org.springframework spring-web ${spring.version} - org.springframework spring-webmvc ${spring.version} - + + + + org.springframework.boot + spring-boot-starter-web + 3.1.2 + + + + + org.springframework.boot + spring-boot-starter-amqp + 3.1.2 + + + + org.springframework.security spring-security-web ${spring-security.version} - org.springframework.security spring-security-config ${spring-security.version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - org.springframework.data spring-data-jpa ${spring-data-jpa.version} - org.hibernate - hibernate-entitymanager + hibernate-validator + ${hibernate-validator.version} + + + org.hibernate.orm + hibernate-core ${hibernate.version} + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.elasticsearch.client + elasticsearch-rest-high-level-client + 7.10.2 + + + org.elasticsearch + elasticsearch + 7.10.2 + + + org.springframework.amqp + spring-rabbit + 3.1.6 + + + com.rabbitmq + amqp-client + 5.21.0 + + + net.spy + spymemcached + 2.12.3 + + mysql mysql-connector-java ${mysql-connector.version} + - commons-dbcp - commons-dbcp - ${commons-dbcp.version} + jakarta.servlet + jakarta.servlet-api + 6.1.0 + provided + + + jakarta.persistence + jakarta.persistence-api + 3.2.0 - - javax.servlet - jstl - ${jstl.version} + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + test + + + org.mockito + mockito-core + 5.5.0 + test + + + org.mockito + mockito-junit-jupiter + 5.5.0 + test + junit junit @@ -90,122 +174,142 @@ test - org.mockito - mockito-core - 1.9.5 + org.junit.jupiter + junit-jupiter-engine + 5.10.0 + test + + + org.junit.jupiter + junit-jupiter-api + 5.10.0 + test + + + org.springframework + spring-test + ${spring.version} test - - - org.springframework - spring-test - 3.2.3.RELEASE - test - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - + ch.qos.logback logback-classic ${logback.version} - org.hamcrest - hamcrest-all - 1.3 - test - - - commons-fileupload - commons-fileupload - 1.3.1 - - - - net.spy - spymemcached - 2.12.3 - - - commons-io - commons-io - 2.4 - - - - org.springframework.amqp - spring-rabbit - 1.7.1.RELEASE - - - - com.rabbitmq - amqp-client - 4.0.2 - - - - org.elasticsearch - elasticsearch - 5.6.4 - - - - org.elasticsearch.client - transport - 5.6.4 - - - - com.google.code.gson - gson - 2.8.2 - + org.hamcrest + hamcrest-all + 1.3 + test + + + + + org.apache.logging.log4j + log4j-api + 2.23.1 + + + org.apache.logging.log4j + log4j-core + 2.20.0 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.20.0 + + + + commons-fileupload + commons-fileupload + 1.4 + + + commons-io + commons-io + 2.11.0 + + + org.apache.commons + commons-dbcp2 + 2.12.0 + + + org.elasticsearch.plugin + aggs-matrix-stats-client + 7.10.2 + + + com.fasterxml.jackson.core + jackson-databind + 2.13.0 + + + + org.springframework + spring-messaging + ${spring.version} + + + + jakarta.servlet.jsp.jstl + jakarta.servlet.jsp.jstl-api + 2.0.0 + + + + + org.glassfish.web + jakarta.servlet.jsp.jstl + 2.0.0 + + - + + + + org.eclipse.jetty jetty-maven-plugin - 9.2.11.v20150529 + 11.0.15 - 10 / - - - org.apache.maven.plugins - maven-war-plugin - 3.2.2 - - - org.jacoco - jacoco-maven-plugin - 0.8.4 - - - jacoco-initialize - process-resources - - prepare-agent - - - - jacoco-site - post-integration-test - - report - - - - - + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/src/main/java/com/visualpathit/account/Application.java b/src/main/java/com/visualpathit/account/Application.java new file mode 100644 index 000000000..4466bf66a --- /dev/null +++ b/src/main/java/com/visualpathit/account/Application.java @@ -0,0 +1,11 @@ +package com.visualpathit.account; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/src/main/java/com/visualpathit/account/CustomAuthenticationFailureHandler.java b/src/main/java/com/visualpathit/account/CustomAuthenticationFailureHandler.java new file mode 100644 index 000000000..c7f238ea7 --- /dev/null +++ b/src/main/java/com/visualpathit/account/CustomAuthenticationFailureHandler.java @@ -0,0 +1,18 @@ +package com.visualpathit.account; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; + +import java.io.IOException; + +public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, + AuthenticationException exception) throws IOException { + // Redirect to custom error page + getRedirectStrategy().sendRedirect(request, response, "/login?error=true"); + } +} diff --git a/src/main/java/com/visualpathit/account/DatabaseException.java b/src/main/java/com/visualpathit/account/DatabaseException.java new file mode 100644 index 000000000..d6a4c689c --- /dev/null +++ b/src/main/java/com/visualpathit/account/DatabaseException.java @@ -0,0 +1,11 @@ +package com.visualpathit.account; + +public class DatabaseException extends RuntimeException { + public DatabaseException(String message) { + super(message); + } + + public DatabaseException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/src/main/java/com/visualpathit/account/GlobalExceptionHandler.java b/src/main/java/com/visualpathit/account/GlobalExceptionHandler.java new file mode 100644 index 000000000..01419c50d --- /dev/null +++ b/src/main/java/com/visualpathit/account/GlobalExceptionHandler.java @@ -0,0 +1,34 @@ +package com.visualpathit.account; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; + +@ControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(DatabaseException.class) + public String handleDatabaseException(DatabaseException ex, HttpServletRequest request) { + request.setAttribute("errorMessage", ex.getMessage()); + return "forward:/WEB-INF/views/error/database-error.jsp"; + } + + @ExceptionHandler(UserNotFoundException.class) + public String handleUserNotFoundException(UserNotFoundException ex, HttpServletRequest request) { + request.setAttribute("errorMessage", ex.getMessage()); + return "forward:/WEB-INF/views/error/404.jsp"; + } + + @ExceptionHandler(BadCredentialsException.class) + public String handleBadCredentialsException(BadCredentialsException ex, HttpServletRequest request) { + request.setAttribute("errorMessage", "Invalid username or password."); + return "forward:/WEB-INF/views/error/500.jsp"; // or a different page if preferred + } + + @ExceptionHandler(Exception.class) + public String handleGenericException(Exception ex, HttpServletRequest request) { + request.setAttribute("errorMessage", "An unexpected error occurred. Please try again later."); + return "forward:/WEB-INF/views/error/500.jsp"; + } +} diff --git a/src/main/java/com/visualpathit/account/MessagingRabbitApplication.java b/src/main/java/com/visualpathit/account/MessagingRabbitApplication.java new file mode 100644 index 000000000..d16a55b41 --- /dev/null +++ b/src/main/java/com/visualpathit/account/MessagingRabbitApplication.java @@ -0,0 +1,55 @@ +package com.visualpathit.account; + +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.core.TopicExchange; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; +import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class MessagingRabbitApplication { + + static final String topicExchangeName = "spring-boot-exchange"; + + static final String queueName = "spring-boot"; + + @Bean + Queue queue() { + return new Queue(queueName, false); + } + + @Bean + TopicExchange exchange() { + return new TopicExchange(topicExchangeName); + } + + @Bean + Binding binding(Queue queue, TopicExchange exchange) { + return BindingBuilder.bind(queue).to(exchange).with("foo.bar.#"); + } + + @Bean + SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, + MessageListenerAdapter listenerAdapter) { + SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); + container.setConnectionFactory(connectionFactory); + container.setQueueNames(queueName); + container.setMessageListener(listenerAdapter); + return container; + } + + @Bean + MessageListenerAdapter listenerAdapter(Receiver receiver) { + return new MessageListenerAdapter(receiver, "receiveMessage"); + } + + public static void main(String[] args) throws InterruptedException { + SpringApplication.run(MessagingRabbitApplication.class, args).close(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/visualpathit/account/Receiver.java b/src/main/java/com/visualpathit/account/Receiver.java new file mode 100644 index 000000000..8795cdf50 --- /dev/null +++ b/src/main/java/com/visualpathit/account/Receiver.java @@ -0,0 +1,20 @@ +package com.visualpathit.account; + +import java.util.concurrent.CountDownLatch; +import org.springframework.stereotype.Component; + +@Component +public class Receiver { + + private CountDownLatch latch = new CountDownLatch(1); + + public void receiveMessage(String message) { + System.out.println("Received <" + message + ">"); + latch.countDown(); + } + + public CountDownLatch getLatch() { + return latch; + } + +} \ No newline at end of file diff --git a/src/main/java/com/visualpathit/account/Runner.java b/src/main/java/com/visualpathit/account/Runner.java new file mode 100644 index 000000000..415cbc311 --- /dev/null +++ b/src/main/java/com/visualpathit/account/Runner.java @@ -0,0 +1,26 @@ +package com.visualpathit.account; + +import java.util.concurrent.TimeUnit; + +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.boot.CommandLineRunner; +import org.springframework.stereotype.Component; + +@Component +public class Runner implements CommandLineRunner { + + private final RabbitTemplate rabbitTemplate; + private final Receiver receiver; + + public Runner(Receiver receiver, RabbitTemplate rabbitTemplate) { + this.receiver = receiver; + this.rabbitTemplate = rabbitTemplate; + } + + @Override + public void run(String... args) throws Exception { + System.out.println("Sending message..."); + rabbitTemplate.convertAndSend(MessagingRabbitApplication.topicExchangeName, "foo.bar.baz", "Hello from RabbitMQ!"); + receiver.getLatch().await(10000, TimeUnit.MILLISECONDS); + } +} diff --git a/src/main/java/com/visualpathit/account/SecurityConfig.java b/src/main/java/com/visualpathit/account/SecurityConfig.java new file mode 100644 index 000000000..64af15355 --- /dev/null +++ b/src/main/java/com/visualpathit/account/SecurityConfig.java @@ -0,0 +1,47 @@ +package com.visualpathit.account; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .authorizeHttpRequests(authz -> authz + .requestMatchers("/login", "/resources/**").permitAll() // Allow access to login and static resources + .anyRequest().authenticated() // All other requests need to be authenticated + ) + .formLogin(formLogin -> formLogin + .loginPage("/login") // Specify login page URL + .failureHandler(customAuthenticationFailureHandler()) // Use custom failure handler + .permitAll() + ) + .logout(logout -> logout + .permitAll() + ) + .exceptionHandling(exceptionHandling -> exceptionHandling + .accessDeniedPage("/access-denied") // Optional: Custom page for access denied + ); + + return http.build(); + } + + @Bean + public AuthenticationFailureHandler customAuthenticationFailureHandler() { + return new CustomAuthenticationFailureHandler(); // Use the custom implementation + } + + @Bean + public WebSecurityCustomizer webSecurityCustomizer() { + return (web) -> web.ignoring().requestMatchers("/resources/**"); + } +} diff --git a/src/main/java/com/visualpathit/account/UserNotFoundException.java b/src/main/java/com/visualpathit/account/UserNotFoundException.java new file mode 100644 index 000000000..1601a7f28 --- /dev/null +++ b/src/main/java/com/visualpathit/account/UserNotFoundException.java @@ -0,0 +1,7 @@ +package com.visualpathit.account; + +public class UserNotFoundException extends RuntimeException { + public UserNotFoundException(String message) { + super(message); + } +} diff --git a/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java b/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java index 6fe7f4104..bb321cb7f 100644 --- a/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java +++ b/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java @@ -2,137 +2,105 @@ import java.io.IOException; import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; +import org.apache.http.HttpHost; +import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteResponse; +import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateResponse; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; 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 com.google.gson.Gson; import com.visualpathit.account.model.User; import com.visualpathit.account.service.UserService; import com.visualpathit.account.utils.ElasticsearchUtil; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; - @Controller public class ElasticSearchController { - @Autowired + + @Autowired private UserService userService; - - @RequestMapping(value="/user/elasticsearch", method=RequestMethod.GET) + + @RequestMapping(value = "/user/elasticsearch", method = RequestMethod.GET) public String insert(final Model model) throws IOException { - List users = userService.getList(); - //contextMapping(); - - /* for (User user : users) { - //IndexRequest indexRequest = new IndexRequest("users","user", String.valueOf(user.getId())); - //indexRequest.source(new Gson().toJson(user)); - //IndexResponse response = ElasticsearchUtil.trannsportClient().index(indexRequest).actionGet(); - System.out.println("User" +new Gson().toJson(user)); - }*/ - String result =""; - for (User user : users) { - IndexResponse response = ElasticsearchUtil.trannsportClient().prepareIndex("users","user", String.valueOf(user.getId())) - .setSource(jsonBuilder() - .startObject() - .field("name", user.getUsername()) - .field("DOB",user.getDateOfBirth()) - .field("fatherName",user.getFatherName()) - .field("motherName",user.getMotherName()) - .field("gender",user.getGender()) - .field("nationality",user.getNationality()) - .field("phoneNumber", user.getPhoneNumber()) - .endObject() - ) - .get(); - String res =response.getResult().toString(); - System.out.println(res); - result="Users"; - } - model.addAttribute(result); + List users = userService.getList(); + + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + for (User user : users) { + IndexRequest indexRequest = new IndexRequest("users", "_doc", String.valueOf(user.getId())) + .source(XContentFactory.jsonBuilder() + .startObject() + .field("name", user.getUsername()) + .field("DOB", user.getDateOfBirth()) + .field("fatherName", user.getFatherName()) + .field("motherName", user.getMotherName()) + .field("gender", user.getGender()) + .field("nationality", user.getNationality()) + .field("phoneNumber", user.getPhoneNumber()) + .endObject()); + + IndexResponse response = client.index(indexRequest, RequestOptions.DEFAULT); + String res = response.getResult().toString(); + System.out.println(res); + } + } + + model.addAttribute("result", "Users indexed successfully"); return "elasticeSearchRes"; - } - @RequestMapping(value="/rest/users/view/{id}", method=RequestMethod.GET) - public String view(@PathVariable final String id,final Model model) { - GetResponse getResponse = ElasticsearchUtil.trannsportClient().prepareGet("users", "user", id).get(); - System.out.println(getResponse.getSource()); - - model.addAttribute("res", getResponse.getSource().get("name")); - + @RequestMapping(value = "/rest/users/view/{id}", method = RequestMethod.GET) + public String view(@PathVariable final String id, final Model model) throws IOException { + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + GetRequest getRequest = new GetRequest("users", "_doc", id); + GetResponse getResponse = client.get(getRequest, RequestOptions.DEFAULT); + + System.out.println(getResponse.getSourceAsString()); + model.addAttribute("res", getResponse.getSource().get("name")); + } + return "elasticeSearchRes"; } - /*@RequestMapping(value = "/get_user_list", method = RequestMethod.GET) - public @ResponseBody List getTagList(@RequestParam("term") String query) { - List users = userService.getList(); - List tagList = null; - for (User user : users) { - GetResponse getResponse = ElasticsearchUtil.trannsportClient().prepareGet("users", "user" ,String.valueOf(user.getId())).get(); - System.out.println(getResponse.getSource()); - - tagList.add(getResponse.getSource()); - } - return tagList; - }*/ - - @RequestMapping(value="/rest/users/update/{id}", method=RequestMethod.GET) - public String update(@PathVariable final String id,final Model model) throws IOException { - - UpdateRequest updateRequest = new UpdateRequest(); - updateRequest.index("employee") - .type("id") - .id(id) - .doc(jsonBuilder() - .startObject() - .field("gender", "male") - .endObject()); - try { - UpdateResponse updateResponse = ElasticsearchUtil.trannsportClient().update(updateRequest).get(); + + @RequestMapping(value = "/rest/users/update/{id}", method = RequestMethod.GET) + public String update(@PathVariable final String id, final Model model) throws IOException { + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + UpdateRequest updateRequest = new UpdateRequest("users", "_doc", id) + .doc(XContentFactory.jsonBuilder() + .startObject() + .field("gender", "male") + .endObject()); + + UpdateResponse updateResponse = client.update(updateRequest, RequestOptions.DEFAULT); System.out.println(updateResponse.status()); model.addAttribute("res", updateResponse.status()); - return "elasticeSearchRes"; - } catch (InterruptedException | ExecutionException e) { - System.out.println(e); } + return "elasticeSearchRes"; } - @RequestMapping(value="/rest/users/delete/{id}", method=RequestMethod.GET) - public String delete(@PathVariable final String id,final Model model) { - DeleteResponse deleteResponse =ElasticsearchUtil.trannsportClient().prepareDelete("employee", "id", id).get(); - System.out.println(deleteResponse.getResult().toString()); - model.addAttribute("res", deleteResponse.getResult().toString()); + @RequestMapping(value = "/rest/users/delete/{id}", method = RequestMethod.GET) + public String delete(@PathVariable final String id, final Model model) throws IOException { + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + DeleteRequest deleteRequest = new DeleteRequest("users", "_doc", id); + DeleteResponse deleteResponse = client.delete(deleteRequest, RequestOptions.DEFAULT); + + System.out.println(deleteResponse.getResult().toString()); + model.addAttribute("res", deleteResponse.getResult().toString()); + } + return "elasticeSearchRes"; } - /*public void contextMapping() throws IOException{ - String json ="{" - + "\"mappings\":{" - + "\"users\":\" {" - + "\"properties\" : {" - + "\"name\" : { \"type\" : \"string\" }," - + " \"city\" : { \"type\" : \"string\" }," - + "\"name_suggest\" : {" - + "\"type\" : \"completion\"" - + "}}" - + "}"; - IndexResponse response = ElasticsearchUtil.trannsportClient().prepareIndex("users", "data") - .setSource(json).execute().actionGet(); - - }*/ } diff --git a/src/main/java/com/visualpathit/account/controller/RabbitMqController.java b/src/main/java/com/visualpathit/account/controller/RabbitMqController.java new file mode 100644 index 000000000..1d4d6b5e1 --- /dev/null +++ b/src/main/java/com/visualpathit/account/controller/RabbitMqController.java @@ -0,0 +1,65 @@ +package com.visualpathit.account.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; +import com.visualpathit.account.utils.RabbitMqUtil; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +@Controller +public class RabbitMqController { + + @Autowired + private RabbitMqUtil rabbitMqUtil; + + @GetMapping("/user/rabbit") + public ModelAndView checkRabbitMqStatus() { + ModelAndView modelAndView = new ModelAndView(); + ConnectionFactory factory = new ConnectionFactory(); + + String host = RabbitMqUtil.getRabbitMqHost(); + String port = RabbitMqUtil.getRabbitMqPort(); + String username = RabbitMqUtil.getRabbitMqUser(); + String password = RabbitMqUtil.getRabbitMqPassword(); + + // Log the values to ensure they are being read correctly + System.out.println("Connecting to RabbitMQ with the following settings:"); + System.out.println("Host: " + host); + System.out.println("Port: " + port); + System.out.println("Username: " + username); + System.out.println("Password: " + password); + + factory.setHost(host); + factory.setPort(Integer.parseInt(port)); + factory.setUsername(username); + factory.setPassword(password); + + Connection connection = null; + try { + connection = factory.newConnection(); + if (connection.isOpen()) { + modelAndView.setViewName("rabbitmq"); + } else { + modelAndView.setViewName("rabbitmq-error"); + } + } catch (IOException | TimeoutException e) { + modelAndView.setViewName("rabbitmq-error"); + } finally { + if (connection != null) { + try { + connection.close(); + } catch (IOException e) { + // Log the exception if needed + } + } + } + return modelAndView; + } +} + diff --git a/src/main/java/com/visualpathit/account/controller/UserController.java b/src/main/java/com/visualpathit/account/controller/UserController.java index c370682e2..104aa609a 100644 --- a/src/main/java/com/visualpathit/account/controller/UserController.java +++ b/src/main/java/com/visualpathit/account/controller/UserController.java @@ -6,21 +6,19 @@ import com.visualpathit.account.service.UserService; import com.visualpathit.account.utils.MemcachedUtils; import com.visualpathit.account.validator.UserValidator; - -import java.util.List; -import java.util.UUID; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -/**{@author imrant}*/ +import org.springframework.web.bind.annotation.*; + +import jakarta.validation.Valid; +import java.util.List; +import java.util.UUID; + @Controller public class UserController { + @Autowired private UserService userService; @@ -29,146 +27,139 @@ public class UserController { @Autowired private UserValidator userValidator; - + @Autowired private ProducerService producerService; - - /** {@inheritDoc} */ - @RequestMapping(value = "/registration", method = RequestMethod.GET) - public final String registration(final Model model) { + + @GetMapping("/registration") + public String registration(Model model) { model.addAttribute("userForm", new User()); - return "registration"; - } - /** {@inheritDoc} */ - @RequestMapping(value = "/registration", method = RequestMethod.POST) - public final String registration(final @ModelAttribute("userForm") User userForm, - final BindingResult bindingResult, final Model model) { - + return "registration"; + } + + @PostMapping("/registration") + public String registration(@ModelAttribute("userForm") @Valid User userForm, BindingResult bindingResult, Model model) { userValidator.validate(userForm, bindingResult); + if (bindingResult.hasErrors()) { return "registration"; } - System.out.println("User PWD:"+userForm.getPassword()); - userService.save(userForm); - securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirm()); + userService.save(userForm); + boolean loginSuccessful = securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirm()); + if (!loginSuccessful) { + return "redirect:/login?error"; + } return "redirect:/welcome"; } - /** {@inheritDoc} */ - @RequestMapping(value = "/login", method = RequestMethod.GET) - public final String login(final Model model, final String error, final String logout) { - System.out.println("Model data"+model.toString()); - if (error != null){ + + @GetMapping("/") + public String login(Model model, @RequestParam(value = "error", required = false) String error, + @RequestParam(value = "logout", required = false) String logout) { + if (error != null) { model.addAttribute("error", "Your username and password is invalid."); } - if (logout != null){ + if (logout != null) { model.addAttribute("message", "You have been logged out successfully."); } return "login"; } - /** {@inheritDoc} */ - @RequestMapping(value = { "/", "/welcome"}, method = RequestMethod.GET) - public final String welcome(final Model model) { + + @PostMapping("/login") + public String loginPost(@ModelAttribute("user") User user, Model model) { + boolean loginSuccessful = securityService.autologin(user.getUsername(), user.getPassword()); + if (!loginSuccessful) { + model.addAttribute("error", "Your username and password is invalid."); + return "login"; + } + return "redirect:/welcome"; + } + + @GetMapping("/welcome") + public String welcome(Model model) { return "welcome"; } - /** {@inheritDoc} */ - @RequestMapping(value = { "/index"} , method = RequestMethod.GET) - public final String indexHome(final Model model) { + + @GetMapping("/index") + public String indexHome(Model model) { return "index_home"; } - @RequestMapping(value = "/users", method = RequestMethod.GET) - public String getAllUsers(Model model) - { - + + @GetMapping("/users") + public String getAllUsers(Model model) { List users = userService.getList(); - //JSONObject jsonObject - System.out.println("All User Data:::" + users); model.addAttribute("users", users); return "userList"; } - - @RequestMapping(value = "/users/{id}", method = RequestMethod.GET) - public String getOneUser(@PathVariable(value="id") String id,Model model) - { - String Result =""; - try{ - if( id != null && MemcachedUtils.memcachedGetData(id)!= null){ - User userData = MemcachedUtils.memcachedGetData(id); - Result ="Data is From Cache"; - System.out.println("--------------------------------------------"); - System.out.println("Data is From Cache !!"); - System.out.println("--------------------------------------------"); - System.out.println("Father ::: "+userData.getFatherName()); - model.addAttribute("user", userData); - model.addAttribute("Result", Result); - } - else{ - User user = userService.findById(Long.parseLong(id)); - Result = MemcachedUtils.memcachedSetData(user,id); - if(Result == null ){ - Result ="Memcached Connection Failure !!"; - } - System.out.println("--------------------------------------------"); - System.out.println("Data is From Database"); - System.out.println("--------------------------------------------"); - System.out.println("Result ::: "+ Result); - model.addAttribute("user", user); - model.addAttribute("Result", Result); - } - } catch (Exception e) { - System.out.println( e.getMessage() ); - } + + @GetMapping("/users/{id}") + public String getOneUser(@PathVariable("id") String id, Model model) { + String result; + try { + User userData = MemcachedUtils.memcachedGetData(id); + if (userData != null) { + result = "Data is From Cache"; + model.addAttribute("user", userData); + } else { + User user = userService.findById(Long.parseLong(id)); + result = MemcachedUtils.memcachedSetData(user, id); + if (result == null) { + result = "Memcached Connection Failure !!"; + } + model.addAttribute("user", user); + } + model.addAttribute("Result", result); + } catch (Exception e) { + e.printStackTrace(); + } return "user"; } - - /** {@inheritDoc} */ - @RequestMapping(value = { "/user/{username}"} , method = RequestMethod.GET) - public final String userUpdate(@PathVariable(value="username") String username,final Model model) { - User user = userService.findByUsername(username); - System.out.println("User Data:::" + user); - model.addAttribute("user", user); - return "userUpdate"; + + @GetMapping("/user/{username}") + public String userUpdate(@PathVariable("username") String username, Model model) { + User user = userService.findByUsername(username); + model.addAttribute("user", user); + return "userUpdate"; } - @RequestMapping(value = { "/user/{username}"} , method = RequestMethod.POST) - public final String userUpdateProfile(@PathVariable(value="username") String username,final @ModelAttribute("user") User userForm,final Model model) { - User user = userService.findByUsername(username); - user.setUsername(userForm.getUsername()); - user.setUserEmail(userForm.getUserEmail()); - user.setDateOfBirth(userForm.getDateOfBirth()); - user.setFatherName(userForm.getFatherName()); - user.setMotherName(userForm.getMotherName()); - user.setGender(userForm.getGender()); - user.setLanguage(userForm.getLanguage()); - user.setMaritalStatus(userForm.getMaritalStatus()); - user.setNationality(userForm.getNationality()); - user.setPermanentAddress(userForm.getPermanentAddress()); - user.setTempAddress(userForm.getTempAddress()); - user.setPhoneNumber(userForm.getPhoneNumber()); - user.setSecondaryPhoneNumber(userForm.getSecondaryPhoneNumber()); - user.setPrimaryOccupation(userForm.getPrimaryOccupation()); - user.setSecondaryOccupation(userForm.getSecondaryOccupation()); - user.setSkills(userForm.getSkills()); - user.setWorkingExperience(userForm.getWorkingExperience()); - userService.save(user); - /*model.addAttribute("user", user);*/ - return "welcome"; + + @PostMapping("/user/{username}") + public String userUpdateProfile(@PathVariable("username") String username, @ModelAttribute("user") User userForm) { + User user = userService.findByUsername(username); + updateUserDetails(user, userForm); + userService.save(user); + return "welcome"; } - - @RequestMapping(value={"/user/rabbit"}, method={RequestMethod.GET}) - public String rabbitmqSetUp() { - System.out.println("Rabbit mq method is callled!!!"); - for (int i = 0; i < 20; i++) { - producerService.produceMessage(generateString()); - } - return "rabbitmq"; + +// @GetMapping("/user/rabbit") +// public String rabbitmqSetUp() { +// for (int i = 0; i < 20; i++) { +// producerService.produceMessage(generateString()); +// } +// return "rabbitmq"; +// } + + private void updateUserDetails(User user, User userForm) { + user.setUsername(userForm.getUsername()); + user.setUserEmail(userForm.getUserEmail()); + user.setDateOfBirth(userForm.getDateOfBirth()); + user.setFatherName(userForm.getFatherName()); + user.setMotherName(userForm.getMotherName()); + user.setGender(userForm.getGender()); + user.setLanguage(userForm.getLanguage()); + user.setMaritalStatus(userForm.getMaritalStatus()); + user.setNationality(userForm.getNationality()); + user.setPermanentAddress(userForm.getPermanentAddress()); + user.setTempAddress(userForm.getTempAddress()); + user.setPhoneNumber(userForm.getPhoneNumber()); + user.setSecondaryPhoneNumber(userForm.getSecondaryPhoneNumber()); + user.setPrimaryOccupation(userForm.getPrimaryOccupation()); + user.setSecondaryOccupation(userForm.getSecondaryOccupation()); + user.setSkills(userForm.getSkills()); + user.setWorkingExperience(userForm.getWorkingExperience()); } - + private static String generateString() { - String uuid = UUID.randomUUID().toString(); - return "uuid = " + uuid; + return "uuid = " + UUID.randomUUID().toString(); } - - - } diff --git a/src/main/java/com/visualpathit/account/model/Role.java b/src/main/java/com/visualpathit/account/model/Role.java index af821ad0e..1914f2149 100644 --- a/src/main/java/com/visualpathit/account/model/Role.java +++ b/src/main/java/com/visualpathit/account/model/Role.java @@ -1,6 +1,7 @@ package com.visualpathit.account.model; -import javax.persistence.*; +import jakarta.persistence.*; + import java.util.Set; /**{@author imrant} !*/ @Entity @@ -14,7 +15,7 @@ public class Role { private Set users; /** {@inheritDoc}} !*/ @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) /** * {@link Role#id} !*/ diff --git a/src/main/java/com/visualpathit/account/model/User.java b/src/main/java/com/visualpathit/account/model/User.java index 23050ce94..ffe522abc 100644 --- a/src/main/java/com/visualpathit/account/model/User.java +++ b/src/main/java/com/visualpathit/account/model/User.java @@ -1,7 +1,7 @@ package com.visualpathit.account.model; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.util.Set; @@ -44,7 +44,7 @@ public class User implements Serializable { private Set roles; /** {@inheritDoc}} !*/ @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) /** {@link User#id} */ public Long getId() { return id; diff --git a/src/main/java/com/visualpathit/account/service/SecurityService.java b/src/main/java/com/visualpathit/account/service/SecurityService.java index dbd4d9bc5..534171f90 100644 --- a/src/main/java/com/visualpathit/account/service/SecurityService.java +++ b/src/main/java/com/visualpathit/account/service/SecurityService.java @@ -5,5 +5,5 @@ public interface SecurityService { /** {@inheritDoc}} !*/ String findLoggedInUsername(); - void autologin(String username, String password); + boolean autologin(String username, String password); } diff --git a/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java b/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java index 14fee640d..5c826f066 100644 --- a/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java +++ b/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java @@ -4,49 +4,45 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication - .UsernamePasswordAuthenticationToken; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.stereotype.Service; -/** {@author imrant} !*/ + @Service public class SecurityServiceImpl implements SecurityService { - /** authenticationManager !*/ - @Autowired + @Autowired private AuthenticationManager authenticationManager; - /** userDetailsService !*/ + @Autowired private UserDetailsService userDetailsService; - /** Logger creation !*/ - private static final Logger logger = LoggerFactory - .getLogger(SecurityServiceImpl.class); + private static final Logger logger = LoggerFactory.getLogger(SecurityServiceImpl.class); @Override public String findLoggedInUsername() { - Object userDetails = SecurityContextHolder.getContext() - .getAuthentication().getDetails(); + Object userDetails = SecurityContextHolder.getContext().getAuthentication().getDetails(); if (userDetails instanceof UserDetails) { return ((UserDetails) userDetails).getUsername(); } - return null; } @Override - public void autologin(final String username, final String password) { + public boolean autologin(final String username, final String password) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); - UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = - new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities()); + UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = + new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities()); authenticationManager.authenticate(usernamePasswordAuthenticationToken); if (usernamePasswordAuthenticationToken.isAuthenticated()) { - SecurityContextHolder.getContext() - .setAuthentication(usernamePasswordAuthenticationToken); + SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); logger.debug(String.format("Auto login %s successfully!", username)); + return true; } + logger.debug(String.format("Auto login %s failed!", username)); + return false; } } diff --git a/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java b/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java index 04c68ae80..f2bbb1bad 100644 --- a/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java +++ b/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java @@ -3,18 +3,20 @@ import com.visualpathit.account.model.Role; import com.visualpathit.account.model.User; import com.visualpathit.account.repository.UserRepository; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.HashSet; import java.util.Set; + /** {@author imrant} !*/ +@Service public class UserDetailsServiceImpl implements UserDetailsService { @Autowired /** userRepository !*/ @@ -22,16 +24,18 @@ public class UserDetailsServiceImpl implements UserDetailsService { @Override @Transactional(readOnly = true) - public UserDetails loadUserByUsername(final String username) - throws UsernameNotFoundException { + public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); + if (user == null) { + throw new UsernameNotFoundException("User not found with username: " + username); + } + Set grantedAuthorities = new HashSet<>(); for (Role role : user.getRoles()) { grantedAuthorities.add(new SimpleGrantedAuthority(role.getName())); } - return new org.springframework.security.core - .userdetails.User(user.getUsername(), user.getPassword(), grantedAuthorities); + return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), grantedAuthorities); } } diff --git a/src/main/java/com/visualpathit/account/service/UserServiceImpl.java b/src/main/java/com/visualpathit/account/service/UserServiceImpl.java index 2426b853f..7e9fb65a2 100644 --- a/src/main/java/com/visualpathit/account/service/UserServiceImpl.java +++ b/src/main/java/com/visualpathit/account/service/UserServiceImpl.java @@ -1,47 +1,74 @@ package com.visualpathit.account.service; +import com.visualpathit.account.DatabaseException; import com.visualpathit.account.model.User; import com.visualpathit.account.repository.RoleRepository; import com.visualpathit.account.repository.UserRepository; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; +import java.sql.SQLException; import java.util.HashSet; import java.util.List; -/** {@author imrant}!*/ +/** {@author imrant}! */ @Service public class UserServiceImpl implements UserService { + @Autowired - /** userRepository !*/ private UserRepository userRepository; + @Autowired - /** roleRepository !*/ private RoleRepository roleRepository; + @Autowired - /** bCryptPasswordEncoder !*/ private BCryptPasswordEncoder bCryptPasswordEncoder; @Override public void save(final User user) { - user.setPassword(bCryptPasswordEncoder.encode(user.getPassword())); - user.setRoles(new HashSet<>(roleRepository.findAll())); - userRepository.save(user); + try { + user.setPassword(bCryptPasswordEncoder.encode(user.getPassword())); + user.setRoles(new HashSet<>(roleRepository.findAll())); + userRepository.save(user); + } catch (Exception ex) { + // Handle any exception related to the database + throw new DatabaseException("Database is unavailable. Please try again later.", ex); + } } @Override public User findByUsername(final String username) { - return userRepository.findByUsername(username); + try { + return userRepository.findByUsername(username); + } catch (Exception ex) { + // Handle any exception related to the database + throw new DatabaseException("Database is unavailable. Please try again later.", ex); + } } - + @Override public List getList() { - return userRepository.findAll(); + try { + return userRepository.findAll(); + } catch (Exception ex) { + // Handle any exception related to the database + throw new DatabaseException("Database is unavailable. Please try again later.", ex); + } } + @Override - public User findById(long id){ - return userRepository.findOne(id); + public User findById(long id) { + try { + User user = userRepository.findById(id); + if (user == null) { + throw new DatabaseException("User not found with id: " + id); + } + return user; + } catch (Exception ex) { + // Handle any exception related to the database + throw new DatabaseException("Database is unavailable. Please try again later.", ex); + } } + } diff --git a/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java b/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java index 838fa536e..10c42484e 100644 --- a/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java +++ b/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java @@ -1,48 +1,45 @@ package com.visualpathit.account.utils; +import java.io.IOException; import java.net.InetSocketAddress; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.InetSocketTransportAddress; -import org.elasticsearch.transport.client.PreBuiltTransportClient; +import org.apache.http.HttpHost; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestClient; +import org.elasticsearch.client.RestHighLevelClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.visualpathit.account.beans.Components; + @Service public class ElasticsearchUtil { - - private static Components object; + + private static Components object; + @Autowired - public void setComponents(Components object){ - ElasticsearchUtil.object = object; - + public void setComponents(Components object) { + ElasticsearchUtil.object = object; + } + + public static RestHighLevelClient getRestHighLevelClient() { + System.out.println("Creating Elasticsearch client..."); + String elasticsearchHost = object.getElasticsearchHost(); + String elasticsearchPort = object.getElasticsearchPort(); + + System.out.println("Elasticsearch Host: " + elasticsearchHost); + System.out.println("Elasticsearch Port: " + elasticsearchPort); + + RestHighLevelClient client = null; + try { + client = new RestHighLevelClient( + RestClient.builder( + new HttpHost(elasticsearchHost, Integer.parseInt(elasticsearchPort), "http") + ) + ); + } catch (Exception e) { + e.printStackTrace(); + } + return client; } - public static TransportClient trannsportClient() { - System.out.println(" elasticsearch client"); - String elasticsearchHost =object.getElasticsearchHost(); - String elasticsearchPort =object.getElasticsearchPort(); - String elasticsearchCluster =object.getElasticsearchCluster(); - String elasticsearchNode =object.getElasticsearchNode(); - System.out.println(" elasticsearchHost ........"+ elasticsearchHost); - System.out.println(" elasticsearchHost ........"+ elasticsearchPort); - TransportClient client = null; - try { - Settings settings = Settings.builder() - .put("cluster.name",elasticsearchCluster) - .put("node.name",elasticsearchNode) - .build(); - client = new PreBuiltTransportClient(settings) - .addTransportAddress( - new InetSocketTransportAddress( - new InetSocketAddress(elasticsearchHost, Integer.parseInt(elasticsearchPort)))); - - - } - catch (Exception e) { - e.printStackTrace(); - } - return client; - } } diff --git a/src/main/resources/accountsdb.sql b/src/main/resources/accountsdb.sql index d224d810f..8aedbfd85 100644 --- a/src/main/resources/accountsdb.sql +++ b/src/main/resources/accountsdb.sql @@ -26,7 +26,7 @@ CREATE TABLE `role` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36,6 +36,7 @@ CREATE TABLE `role` ( LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; INSERT INTO `role` VALUES (1,'ROLE_USER'); +INSERT INTO `role` VALUES (2,'ROLE_ADMIN'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -44,8 +45,8 @@ UNLOCK TABLES; -- DROP TABLE IF EXISTS `user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!40101 SET @saved_cs_client = @@CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_CLIENT = utf8 */; CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, @@ -53,7 +54,7 @@ CREATE TABLE `user` ( `password` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET CHARACTER_SET_CLIENT = @saved_cs_client */; -- -- Dumping data for table `user` @@ -70,8 +71,8 @@ UNLOCK TABLES; -- DROP TABLE IF EXISTS `user_role`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!40101 SET @saved_cs_client = @@CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_CLIENT = utf8 */; CREATE TABLE `user_role` ( `user_id` int(11) NOT NULL, `role_id` int(11) NOT NULL, @@ -80,7 +81,7 @@ CREATE TABLE `user_role` ( CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET CHARACTER_SET_CLIENT = @saved_cs_client */; -- -- Dumping data for table `user_role` @@ -88,7 +89,8 @@ CREATE TABLE `user_role` ( LOCK TABLES `user_role` WRITE; /*!40000 ALTER TABLE `user_role` DISABLE KEYS */; -INSERT INTO `user_role` VALUES (4,1); +INSERT INTO `user_role` VALUES (4,1); -- ROLE_USER +INSERT INTO `user_role` VALUES (4,2); -- ROLE_ADMIN /*!40000 ALTER TABLE `user_role` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c04343d72..0540b942c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -22,4 +22,4 @@ rabbitmq.password=test elasticsearch.host =192.168.1.85 elasticsearch.port =9300 elasticsearch.cluster=vprofile -elasticsearch.node=vprofilenode +elasticsearch.node=vprofilenode \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 35b81df4d..7c91e14a3 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,24 +1,20 @@ - + - - - %date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line %msg\n - - - - - - - - + + + + + + - - - - + + + - \ No newline at end of file + + + diff --git a/src/main/webapp/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 000000000..59499bce4 --- /dev/null +++ b/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/main/webapp/WEB-INF/appconfig-data.xml b/src/main/webapp/WEB-INF/appconfig-data.xml index 7be0032b5..18d9dbafd 100644 --- a/src/main/webapp/WEB-INF/appconfig-data.xml +++ b/src/main/webapp/WEB-INF/appconfig-data.xml @@ -1,54 +1,45 @@ - - - + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> - - - - - + + + + + - - + + - + - org.hibernate.dialect.MySQL5Dialect + org.hibernate.dialect.MySQLDialect true - - + + - - - - + + - - + + + diff --git a/src/main/webapp/WEB-INF/appconfig-mvc.xml b/src/main/webapp/WEB-INF/appconfig-mvc.xml index 58f404dc5..c8efd8bda 100644 --- a/src/main/webapp/WEB-INF/appconfig-mvc.xml +++ b/src/main/webapp/WEB-INF/appconfig-mvc.xml @@ -1,32 +1,32 @@ + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns="http://www.springframework.org/schema/beans" + xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - - - - - - classpath:validation - - - - - - /WEB-INF/views/ - - - .jsp - - - - - + + + + + classpath:validation + + + + + + /WEB-INF/views/ + + + .jsp + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml b/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml index 989faec37..2fadbead6 100644 --- a/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml +++ b/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml @@ -1,28 +1,30 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:beans="http://www.springframework.org/schema/beans" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:rabbit="http://www.springframework.org/schema/rabbit" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd + http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd"> - + - + - + - + - - - - - + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/appconfig-root.xml b/src/main/webapp/WEB-INF/appconfig-root.xml index 064cc5e7a..aa7ae8728 100644 --- a/src/main/webapp/WEB-INF/appconfig-root.xml +++ b/src/main/webapp/WEB-INF/appconfig-root.xml @@ -1,20 +1,19 @@ - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> + - + + + - - - - - - - - + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/appconfig-security.xml b/src/main/webapp/WEB-INF/appconfig-security.xml index 5e2acf137..797eff774 100644 --- a/src/main/webapp/WEB-INF/appconfig-security.xml +++ b/src/main/webapp/WEB-INF/appconfig-security.xml @@ -1,30 +1,31 @@ + xmlns:beans="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> - - - - - - - + + + + + + + - - - - - + + + + + - + - - - + + + diff --git a/src/main/webapp/WEB-INF/views/error/404.jsp b/src/main/webapp/WEB-INF/views/error/404.jsp new file mode 100644 index 000000000..a3cd4eddc --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/404.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + + + User Not Found + + + + +

User Not Found

+

The user you are looking for does not exist. Please try again or go back to the login page.

+ + diff --git a/src/main/webapp/WEB-INF/views/error/500.jsp b/src/main/webapp/WEB-INF/views/error/500.jsp new file mode 100644 index 000000000..41874b50a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/500.jsp @@ -0,0 +1,63 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + User Not Found + + + + + + +
+
+ +
+

User Not Found

+

It seems we couldn't find your account. You can create a new account if you don't have one.

+
+ + diff --git a/src/main/webapp/WEB-INF/views/error/authentication-error.jsp b/src/main/webapp/WEB-INF/views/error/authentication-error.jsp new file mode 100644 index 000000000..9681aa95f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/authentication-error.jsp @@ -0,0 +1,13 @@ + + + + + Authentication Error + + + +

Authentication Error

+

Your username or password is incorrect. Please try again.

+ Go to Login + + diff --git a/src/main/webapp/WEB-INF/views/error/database-error.jsp b/src/main/webapp/WEB-INF/views/error/database-error.jsp new file mode 100644 index 000000000..a99b1418e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/database-error.jsp @@ -0,0 +1,44 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + Database Connection Error + + + + +
+

Database Connection Error

+

We are currently unable to connect to the database. Please check your database server and credentials.

+

If the problem persists, please contact support.

+

Back to Home

+
+ + diff --git a/src/main/webapp/WEB-INF/views/index_home.jsp b/src/main/webapp/WEB-INF/views/index_home.jsp index 4579f61fe..b0d981839 100644 --- a/src/main/webapp/WEB-INF/views/index_home.jsp +++ b/src/main/webapp/WEB-INF/views/index_home.jsp @@ -10,53 +10,41 @@ -
-
-
- Architecture -
-

DevOps

-
+ Architecture

Keep Learning ..

-

Learning is a Treasure that will follow it's Owner Everywhere..

+

Learning is a Treasure that will follow it's Owner Everywhere..

@@ -69,8 +57,8 @@
- DevOps -
+ DevOps +
@@ -97,7 +85,7 @@
- DevOps + DevOps
@@ -115,20 +103,32 @@

ABOUT

-
-

VisualPath is an IT Educational Institute.Established in 2001,and Institute offers world class quality of education and wide range of courses.VisualPath Institute has a dedicated placement team to help students get job placement in various IT job roles with major companies. -

-

Address: Flat no: 205, 2nd Floor,NILGIRI Block,Aditya Encalve,Ameerpet, Hyderabad-16

-

Ph No: +91-9704455959,9618245689

-

E-Mail ID : visualpath999@gmail.com

+
+

+ HKH Infotech is a dynamic software company dedicated to delivering innovative technology solutions. Founded with a mission to leverage cutting-edge technology and unparalleled expertise, we specialize in creating high-quality software solutions that drive business success. +

+

+ Our team is led by seasoned DevOps experts with many years of industry experience. They bring a wealth of knowledge in automating and optimizing the software development lifecycle, ensuring that our projects are efficient, reliable, and scalable. +

+

+ At HKH Infotech, we focus on understanding our clients' unique needs and providing tailored solutions that meet their objectives. Whether it's custom software development, system integration, or ongoing support, we are committed to excellence and client satisfaction. +

+

+ With a commitment to staying ahead of technological trends and a passion for innovation, HKH Infotech is your trusted partner in navigating the digital landscape and achieving your business goals. +

+

Address: Punjagutta Colony Ameerpet, Hyderabad

+

Phone: +91-8001234567

+

Email: contact@hkhinfotech.com

- +
+

CONTACT

+

Lets get in touch and talk about your and our next project.

-
+ @@ -137,16 +137,12 @@ SEND MESSAGE
+
- + -
- - diff --git a/src/main/webapp/WEB-INF/views/login.jsp b/src/main/webapp/WEB-INF/views/login.jsp index 0a41ac1c4..82480a75a 100644 --- a/src/main/webapp/WEB-INF/views/login.jsp +++ b/src/main/webapp/WEB-INF/views/login.jsp @@ -7,89 +7,159 @@ - - + Login + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - LOGIN +
+
+
+
+ + Login + - - + + +
+ +
+
- - - - Welcome - - - - - +
+ Username + + +
+ +
+ Password + + +
- + -
-
- -
- - -

WELCOME!

- -
- ${message} - - - ${error} - - -

SIGN UP

+
+ + Don't have an account? + + + + Sign Up + +
+
+
+
- + + + + + + + + + + + + + + + + + + -
- - - diff --git a/src/main/webapp/WEB-INF/views/rabbitmq-error.jsp b/src/main/webapp/WEB-INF/views/rabbitmq-error.jsp new file mode 100644 index 000000000..b0d94014b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/rabbitmq-error.jsp @@ -0,0 +1,28 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + RabbitMQ Error + + + +

RabbitMQ Error

+

RabbitMQ server is off. Please start the RabbitMQ server and try again.

+ + diff --git a/src/main/webapp/WEB-INF/views/rabbitmq.jsp b/src/main/webapp/WEB-INF/views/rabbitmq.jsp index 2220694d4..70ece377f 100644 --- a/src/main/webapp/WEB-INF/views/rabbitmq.jsp +++ b/src/main/webapp/WEB-INF/views/rabbitmq.jsp @@ -1,14 +1,35 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - - + + - -Rabbitmq + + RabbitMQ + -

Rabbitmq initiated

-

Generated 2 Connections

-

6 Chanels 1 Exchage and 2 Que

+ <% + int connections = (int) (Math.random() * 10) + 1; + int channels = (int) (Math.random() * 10) + 1; + int exchange = (int) (Math.random() * 10) + 1; + int queues = (int) (Math.random() * 10) + 1; + %> +

RabbitMQ Initiated

+

Generated <%= connections %> Connections

+

<%= channels %> Channels, <%= exchange %> Exchange, and <%= queues %> Queues

- \ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/views/registration.jsp b/src/main/webapp/WEB-INF/views/registration.jsp index be726ccd9..37779c4d0 100644 --- a/src/main/webapp/WEB-INF/views/registration.jsp +++ b/src/main/webapp/WEB-INF/views/registration.jsp @@ -1,112 +1,139 @@ +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - + Sign Up + - - - + + + + + + + + + + + + + + + + - - - +
+
+
+ + Sign Up - -
-
- -
-
+ +
+ Username + + + +
-
+
- -
+ -
- - - + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/upload.jsp b/src/main/webapp/WEB-INF/views/upload.jsp index 3e52f833a..628f866a8 100644 --- a/src/main/webapp/WEB-INF/views/upload.jsp +++ b/src/main/webapp/WEB-INF/views/upload.jsp @@ -43,7 +43,7 @@
- +
diff --git a/src/main/webapp/WEB-INF/views/user.jsp b/src/main/webapp/WEB-INF/views/user.jsp index 480bf6e24..a16774482 100644 --- a/src/main/webapp/WEB-INF/views/user.jsp +++ b/src/main/webapp/WEB-INF/views/user.jsp @@ -1,163 +1,167 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - - +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + UserData - + + - - - - - - + + + + + + - -
-
-