From 5c54b4fb7a7ee2c5ef203e46036dccfd18421053 Mon Sep 17 00:00:00 2001 From: Ankita Date: Fri, 29 Oct 2021 16:46:19 +0530 Subject: [PATCH 1/5] First Commit --- .../java/com/adminportal/AdminController.java | 2719 +++ .../AdminPortalSchoolProjectApplication.java | 130 + .../com/adminportal/AdminViewController.java | 1706 ++ .../adminportal/ContributorController.java | 1016 + .../java/com/adminportal/HomeController.java | 1379 ++ .../com/adminportal/HomeControllerRest.java | 3527 ++++ .../com/adminportal/HttpRequestLogger.java | 28 + .../adminportal/RegistrationController.java | 550 + .../config/ExternalFileConfig.java | 38 + .../adminportal/config/MailConstructor.java | 57 + .../adminportal/config/SecurityConfig.java | 172 + .../adminportal/content/ArticleExternal.java | 229 + .../java/com/adminportal/content/Class.java | 109 + .../java/com/adminportal/content/Comment.java | 213 + .../com/adminportal/content/CommentReply.java | 123 + .../com/adminportal/content/ConceptMap.java | 234 + .../com/adminportal/content/ContactForm.java | 106 + .../adminportal/content/DocumentExternal.java | 226 + .../java/com/adminportal/content/Events.java | 202 + .../com/adminportal/content/LessonPlan.java | 195 + .../java/com/adminportal/content/Phets.java | 230 + .../com/adminportal/content/QuizQuestion.java | 225 + .../java/com/adminportal/content/Subject.java | 123 + .../content/SubjectClassMapping.java | 109 + .../com/adminportal/content/Testimonial.java | 126 + .../java/com/adminportal/content/Topic.java | 247 + .../com/adminportal/content/Tutorial.java | 156 + .../adminportal/content/VideoExternal.java | 225 + .../com/adminportal/domain/RoleDetail.java | 72 + .../java/com/adminportal/domain/User.java | 520 + .../java/com/adminportal/domain/UserRole.java | 82 + .../repository/ArticleExternalRepository.java | 131 + .../repository/ClassRepository.java | 30 + .../repository/CommentReplyRepository.java | 27 + .../repository/CommentRepository.java | 76 + .../repository/ConceptMapRepository.java | 121 + .../repository/ContactFormRepository.java | 19 + .../DocumentExternalRepository.java | 127 + .../repository/EventsRepository.java | 55 + .../repository/LessonPlanRepository.java | 116 + .../repository/PhetsRepository.java | 118 + .../repository/QuizQuestionRepository.java | 136 + .../repository/RoleRepository.java | 26 + .../SubjectClassMappingRepository.java | 78 + .../repository/SubjectRepository.java | 40 + .../repository/TestimonialRepository.java | 45 + .../repository/TopicRepository.java | 136 + .../repository/TutorialRepository.java | 62 + .../repository/UserRepository.java | 97 + .../repository/UserRoleRepository.java | 23 + .../repository/VideoExternalRepository.java | 116 + .../com/adminportal/security/Authority.java | 25 + .../service/ArticleExternalService.java | 116 + .../com/adminportal/service/ClassService.java | 49 + .../service/CommentReplyService.java | 33 + .../adminportal/service/CommentService.java | 100 + .../service/ConceptMapService.java | 113 + .../service/ContactFormService.java | 25 + .../service/DocumentExternalService.java | 121 + .../com/adminportal/service/EventService.java | 74 + .../service/LessonPlanService.java | 109 + .../com/adminportal/service/PhetsService.java | 106 + .../service/QuizQuestionService.java | 129 + .../service/RoleDetailService.java | 39 + .../service/SubjectClassService.java | 101 + .../adminportal/service/SubjectService.java | 81 + .../service/TestimonialService.java | 67 + .../com/adminportal/service/TopicService.java | 128 + .../adminportal/service/TutorialService.java | 66 + .../adminportal/service/UserRoleService.java | 15 + .../com/adminportal/service/UserService.java | 236 + .../service/VideoExternalService.java | 110 + .../impl/ArticleExternalServiceImpl.java | 185 + .../service/impl/ClassServiceImpl.java | 76 + .../service/impl/CommentReplyServiceImpl.java | 48 + .../service/impl/CommentServiceImpl.java | 142 + .../service/impl/ConceptMapServiceImpl.java | 178 + .../service/impl/ContactFormServiceImpl.java | 33 + .../impl/DocumentExternalServiceImpl.java | 186 + .../service/impl/EventServiceImpl.java | 101 + .../service/impl/LessonPlanServiceImpl.java | 169 + .../service/impl/PhetsServiceImpl.java | 162 + .../service/impl/QuizQuestionServiceImpl.java | 199 + .../service/impl/RoleDetailServiceImpl.java | 58 + .../service/impl/SubjectClassServiceimpl.java | 130 + .../service/impl/SubjectServiceImpl.java | 154 + .../service/impl/TestimonialServiceImpl.java | 103 + .../service/impl/TopicServiceimpl.java | 192 + .../service/impl/TutorialServiceImpl.java | 108 + .../service/impl/UserRoleServiceImpl.java | 29 + .../service/impl/UserSecurityService.java | 40 + .../service/impl/UserServiceimpl.java | 401 + .../impl/VideoExternalServiceImpl.java | 167 + .../Utility/CommentAjaxQueryResolver.java | 114 + .../CommentReplyAjaxQueryResolver.java | 92 + .../com/spoken/Utility/LoadUserLearner.java | 196 + .../com/spoken/Utility/ServiceUtility.java | 366 + .../Utility/SubjectAjaxQueryResolver.java | 66 + .../SubjectClassAjaxQueryResolver.java | 43 + .../java/com/spoken/Utility/TutorialList.java | 102 + .../passwordUpdateAjaxQueryResolver.java | 47 + src/main/resources/application.properties | 63 + .../css/dataTables.bootstrap.css | 187 + .../css/dataTables.bootstrap.min.css | 1 + .../css/dataTables.bootstrap4.css | 206 + .../css/dataTables.bootstrap4.min.css | 1 + .../css/dataTables.foundation.css | 118 + .../css/dataTables.foundation.min.css | 1 + .../css/dataTables.jqueryui.css | 481 + .../css/dataTables.jqueryui.min.css | 1 + .../css/dataTables.semanticui.css | 102 + .../css/dataTables.semanticui.min.css | 1 + .../css/jquery.dataTables.css | 448 + .../css/jquery.dataTables.min.css | 1 + .../DataTables-1.10.20/images/sort_asc.png | Bin 0 -> 160 bytes .../images/sort_asc_disabled.png | Bin 0 -> 148 bytes .../DataTables-1.10.20/images/sort_both.png | Bin 0 -> 201 bytes .../DataTables-1.10.20/images/sort_desc.png | Bin 0 -> 158 bytes .../images/sort_desc_disabled.png | Bin 0 -> 146 bytes .../js/dataTables.bootstrap.js | 182 + .../js/dataTables.bootstrap.min.js | 11 + .../js/dataTables.bootstrap4.js | 184 + .../js/dataTables.bootstrap4.min.js | 11 + .../js/dataTables.foundation.js | 174 + .../js/dataTables.foundation.min.js | 9 + .../js/dataTables.jqueryui.js | 164 + .../js/dataTables.jqueryui.min.js | 12 + .../js/dataTables.semanticui.js | 212 + .../js/dataTables.semanticui.min.js | 12 + .../js/jquery.dataTables.js | 15334 +++++++++++++++ .../js/jquery.dataTables.min.js | 180 + src/main/resources/static/Images/about_us.jpg | Bin 0 -> 57961 bytes .../resources/static/Images/background.png | Bin 0 -> 67456 bytes .../static/Images/backgroundStartup.jpg | Bin 0 -> 2735013 bytes src/main/resources/static/Images/cetr.png | Bin 0 -> 274 bytes src/main/resources/static/Images/def_face.jpg | Bin 0 -> 10628 bytes src/main/resources/static/Images/images2.jpeg | Bin 0 -> 14057 bytes src/main/resources/static/Images/index.jpeg | Bin 0 -> 13274 bytes src/main/resources/static/Images/index1.jpeg | Bin 0 -> 9077 bytes src/main/resources/static/Images/logo.png | Bin 0 -> 4166 bytes src/main/resources/static/Images/main_bg2.png | Bin 0 -> 292033 bytes .../resources/static/Images/maxresdefault.jpg | Bin 0 -> 103731 bytes .../static/Images/no-profile-image.jpg | Bin 0 -> 2052 bytes .../resources/static/Images/testimonial6.jpg | Bin 0 -> 88303 bytes .../static/Images/testimonials-caret.png | Bin 0 -> 539 bytes src/main/resources/static/css/all.css | 4392 +++++ src/main/resources/static/css/all.min.css | 5 + .../resources/static/css/bootstrap-grid.css | 3719 ++++ .../static/css/bootstrap-grid.css.map | 1 + .../static/css/bootstrap-grid.min.css | 7 + .../static/css/bootstrap-grid.min.css.map | 1 + .../resources/static/css/bootstrap-reboot.css | 331 + .../static/css/bootstrap-reboot.css.map | 1 + .../static/css/bootstrap-reboot.min.css | 8 + .../static/css/bootstrap-reboot.min.css.map | 1 + src/main/resources/static/css/bootstrap.css | 10038 ++++++++++ .../resources/static/css/bootstrap.css.map | 1 + .../resources/static/css/bootstrap.min.css | 7 + .../static/css/bootstrap.min.css.map | 1 + src/main/resources/static/css/demo.css | 828 + src/main/resources/static/css/font.css | 6 + src/main/resources/static/css/item.css | 106 + .../static/css/light-bootstrap-dashboard.css | 5304 +++++ src/main/resources/static/css/main.css | 967 + src/main/resources/static/css/mdb.css | 8464 ++++++++ src/main/resources/static/css/menu.css | 33 + src/main/resources/static/css/print.css | 7 + src/main/resources/static/css/resources.css | 407 + src/main/resources/static/css/shape.css | 43 + src/main/resources/static/css/style.css | 849 + src/main/resources/static/css/styleMyMind.css | 73 + .../resources/static/css/styleTemplate.css | 97 + src/main/resources/static/css/ui.css | 205 + src/main/resources/static/datatables.css | 220 + src/main/resources/static/datatables.js | 15534 +++++++++++++++ src/main/resources/static/datatables.min.css | 15 + src/main/resources/static/datatables.min.js | 207 + .../resources/static/font/nucleo-icons.eot | Bin 0 -> 27560 bytes .../resources/static/font/nucleo-icons.svg | 312 + .../resources/static/font/nucleo-icons.ttf | Bin 0 -> 27376 bytes .../resources/static/font/nucleo-icons.woff | Bin 0 -> 15884 bytes .../resources/static/font/nucleo-icons.woff2 | Bin 0 -> 13344 bytes .../static/font/roboto/Roboto-Bold.eot | Bin 0 -> 20966 bytes .../static/font/roboto/Roboto-Bold.ttf | Bin 0 -> 127744 bytes .../static/font/roboto/Roboto-Bold.woff | Bin 0 -> 62876 bytes .../static/font/roboto/Roboto-Bold.woff2 | Bin 0 -> 49976 bytes .../static/font/roboto/Roboto-Light.eot | Bin 0 -> 20940 bytes .../static/font/roboto/Roboto-Light.ttf | Bin 0 -> 126792 bytes .../static/font/roboto/Roboto-Light.woff | Bin 0 -> 62316 bytes .../static/font/roboto/Roboto-Light.woff2 | Bin 0 -> 49380 bytes .../static/font/roboto/Roboto-Medium.eot | Bin 0 -> 21364 bytes .../static/font/roboto/Roboto-Medium.ttf | Bin 0 -> 127488 bytes .../static/font/roboto/Roboto-Medium.woff | Bin 0 -> 62980 bytes .../static/font/roboto/Roboto-Medium.woff2 | Bin 0 -> 50224 bytes .../static/font/roboto/Roboto-Regular.eot | Bin 0 -> 21320 bytes .../static/font/roboto/Roboto-Regular.ttf | Bin 0 -> 126072 bytes .../static/font/roboto/Roboto-Regular.woff | Bin 0 -> 61736 bytes .../static/font/roboto/Roboto-Regular.woff2 | Bin 0 -> 49236 bytes .../static/font/roboto/Roboto-Thin.eot | Bin 0 -> 21659 bytes .../static/font/roboto/Roboto-Thin.ttf | Bin 0 -> 127584 bytes .../static/font/roboto/Roboto-Thin.woff | Bin 0 -> 61628 bytes .../static/font/roboto/Roboto-Thin.woff2 | Bin 0 -> 48524 bytes src/main/resources/static/icons/help.png | Bin 0 -> 2049 bytes src/main/resources/static/icons/new.png | Bin 0 -> 1387 bytes src/main/resources/static/icons/open.png | Bin 0 -> 1798 bytes src/main/resources/static/icons/save-as.png | Bin 0 -> 2152 bytes src/main/resources/static/icons/save.png | Bin 0 -> 1263 bytes src/main/resources/static/img/apple-icon.png | Bin 0 -> 2446 bytes .../resources/static/img/default-avatar.png | Bin 0 -> 2864 bytes src/main/resources/static/img/favicon.ico | Bin 0 -> 1150 bytes src/main/resources/static/img/flags.png | Bin 0 -> 28123 bytes .../static/img/full-screen-image-3.jpg | Bin 0 -> 499035 bytes .../static/img/lightbox/default-skin.png | Bin 0 -> 547 bytes .../static/img/lightbox/default-skin.svg | 1 + .../static/img/lightbox/preloader.gif | Bin 0 -> 866 bytes .../resources/static/img/loading-bubbles.svg | 14 + src/main/resources/static/img/mask.png | Bin 0 -> 756 bytes src/main/resources/static/img/new_logo.png | Bin 0 -> 3557 bytes src/main/resources/static/img/overlays/01.png | Bin 0 -> 211 bytes src/main/resources/static/img/overlays/02.png | Bin 0 -> 213 bytes src/main/resources/static/img/overlays/03.png | Bin 0 -> 209 bytes src/main/resources/static/img/overlays/04.png | Bin 0 -> 211 bytes src/main/resources/static/img/overlays/05.png | Bin 0 -> 213 bytes src/main/resources/static/img/overlays/06.png | Bin 0 -> 211 bytes src/main/resources/static/img/overlays/07.png | Bin 0 -> 215 bytes src/main/resources/static/img/overlays/08.png | Bin 0 -> 146 bytes src/main/resources/static/img/overlays/09.png | Bin 0 -> 137 bytes src/main/resources/static/img/sample.jpg | Bin 0 -> 204946 bytes src/main/resources/static/img/sidebar-1.jpg | Bin 0 -> 225399 bytes src/main/resources/static/img/sidebar-2.jpg | Bin 0 -> 129997 bytes src/main/resources/static/img/sidebar-3.jpg | Bin 0 -> 119572 bytes src/main/resources/static/img/sidebar-4.jpg | Bin 0 -> 143224 bytes src/main/resources/static/img/sidebar-5.jpg | Bin 0 -> 87627 bytes .../resources/static/img/svg/arrow_left.svg | 4 + .../resources/static/img/svg/arrow_right.svg | 4 + src/main/resources/static/img/svg/flags.png | Bin 0 -> 28123 bytes src/main/resources/static/img/tim_80x80.png | Bin 0 -> 4821 bytes src/main/resources/static/js/ajaxPoperty.js | 8564 +++++++++ src/main/resources/static/js/all.js | 4313 +++++ .../resources/static/js/bootstrap-notify.js | 432 + .../resources/static/js/bootstrap-switch.js | 397 + .../resources/static/js/bootstrap.bundle.js | 7013 +++++++ .../static/js/bootstrap.bundle.js.map | 1 + .../static/js/bootstrap.bundle.min.js | 7 + .../static/js/bootstrap.bundle.min.js.map | 1 + src/main/resources/static/js/bootstrap.js | 4435 +++++ src/main/resources/static/js/bootstrap.js.map | 1 + src/main/resources/static/js/bootstrap.min.js | 7 + .../resources/static/js/bootstrap.min.js.map | 1 + src/main/resources/static/js/chartist.min.js | 9 + src/main/resources/static/js/demo.js | 522 + .../resources/static/js/jquery-3.4.1.min.js | 3 + .../resources/static/js/jquery.3.2.1.min.js | 4 + .../static/js/light-bootstrap-dashboard.js | 204 + src/main/resources/static/js/mdb.js | 15986 ++++++++++++++++ src/main/resources/static/js/popper.min.js | 4 + src/main/resources/templates/Courses.html | 92 + src/main/resources/templates/Index.html | 499 + src/main/resources/templates/Login.html | 99 + src/main/resources/templates/Signup.html | 319 + src/main/resources/templates/about.html | 107 + .../resources/templates/accessDeniedPage.html | 48 + src/main/resources/templates/addArticle.html | 458 + src/main/resources/templates/addClass.html | 224 + .../resources/templates/addConcpetMap.html | 506 + src/main/resources/templates/addDocument.html | 488 + src/main/resources/templates/addEvent.html | 568 + .../resources/templates/addLessonPlan.html | 398 + src/main/resources/templates/addPhets.html | 456 + src/main/resources/templates/addQuiz.html | 446 + src/main/resources/templates/addSubject.html | 389 + .../resources/templates/addTestimonial.html | 437 + src/main/resources/templates/addTopic.html | 490 + src/main/resources/templates/addTutorial.html | 388 + src/main/resources/templates/addVideo.html | 670 + src/main/resources/templates/addView.html | 215 + .../resources/templates/approveReject.html | 224 + .../templates/approveRejectArticle.html | 349 + .../templates/approveRejectConcept.html | 380 + .../templates/approveRejectDocument.html | 377 + .../templates/approveRejectLesson.html | 316 + .../templates/approveRejectPhet.html | 352 + .../templates/approveRejectQuiz.html | 322 + .../templates/approveRejectTeacher.html | 280 + .../templates/approveRejectVideo.html | 366 + src/main/resources/templates/article.html | 336 + .../resources/templates/common/header.html | 373 + src/main/resources/templates/conceptMap.html | 347 + .../templates/contentConceptMap.html | 353 + .../templates/contentLessonPlan.html | 331 + .../resources/templates/contentLinks.html | 410 + src/main/resources/templates/contentPhet.html | 392 + src/main/resources/templates/contentQuiz.html | 336 + .../resources/templates/contentTutorial.html | 326 + src/main/resources/templates/contentView.html | 1890 ++ src/main/resources/templates/document.html | 342 + src/main/resources/templates/error/404.html | 42 + src/main/resources/templates/error/405.html | 42 + src/main/resources/templates/events.html | 227 + .../resources/templates/forgetPassword.html | 67 + src/main/resources/templates/lessonPlan.html | 330 + src/main/resources/templates/logout.html | 78 + src/main/resources/templates/message.html | 220 + src/main/resources/templates/phets.html | 329 + src/main/resources/templates/quiz.html | 355 + .../resources/templates/resetPassword.html | 63 + src/main/resources/templates/testimonial.html | 153 + src/main/resources/templates/user.html | 362 + src/main/resources/templates/userList.html | 372 + src/main/resources/templates/video.html | 459 + ...inPortalSchoolProjectApplicationTests.java | 16 + .../service/ArticleExternalServiceTest.java | 60 + .../adminportal/service/ClassServiceTest.java | 94 + .../service/CommentServiceTest.java | 39 + .../service/ConceptMapServiceTest.java | 114 + .../service/DocumentExternalServiceTest.java | 101 + .../adminportal/service/EventServiceTest.java | 74 + .../service/LessonPlanServiceTest.java | 97 + .../adminportal/service/PhetServiceTest.java | 96 + .../service/QuizQuestionServiceTest.java | 135 + .../service/SubjectServiceTest.java | 90 + .../service/TestimonialServiceTest.java | 70 + .../service/TutorialServiceTest.java | 56 + .../adminportal/service/UserServiceTest.java | 261 + .../service/VideoExternalServiceTest.java | 96 + .../service/roleDetailServiceTest.java | 54 + 326 files changed, 154847 insertions(+) create mode 100644 src/main/java/com/adminportal/AdminController.java create mode 100644 src/main/java/com/adminportal/AdminPortalSchoolProjectApplication.java create mode 100644 src/main/java/com/adminportal/AdminViewController.java create mode 100644 src/main/java/com/adminportal/ContributorController.java create mode 100644 src/main/java/com/adminportal/HomeController.java create mode 100644 src/main/java/com/adminportal/HomeControllerRest.java create mode 100644 src/main/java/com/adminportal/HttpRequestLogger.java create mode 100644 src/main/java/com/adminportal/RegistrationController.java create mode 100644 src/main/java/com/adminportal/config/ExternalFileConfig.java create mode 100644 src/main/java/com/adminportal/config/MailConstructor.java create mode 100644 src/main/java/com/adminportal/config/SecurityConfig.java create mode 100644 src/main/java/com/adminportal/content/ArticleExternal.java create mode 100644 src/main/java/com/adminportal/content/Class.java create mode 100644 src/main/java/com/adminportal/content/Comment.java create mode 100644 src/main/java/com/adminportal/content/CommentReply.java create mode 100644 src/main/java/com/adminportal/content/ConceptMap.java create mode 100644 src/main/java/com/adminportal/content/ContactForm.java create mode 100644 src/main/java/com/adminportal/content/DocumentExternal.java create mode 100644 src/main/java/com/adminportal/content/Events.java create mode 100644 src/main/java/com/adminportal/content/LessonPlan.java create mode 100644 src/main/java/com/adminportal/content/Phets.java create mode 100644 src/main/java/com/adminportal/content/QuizQuestion.java create mode 100644 src/main/java/com/adminportal/content/Subject.java create mode 100644 src/main/java/com/adminportal/content/SubjectClassMapping.java create mode 100644 src/main/java/com/adminportal/content/Testimonial.java create mode 100644 src/main/java/com/adminportal/content/Topic.java create mode 100644 src/main/java/com/adminportal/content/Tutorial.java create mode 100644 src/main/java/com/adminportal/content/VideoExternal.java create mode 100644 src/main/java/com/adminportal/domain/RoleDetail.java create mode 100644 src/main/java/com/adminportal/domain/User.java create mode 100644 src/main/java/com/adminportal/domain/UserRole.java create mode 100644 src/main/java/com/adminportal/repository/ArticleExternalRepository.java create mode 100644 src/main/java/com/adminportal/repository/ClassRepository.java create mode 100644 src/main/java/com/adminportal/repository/CommentReplyRepository.java create mode 100644 src/main/java/com/adminportal/repository/CommentRepository.java create mode 100644 src/main/java/com/adminportal/repository/ConceptMapRepository.java create mode 100644 src/main/java/com/adminportal/repository/ContactFormRepository.java create mode 100644 src/main/java/com/adminportal/repository/DocumentExternalRepository.java create mode 100644 src/main/java/com/adminportal/repository/EventsRepository.java create mode 100644 src/main/java/com/adminportal/repository/LessonPlanRepository.java create mode 100644 src/main/java/com/adminportal/repository/PhetsRepository.java create mode 100644 src/main/java/com/adminportal/repository/QuizQuestionRepository.java create mode 100644 src/main/java/com/adminportal/repository/RoleRepository.java create mode 100644 src/main/java/com/adminportal/repository/SubjectClassMappingRepository.java create mode 100644 src/main/java/com/adminportal/repository/SubjectRepository.java create mode 100644 src/main/java/com/adminportal/repository/TestimonialRepository.java create mode 100644 src/main/java/com/adminportal/repository/TopicRepository.java create mode 100644 src/main/java/com/adminportal/repository/TutorialRepository.java create mode 100644 src/main/java/com/adminportal/repository/UserRepository.java create mode 100644 src/main/java/com/adminportal/repository/UserRoleRepository.java create mode 100644 src/main/java/com/adminportal/repository/VideoExternalRepository.java create mode 100644 src/main/java/com/adminportal/security/Authority.java create mode 100644 src/main/java/com/adminportal/service/ArticleExternalService.java create mode 100644 src/main/java/com/adminportal/service/ClassService.java create mode 100644 src/main/java/com/adminportal/service/CommentReplyService.java create mode 100644 src/main/java/com/adminportal/service/CommentService.java create mode 100644 src/main/java/com/adminportal/service/ConceptMapService.java create mode 100644 src/main/java/com/adminportal/service/ContactFormService.java create mode 100644 src/main/java/com/adminportal/service/DocumentExternalService.java create mode 100644 src/main/java/com/adminportal/service/EventService.java create mode 100644 src/main/java/com/adminportal/service/LessonPlanService.java create mode 100644 src/main/java/com/adminportal/service/PhetsService.java create mode 100644 src/main/java/com/adminportal/service/QuizQuestionService.java create mode 100644 src/main/java/com/adminportal/service/RoleDetailService.java create mode 100644 src/main/java/com/adminportal/service/SubjectClassService.java create mode 100644 src/main/java/com/adminportal/service/SubjectService.java create mode 100644 src/main/java/com/adminportal/service/TestimonialService.java create mode 100644 src/main/java/com/adminportal/service/TopicService.java create mode 100644 src/main/java/com/adminportal/service/TutorialService.java create mode 100644 src/main/java/com/adminportal/service/UserRoleService.java create mode 100644 src/main/java/com/adminportal/service/UserService.java create mode 100644 src/main/java/com/adminportal/service/VideoExternalService.java create mode 100644 src/main/java/com/adminportal/service/impl/ArticleExternalServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/ClassServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/CommentReplyServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/CommentServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/ConceptMapServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/ContactFormServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/DocumentExternalServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/EventServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/LessonPlanServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/PhetsServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/QuizQuestionServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/RoleDetailServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/SubjectClassServiceimpl.java create mode 100644 src/main/java/com/adminportal/service/impl/SubjectServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/TestimonialServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/TopicServiceimpl.java create mode 100644 src/main/java/com/adminportal/service/impl/TutorialServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/UserRoleServiceImpl.java create mode 100644 src/main/java/com/adminportal/service/impl/UserSecurityService.java create mode 100644 src/main/java/com/adminportal/service/impl/UserServiceimpl.java create mode 100644 src/main/java/com/adminportal/service/impl/VideoExternalServiceImpl.java create mode 100644 src/main/java/com/spoken/Utility/CommentAjaxQueryResolver.java create mode 100644 src/main/java/com/spoken/Utility/CommentReplyAjaxQueryResolver.java create mode 100644 src/main/java/com/spoken/Utility/LoadUserLearner.java create mode 100644 src/main/java/com/spoken/Utility/ServiceUtility.java create mode 100644 src/main/java/com/spoken/Utility/SubjectAjaxQueryResolver.java create mode 100644 src/main/java/com/spoken/Utility/SubjectClassAjaxQueryResolver.java create mode 100644 src/main/java/com/spoken/Utility/TutorialList.java create mode 100644 src/main/java/com/spoken/Utility/passwordUpdateAjaxQueryResolver.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap.min.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.min.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.min.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.min.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.min.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.css create mode 100644 src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.min.css create mode 100644 src/main/resources/static/DataTables-1.10.20/images/sort_asc.png create mode 100644 src/main/resources/static/DataTables-1.10.20/images/sort_asc_disabled.png create mode 100644 src/main/resources/static/DataTables-1.10.20/images/sort_both.png create mode 100644 src/main/resources/static/DataTables-1.10.20/images/sort_desc.png create mode 100644 src/main/resources/static/DataTables-1.10.20/images/sort_desc_disabled.png create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.bootstrap.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.bootstrap.min.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.bootstrap4.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.bootstrap4.min.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.foundation.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.foundation.min.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.jqueryui.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.jqueryui.min.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.semanticui.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/dataTables.semanticui.min.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/jquery.dataTables.js create mode 100644 src/main/resources/static/DataTables-1.10.20/js/jquery.dataTables.min.js create mode 100644 src/main/resources/static/Images/about_us.jpg create mode 100644 src/main/resources/static/Images/background.png create mode 100644 src/main/resources/static/Images/backgroundStartup.jpg create mode 100644 src/main/resources/static/Images/cetr.png create mode 100644 src/main/resources/static/Images/def_face.jpg create mode 100644 src/main/resources/static/Images/images2.jpeg create mode 100644 src/main/resources/static/Images/index.jpeg create mode 100644 src/main/resources/static/Images/index1.jpeg create mode 100644 src/main/resources/static/Images/logo.png create mode 100644 src/main/resources/static/Images/main_bg2.png create mode 100644 src/main/resources/static/Images/maxresdefault.jpg create mode 100644 src/main/resources/static/Images/no-profile-image.jpg create mode 100644 src/main/resources/static/Images/testimonial6.jpg create mode 100644 src/main/resources/static/Images/testimonials-caret.png create mode 100644 src/main/resources/static/css/all.css create mode 100644 src/main/resources/static/css/all.min.css create mode 100644 src/main/resources/static/css/bootstrap-grid.css create mode 100644 src/main/resources/static/css/bootstrap-grid.css.map create mode 100644 src/main/resources/static/css/bootstrap-grid.min.css create mode 100644 src/main/resources/static/css/bootstrap-grid.min.css.map create mode 100644 src/main/resources/static/css/bootstrap-reboot.css create mode 100644 src/main/resources/static/css/bootstrap-reboot.css.map create mode 100644 src/main/resources/static/css/bootstrap-reboot.min.css create mode 100644 src/main/resources/static/css/bootstrap-reboot.min.css.map create mode 100644 src/main/resources/static/css/bootstrap.css create mode 100644 src/main/resources/static/css/bootstrap.css.map create mode 100644 src/main/resources/static/css/bootstrap.min.css create mode 100644 src/main/resources/static/css/bootstrap.min.css.map create mode 100644 src/main/resources/static/css/demo.css create mode 100644 src/main/resources/static/css/font.css create mode 100644 src/main/resources/static/css/item.css create mode 100644 src/main/resources/static/css/light-bootstrap-dashboard.css create mode 100644 src/main/resources/static/css/main.css create mode 100644 src/main/resources/static/css/mdb.css create mode 100644 src/main/resources/static/css/menu.css create mode 100644 src/main/resources/static/css/print.css create mode 100644 src/main/resources/static/css/resources.css create mode 100644 src/main/resources/static/css/shape.css create mode 100644 src/main/resources/static/css/style.css create mode 100644 src/main/resources/static/css/styleMyMind.css create mode 100644 src/main/resources/static/css/styleTemplate.css create mode 100644 src/main/resources/static/css/ui.css create mode 100644 src/main/resources/static/datatables.css create mode 100644 src/main/resources/static/datatables.js create mode 100644 src/main/resources/static/datatables.min.css create mode 100644 src/main/resources/static/datatables.min.js create mode 100644 src/main/resources/static/font/nucleo-icons.eot create mode 100644 src/main/resources/static/font/nucleo-icons.svg create mode 100644 src/main/resources/static/font/nucleo-icons.ttf create mode 100644 src/main/resources/static/font/nucleo-icons.woff create mode 100644 src/main/resources/static/font/nucleo-icons.woff2 create mode 100644 src/main/resources/static/font/roboto/Roboto-Bold.eot create mode 100644 src/main/resources/static/font/roboto/Roboto-Bold.ttf create mode 100644 src/main/resources/static/font/roboto/Roboto-Bold.woff create mode 100644 src/main/resources/static/font/roboto/Roboto-Bold.woff2 create mode 100644 src/main/resources/static/font/roboto/Roboto-Light.eot create mode 100644 src/main/resources/static/font/roboto/Roboto-Light.ttf create mode 100644 src/main/resources/static/font/roboto/Roboto-Light.woff create mode 100644 src/main/resources/static/font/roboto/Roboto-Light.woff2 create mode 100644 src/main/resources/static/font/roboto/Roboto-Medium.eot create mode 100644 src/main/resources/static/font/roboto/Roboto-Medium.ttf create mode 100644 src/main/resources/static/font/roboto/Roboto-Medium.woff create mode 100644 src/main/resources/static/font/roboto/Roboto-Medium.woff2 create mode 100644 src/main/resources/static/font/roboto/Roboto-Regular.eot create mode 100644 src/main/resources/static/font/roboto/Roboto-Regular.ttf create mode 100644 src/main/resources/static/font/roboto/Roboto-Regular.woff create mode 100644 src/main/resources/static/font/roboto/Roboto-Regular.woff2 create mode 100644 src/main/resources/static/font/roboto/Roboto-Thin.eot create mode 100644 src/main/resources/static/font/roboto/Roboto-Thin.ttf create mode 100644 src/main/resources/static/font/roboto/Roboto-Thin.woff create mode 100644 src/main/resources/static/font/roboto/Roboto-Thin.woff2 create mode 100644 src/main/resources/static/icons/help.png create mode 100644 src/main/resources/static/icons/new.png create mode 100644 src/main/resources/static/icons/open.png create mode 100644 src/main/resources/static/icons/save-as.png create mode 100644 src/main/resources/static/icons/save.png create mode 100644 src/main/resources/static/img/apple-icon.png create mode 100644 src/main/resources/static/img/default-avatar.png create mode 100644 src/main/resources/static/img/favicon.ico create mode 100644 src/main/resources/static/img/flags.png create mode 100644 src/main/resources/static/img/full-screen-image-3.jpg create mode 100644 src/main/resources/static/img/lightbox/default-skin.png create mode 100644 src/main/resources/static/img/lightbox/default-skin.svg create mode 100644 src/main/resources/static/img/lightbox/preloader.gif create mode 100644 src/main/resources/static/img/loading-bubbles.svg create mode 100644 src/main/resources/static/img/mask.png create mode 100644 src/main/resources/static/img/new_logo.png create mode 100644 src/main/resources/static/img/overlays/01.png create mode 100644 src/main/resources/static/img/overlays/02.png create mode 100644 src/main/resources/static/img/overlays/03.png create mode 100644 src/main/resources/static/img/overlays/04.png create mode 100644 src/main/resources/static/img/overlays/05.png create mode 100644 src/main/resources/static/img/overlays/06.png create mode 100644 src/main/resources/static/img/overlays/07.png create mode 100644 src/main/resources/static/img/overlays/08.png create mode 100644 src/main/resources/static/img/overlays/09.png create mode 100644 src/main/resources/static/img/sample.jpg create mode 100644 src/main/resources/static/img/sidebar-1.jpg create mode 100644 src/main/resources/static/img/sidebar-2.jpg create mode 100644 src/main/resources/static/img/sidebar-3.jpg create mode 100644 src/main/resources/static/img/sidebar-4.jpg create mode 100644 src/main/resources/static/img/sidebar-5.jpg create mode 100644 src/main/resources/static/img/svg/arrow_left.svg create mode 100644 src/main/resources/static/img/svg/arrow_right.svg create mode 100644 src/main/resources/static/img/svg/flags.png create mode 100644 src/main/resources/static/img/tim_80x80.png create mode 100644 src/main/resources/static/js/ajaxPoperty.js create mode 100644 src/main/resources/static/js/all.js create mode 100644 src/main/resources/static/js/bootstrap-notify.js create mode 100644 src/main/resources/static/js/bootstrap-switch.js create mode 100644 src/main/resources/static/js/bootstrap.bundle.js create mode 100644 src/main/resources/static/js/bootstrap.bundle.js.map create mode 100644 src/main/resources/static/js/bootstrap.bundle.min.js create mode 100644 src/main/resources/static/js/bootstrap.bundle.min.js.map create mode 100644 src/main/resources/static/js/bootstrap.js create mode 100644 src/main/resources/static/js/bootstrap.js.map create mode 100644 src/main/resources/static/js/bootstrap.min.js create mode 100644 src/main/resources/static/js/bootstrap.min.js.map create mode 100644 src/main/resources/static/js/chartist.min.js create mode 100644 src/main/resources/static/js/demo.js create mode 100644 src/main/resources/static/js/jquery-3.4.1.min.js create mode 100644 src/main/resources/static/js/jquery.3.2.1.min.js create mode 100644 src/main/resources/static/js/light-bootstrap-dashboard.js create mode 100644 src/main/resources/static/js/mdb.js create mode 100644 src/main/resources/static/js/popper.min.js create mode 100644 src/main/resources/templates/Courses.html create mode 100644 src/main/resources/templates/Index.html create mode 100644 src/main/resources/templates/Login.html create mode 100644 src/main/resources/templates/Signup.html create mode 100644 src/main/resources/templates/about.html create mode 100644 src/main/resources/templates/accessDeniedPage.html create mode 100644 src/main/resources/templates/addArticle.html create mode 100644 src/main/resources/templates/addClass.html create mode 100644 src/main/resources/templates/addConcpetMap.html create mode 100644 src/main/resources/templates/addDocument.html create mode 100644 src/main/resources/templates/addEvent.html create mode 100644 src/main/resources/templates/addLessonPlan.html create mode 100644 src/main/resources/templates/addPhets.html create mode 100644 src/main/resources/templates/addQuiz.html create mode 100644 src/main/resources/templates/addSubject.html create mode 100644 src/main/resources/templates/addTestimonial.html create mode 100644 src/main/resources/templates/addTopic.html create mode 100644 src/main/resources/templates/addTutorial.html create mode 100644 src/main/resources/templates/addVideo.html create mode 100644 src/main/resources/templates/addView.html create mode 100644 src/main/resources/templates/approveReject.html create mode 100644 src/main/resources/templates/approveRejectArticle.html create mode 100644 src/main/resources/templates/approveRejectConcept.html create mode 100644 src/main/resources/templates/approveRejectDocument.html create mode 100644 src/main/resources/templates/approveRejectLesson.html create mode 100644 src/main/resources/templates/approveRejectPhet.html create mode 100644 src/main/resources/templates/approveRejectQuiz.html create mode 100644 src/main/resources/templates/approveRejectTeacher.html create mode 100644 src/main/resources/templates/approveRejectVideo.html create mode 100644 src/main/resources/templates/article.html create mode 100644 src/main/resources/templates/common/header.html create mode 100644 src/main/resources/templates/conceptMap.html create mode 100644 src/main/resources/templates/contentConceptMap.html create mode 100644 src/main/resources/templates/contentLessonPlan.html create mode 100644 src/main/resources/templates/contentLinks.html create mode 100644 src/main/resources/templates/contentPhet.html create mode 100644 src/main/resources/templates/contentQuiz.html create mode 100644 src/main/resources/templates/contentTutorial.html create mode 100644 src/main/resources/templates/contentView.html create mode 100644 src/main/resources/templates/document.html create mode 100644 src/main/resources/templates/error/404.html create mode 100644 src/main/resources/templates/error/405.html create mode 100644 src/main/resources/templates/events.html create mode 100644 src/main/resources/templates/forgetPassword.html create mode 100644 src/main/resources/templates/lessonPlan.html create mode 100644 src/main/resources/templates/logout.html create mode 100644 src/main/resources/templates/message.html create mode 100644 src/main/resources/templates/phets.html create mode 100644 src/main/resources/templates/quiz.html create mode 100644 src/main/resources/templates/resetPassword.html create mode 100644 src/main/resources/templates/testimonial.html create mode 100644 src/main/resources/templates/user.html create mode 100644 src/main/resources/templates/userList.html create mode 100644 src/main/resources/templates/video.html create mode 100644 src/test/java/com/adminportal/AdminPortalSchoolProjectApplicationTests.java create mode 100644 src/test/java/com/adminportal/service/ArticleExternalServiceTest.java create mode 100644 src/test/java/com/adminportal/service/ClassServiceTest.java create mode 100644 src/test/java/com/adminportal/service/CommentServiceTest.java create mode 100644 src/test/java/com/adminportal/service/ConceptMapServiceTest.java create mode 100644 src/test/java/com/adminportal/service/DocumentExternalServiceTest.java create mode 100644 src/test/java/com/adminportal/service/EventServiceTest.java create mode 100644 src/test/java/com/adminportal/service/LessonPlanServiceTest.java create mode 100644 src/test/java/com/adminportal/service/PhetServiceTest.java create mode 100644 src/test/java/com/adminportal/service/QuizQuestionServiceTest.java create mode 100644 src/test/java/com/adminportal/service/SubjectServiceTest.java create mode 100644 src/test/java/com/adminportal/service/TestimonialServiceTest.java create mode 100644 src/test/java/com/adminportal/service/TutorialServiceTest.java create mode 100644 src/test/java/com/adminportal/service/UserServiceTest.java create mode 100644 src/test/java/com/adminportal/service/VideoExternalServiceTest.java create mode 100644 src/test/java/com/adminportal/service/roleDetailServiceTest.java diff --git a/src/main/java/com/adminportal/AdminController.java b/src/main/java/com/adminportal/AdminController.java new file mode 100644 index 0000000..c3d6392 --- /dev/null +++ b/src/main/java/com/adminportal/AdminController.java @@ -0,0 +1,2719 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This Class is a Controller Class(All request related to admin task like adding resources into an App.) + * All Admin related Url for adding resources will get called into this layer. + * This can be considered as middleware ie, create a link among view and modal. + */ + + +package com.adminportal; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.Principal; +import java.security.Provider.Service; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.transaction.Transactional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.amqp.RabbitProperties.ContainerType; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpRequest; +import org.springframework.stereotype.Controller; +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.SessionAttributes; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; +import org.thymeleaf.context.IContext; + +import com.adminportal.content.ArticleExternal; + +import com.adminportal.content.Class; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.ContactForm; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.Events; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Testimonial; +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; +import com.adminportal.service.ArticleExternalService; + +import com.adminportal.service.ClassService; +import com.adminportal.service.ConceptMapService; +import com.adminportal.service.ContactFormService; +import com.adminportal.service.DocumentExternalService; +import com.adminportal.service.EventService; +import com.adminportal.service.LessonPlanService; +import com.adminportal.service.PhetsService; +import com.adminportal.service.QuizQuestionService; +import com.adminportal.service.RoleDetailService; +import com.adminportal.service.SubjectClassService; +import com.adminportal.service.SubjectService; +import com.adminportal.service.TestimonialService; +import com.adminportal.service.TopicService; +import com.adminportal.service.TutorialService; +import com.adminportal.service.UserService; +import com.adminportal.service.VideoExternalService; +import com.spoken.Utility.ServiceUtility; +import com.spoken.Utility.TutorialList; +import com.xuggle.xuggler.IContainer; + +/** + * This Controller class Takes care of all the operation done by admin User + * @author om prakash + * + */ +/* Annotation used to declare class to accept url passed from view */ +@Controller +public class AdminController { + + /** + * Path to store resources + */ + public static final String uploadDirectory="Media/content/"; /* path to which content will get stored */ + /** + * Path to store Event data + */ + public static final String uploadEvent="Media/Event/"; + /** + * size of Video file + */ + public static final long videoSize=50*1024*1024; // 50 MB vidoe File max + + /** + * SIze of normal file + */ + public static final long fileSize=10*1024*1024; // 10 MB max file max + /** + * Path to store Testimonial data + */ + public static final String uploadTestimonial="Media/Testimonial/"; + /** + * Duration of Video + */ + public static final long videoDuration=300000000L; + + @Autowired + private ClassService classService; + + @Autowired + private SubjectClassService subjectClassService; + + @Autowired + private SubjectService subjectService; + + @Autowired + private TopicService topicService; + + @Autowired + private UserService userService; + + @Autowired + private ArticleExternalService articleService; + + @Autowired + private DocumentExternalService documentService; + + @Autowired + private LessonPlanService lessonService; + + @Autowired + private PhetsService phetService; + + @Autowired + private QuizQuestionService quizService; + + @Autowired + private VideoExternalService videoService; + + @Autowired + private ConceptMapService conceptService; + + @Autowired + private TestimonialService testiService; + + @Autowired + private EventService eventService; + + @Autowired + private TutorialService tutorialService; + + @Autowired + private ContactFormService contactService; + + @Autowired + private Environment env; + + + /** + * Redirects to Admin Homepage where admin add various resources to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + /* url to redirect page to homepage of Admin Module */ + + @RequestMapping(value = "/admin/addView",method = RequestMethod.GET) + public ModelAndView adminHomeView(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("addView"); + + return mv; + } + + /** + * Redirects to Admin approve page where admin approve various resources + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve",method = RequestMethod.GET) + public ModelAndView adminHomeAprove(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("approveReject"); + + return mv; + } + + +/*------------------------------------------ADD CLASS (ADMIN MODULE)-----------------------------------------------------------------*/ + + // method to redirect addClass View + + /** + * redirects Admin to Add Class Page + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addClass", method = RequestMethod.GET) + public ModelAndView addClassget(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExist); + mv.setViewName("addClass"); + + return mv; + } + + + // method to add Class entry into database + + /** + * Add class name to the application based on received input parameter + * @param req HttpServletRequest object + * @param classSelected name of class in integer + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addClass", method = RequestMethod.POST) + public ModelAndView addClassPost(HttpServletRequest req,@RequestParam(name="classSelected") int classSelected ,Principal principal, ModelAndView mv) { + + boolean classExist=false; + ArrayList classTemp=(ArrayList) classService.findAll(); + for(Class classtemp1:classTemp) { + if(classSelected==classtemp1.getClassName()) { + classExist=true; + } + } + + if(!classExist) { + User usr=userService.findByUsername(principal.getName()); + + Class tempClass=new Class(); // creating object of class modal to add entry into database. + tempClass.setClass_id(classService.countRow()+1); + tempClass.setClassName(classSelected); + tempClass.setDateAdded(ServiceUtility.getCurrentTime()); + tempClass.setUser(usr); + userService.addUserToClass(usr, tempClass); // pushing data into database + mv.addObject("status", "Added Successfully"); + }else { + mv.addObject("dataAvailable", "Class already exists"); + } + + + + ArrayList classExistTemp=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExistTemp); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("addClass"); // returns to addClass View + + + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------ADD ARTICLE (ADMIN MODULE)-----------------------------------------------------------------*/ + + // method to redirect addArticle View + + /** + * redirects admin to add article page + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addArticle",method = RequestMethod.GET) + public ModelAndView addArtcileGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + mv.setViewName("addArticle"); // setting view name + + List articleListTemp=articleService.findAll(); + List articleList=new ArrayList(); + for(ArticleExternal temp:articleListTemp) { + if(temp.getAcceptedByAdmin()==1) { + articleList.add(temp); + } + } + + + mv.addObject("Article",articleList); + mv.addObject("viewActive","active"); + return mv; + } + + + // method to add Article entry into database + + /** + * Adds Article resource to app + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addArticle",method = RequestMethod.POST) + public ModelAndView addArtcilePost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String url=req.getParameter("url"); + String source=req.getParameter("source"); + + + if(!url.startsWith("http")) { // validation against proper Url given against artcile file. + + mv.addObject("fileError","Path specified isn't correct"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("addActive","active"); + + List articleListTemp=articleService.findAll(); + List articleList=new ArrayList(); + for(ArticleExternal temp:articleListTemp) { + if(temp.getAcceptedByAdmin()==1) { + articleList.add(temp); + } + } + + + mv.addObject("Article",articleList); + + mv.setViewName("addArticle"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + int articleId=articleService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); // fetching class tuple based on given data + Subject localSubject=subjectService.findBysubName(subjectName); // fetching Subject tuple based on given data + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); // fetching Subject Class mapping tuple based on class and subject + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); // fetching topic tuple based on given data subject class mapping. + + User usr=userService.findByUsername(principal.getName()); // logged in user details. + Set articlemapping=new HashSet(); + articlemapping.add(new ArticleExternal(articleId, "Article", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, url, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToArticle(usr, articlemapping); // saving the article information into database. + + mv.addObject("statusAdd", "Added Successfully"); // setting status for view(success) + + } catch (Exception e) { + + e.printStackTrace(); + ArticleExternal tempArticle=articleService.findByid(articleId); + articleService.deleteArticle(tempArticle); + mv.addObject("failure", "Please try Again Later"); // setting status for view(failure) + + } + + List articleListTemp=articleService.findAll(); + List articleList=new ArrayList(); + for(ArticleExternal temp:articleListTemp) { + if(temp.getAcceptedByAdmin()==1) { + articleList.add(temp); + } + } + + + mv.addObject("Article",articleList); + mv.addObject("addActive","active"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + + mv.setViewName("addArticle"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------ADD DOCUMENT (ADMIN MODULE)-----------------------------------------------------------------*/ + + // method to redirect addDocument View + + /** + * redirects admin to add Document resource in app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addDocument",method = RequestMethod.GET) + public ModelAndView addDocumentGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List documentListTemp=documentService.findAll(); + List documentList=new ArrayList(); + for(DocumentExternal temp:documentListTemp) { + if(temp.getAcceptedByAdmin()==1) { + documentList.add(temp); + } + } + + mv.addObject("Document",documentList); + + mv.setViewName("addDocument"); // setting view name + + mv.addObject("viewActive","active"); + return mv; + + } + + + /** + * Adds Document resource to app + * @param req HttpServletRequest object + * @param document File to be uploaded + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Document into database + @RequestMapping(value="/admin/addView/addDocument",method = RequestMethod.POST) + public ModelAndView addDocumentPost(HttpServletRequest req,@RequestParam(name="Question")MultipartFile[] document,Principal principal,ModelAndView mv) { + + String path1=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String source=req.getParameter("source"); + + if(!ServiceUtility.checkFileExtensionPDF(document) && !ServiceUtility.checkFileExtensionImage(document)) { // validation against PDF document + mv.addObject("fileError", "File must be a PDF or JPEG/JPG/PNG"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("addActive","active"); + + List documentListTemp=documentService.findAll(); + List documentList=new ArrayList(); + for(DocumentExternal temp:documentListTemp) { + if(temp.getAcceptedByAdmin()==1) { + documentList.add(temp); + } + } + + mv.addObject("Document",documentList); + + mv.setViewName("addDocument"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + if(document[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("addActive","active"); + + List documentListTemp=documentService.findAll(); + List documentList=new ArrayList(); + for(DocumentExternal temp:documentListTemp) { + if(temp.getAcceptedByAdmin()==1) { + documentList.add(temp); + } + } + + mv.addObject("Document",documentList); + + mv.setViewName("addDocument"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + } + int documentId=documentService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); // retrieving class modal + Subject localSubject=subjectService.findBysubName(subjectName); // retrieving subject modal + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); // retrieving subject class mapping from class and subject + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); // retrieving topic from sucject class mapping + + + User usr=userService.findByUsername(principal.getName()); // retrieving the logged USer + + Set documentMapping=new HashSet(); + documentMapping.add(new DocumentExternal(documentId, "Document", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, "null", 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToDocument(usr, documentMapping); // saving document data into database. + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Document/"+documentId+"/"; // PATH TO SAVE DOCUMENT UNDER TOPIC + + ServiceUtility.createFolder(createFolder); + + path1=ServiceUtility.uploadFile(document, createFolder); // upload file to path mentioned + + int indexToStart=path1.indexOf("Media"); // extracting path starting from MEDIA to save in database + String path=path1.substring(indexToStart, path1.length()); + + DocumentExternal docuTemp=documentService.findByid(documentId); + docuTemp.setUrl(path); + + documentService.save(docuTemp); + + mv.addObject("statusAdd", "Document Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + DocumentExternal documentTemp=documentService.findByid(documentId); + documentService.deleteDocuemnt(documentTemp); + mv.addObject("failure", "Please Try Again"); + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("addActive","active"); + + List documentListTemp=documentService.findAll(); + List documentList=new ArrayList(); + for(DocumentExternal temp:documentListTemp) { + if(temp.getAcceptedByAdmin()==1) { + documentList.add(temp); + } + } + + mv.addObject("Document",documentList); + + mv.setViewName("addDocument"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------ADD LESSON PLAN (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * redirects admin to add Lesson resource to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addLessonPlan View + @RequestMapping(value="/admin/addView/addLessonPlan",method = RequestMethod.GET) + public ModelAndView addLessonPlanGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List lessonListTemp=lessonService.findAll(); + List lessonList=new ArrayList(); + for(LessonPlan temp:lessonListTemp) { + if(temp.getAcceptedByAdmin()==1) { + lessonList.add(temp); + } + } + + mv.addObject("Lesson",lessonList); + + mv.setViewName("addLessonPlan"); // setting view name + + mv.addObject("viewActive","active"); + return mv; + + } + + /** + * adds Lesson resource to app + * @param req HttpServletRequest object + * @param lesson file to be added + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Lesson Plan into database + @RequestMapping(value="/admin/addView/addLessonPlan",method = RequestMethod.POST) + public ModelAndView addLessonPlanPost(HttpServletRequest req,@RequestParam(name="lesson") MultipartFile[] lesson,Principal principal,ModelAndView mv) { + + String path1=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + + if(!ServiceUtility.checkFileExtensionPDF(lesson)) { // validation against PDF document + + mv.addObject("fileError", "Please Select PDF file"); + + List lessonListTemp=lessonService.findAll(); + List lessonList=new ArrayList(); + for(LessonPlan temp:lessonListTemp) { + if(temp.getAcceptedByAdmin()==1) { + lessonList.add(temp); + } + } + + mv.addObject("Lesson",lessonList); + + mv.addObject("addActive","active"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("addLessonPlan"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + if(lesson[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB"); + + List lessonListTemp=lessonService.findAll(); + List lessonList=new ArrayList(); + for(LessonPlan temp:lessonListTemp) { + if(temp.getAcceptedByAdmin()==1) { + lessonList.add(temp); + } + } + + mv.addObject("Lesson",lessonList); + + mv.addObject("addActive","active"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("addLessonPlan"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + } + + int lessonId=lessonService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + + User usr=userService.findByUsername(principal.getName()); // retrive logged in user + + Set lessonMapping=new HashSet(); + lessonMapping.add(new LessonPlan(lessonId, "Lesson", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), "null", 0, 0,ServiceUtility.getCurrentTime(), localTopic, usr)); + + + userService.addUserToLessonplan(usr, lessonMapping); // saving lessonPaln data + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Lessonplan/"+lessonId+"/"; // path to store lesson Plan + + ServiceUtility.createFolder(createFolder); + + path1=ServiceUtility.uploadFile(lesson, createFolder); // uploading lesson plan to path given + + int indexToStart=path1.indexOf("Media"); // extract path starting from MEDIA to persist . + String path=path1.substring(indexToStart, path1.length()); + + LessonPlan lessonTemp=lessonService.findById(lessonId); + lessonTemp.setLessonPlan(path); + + lessonService.save(lessonTemp); + + mv.addObject("statusAdd", "Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + LessonPlan lessonTemp=lessonService.findById(lessonId); + lessonService.deleteLessonPlan(lessonTemp); + mv.addObject("failure", "Please Try Again"); + + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("lessonStatus", "Added Successfully"); + + List lessonListTemp=lessonService.findAll(); + List lessonList=new ArrayList(); + for(LessonPlan temp:lessonListTemp) { + if(temp.getAcceptedByAdmin()==1) { + lessonList.add(temp); + } + } + + mv.addObject("Lesson",lessonList); + + mv.addObject("addActive","active"); + + mv.setViewName("addLessonPlan"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + + return mv; + + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + + /*------------------------------------------ADD PHET (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * redirects admin to Add phet resource to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addPhets View + @RequestMapping(value="/admin/addView/addPhets",method = RequestMethod.GET) + public ModelAndView addPhetsGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List phetListTemp=phetService.findAll(); + List phetList=new ArrayList(); + for(Phets temp:phetListTemp) { + if(temp.getAcceptedByAdmin()==1) { + phetList.add(temp); + } + } + + mv.addObject("Phet",phetList); + + mv.setViewName("addPhets"); // setting view name + + mv.addObject("viewActive","active"); + return mv; + + } + + /** + * Add phet resource to app + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Phets into database + @RequestMapping(value="/admin/addView/addPhets",method = RequestMethod.POST) + public ModelAndView addPhetsPost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String phet=req.getParameter("phet"); + String source=req.getParameter("source"); + String phetPath=null; + + if(phet.length()>0) { // checking out whether phet link proper or not + + if(!phet.startsWith(" classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + List phetListTemp=phetService.findAll(); + List phetList=new ArrayList(); + for(Phets temp:phetListTemp) { + if(temp.getAcceptedByAdmin()==1) { + phetList.add(temp); + } + } + + mv.addObject("Phet",phetList); + + mv.addObject("fileError", "Please specify Embed Code"); + + mv.addObject("addActive","active"); + + mv.setViewName("addPhets"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + + } + + }else { + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("failure", "Please Try Again"); + + List phetListTemp=phetService.findAll(); + List phetList=new ArrayList(); + for(Phets temp:phetListTemp) { + if(temp.getAcceptedByAdmin()==1) { + phetList.add(temp); + } + } + + mv.addObject("Phet",phetList); + + mv.addObject("addActive","active"); + + mv.setViewName("addPhets"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + + } + int phetId=phetService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + User usr=userService.findByUsername(principal.getName()); // retrive Logged In User + + + Set phetMapping=new HashSet(); + phetMapping.add(new Phets(phetId, "Phets", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, phetPath, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + + userService.addUserToPhets(usr, phetMapping); // persist Phet data + mv.addObject("statusAdd", "Added Successfully"); + + + } catch (Exception e) { + + e.printStackTrace(); + Phets phetTemp=phetService.findByid(phetId); + phetService.deletePhet(phetTemp); + mv.addObject("failure", "Please Try Again"); + + + } + + + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("addActive","active"); + + List phetListTemp=phetService.findAll(); + List phetList=new ArrayList(); + for(Phets temp:phetListTemp) { + if(temp.getAcceptedByAdmin()==1) { + phetList.add(temp); + } + } + + mv.addObject("Phet",phetList); + + mv.setViewName("addPhets"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + + + /*------------------------------------------ADD TOPIC (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * add topic to app + * @param poster file to be added + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + * @throws Exception + */ + // method to add Topic into database + @Transactional + @RequestMapping(value="/admin/addView/addTopic",method=RequestMethod.POST) + public ModelAndView addTopicPost(@RequestParam("posterQ") MultipartFile[] poster,HttpServletRequest req,ModelAndView mv,Principal principal) throws Exception { + + String path1=null; + String uploadDirectoryPoster=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topic"); + String topicDesc=req.getParameter("descriptionQ"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + User usr=userService.findByUsername(principal.getName()); + + System.out.println(poster); + Subject localSubjectTemp=subjectService.findBySubjectName(subjectName); + + + if(!ServiceUtility.checkFileExtensionImage(poster)) { // validating Image file of given data + + mv.addObject("fileError", "Invalid File Extension"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + mv.setViewName("addTopic"); + List topicList=topicService.findAll(); + mv.addObject("Topic", topicList); + mv.addObject("addActive","active"); + return mv; + + + } + + if(poster[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB "); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + mv.setViewName("addTopic"); + List topicList=topicService.findAll(); + mv.addObject("Topic", topicList); + mv.addObject("addActive","active"); + return mv; + + } + + int newTopicId=topicService.countRow()+1; + try { + + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + SubjectClassMapping localsubjectClassMapping=subjectClassService.findBysubAndstandard(localClass,localSubjectTemp); + + System.out.println(localsubjectClassMapping.getSubClassId()); + + Topic addTopic=new Topic(); + addTopic.setTopicId(newTopicId); + addTopic.setPoster("null"); + addTopic.setTopicName(topicName); + addTopic.setDescription(topicDesc); + addTopic.setDateAdded(ServiceUtility.getCurrentTime()); + addTopic.setDateModified(ServiceUtility.getCurrentTime()); + addTopic.setSubjectClassMapping(localsubjectClassMapping); + addTopic.setStatus(1); + addTopic.setUserId(usr); + + subjectClassService.createTopic(addTopic, localsubjectClassMapping); + + + boolean b=ServiceUtility.createclassSubjectFolder(className, Integer.toString(localSubjectTemp.getSubId()),Integer.toString(newTopicId)) ; + + + uploadDirectoryPoster=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubjectTemp.getSubId()+"/"+newTopicId+"/"; // path to upload Quiz File + System.out.println(uploadDirectoryPoster); + + path1=ServiceUtility.uploadFile(poster, uploadDirectoryPoster); + + + int indexToStart=path1.indexOf("Media"); // extract path starting from MEDIA to persist . + String path=path1.substring(indexToStart, path1.length()); + + if(!topicService.updateTopicPoster(path, newTopicId)){ + throw new Exception(); + } + + + mv.addObject("statusAdd", "Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + + Topic topicTemp=topicService.findById(newTopicId); + topicService.deleteTopic(topicTemp); + + mv.addObject("failure", "Please Try Again"); + } + + + List topicList=topicService.findAll(); + + mv.addObject("Topic", topicList); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("addTopic"); + mv.addObject("addActive","active"); + return mv; + } + + /** + * redirects admin to add Topic to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // redirect to addTopic View + @RequestMapping(value="/admin/addView/addTopic",method=RequestMethod.GET) + public ModelAndView addTopicGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + mv.setViewName("addTopic"); // setting view name + List topicList=topicService.findAll(); + + mv.addObject("Topic", topicList); + mv.addObject("viewActive","active"); + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + + /*------------------------------------------ADD SUBJECT (ADMIN MODULE)-----------------------------------------------------------------*/ + + + /** + * redirects admin to add subject to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addSubject View + @RequestMapping(value="/admin/addView/addSubject", method=RequestMethod.GET) + public ModelAndView addSubjectGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + Map> SubjectEntry=new HashMap>(); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExist); + + mv.setViewName("addSubject"); // setting view name + + List subjectList=subjectService.findAll(); + + for(Subject temp:subjectList) { + List classWithSubject=new ArrayList<>(); + for(SubjectClassMapping temp1:temp.getSubClasMapp()) { + classWithSubject.add(temp1.getStandard().getClassName()); + } + Collections.sort(classWithSubject); + + SubjectEntry.put(temp, classWithSubject); + + } + + TreeMap> sortedSubjectEntry = new TreeMap<>(); + sortedSubjectEntry.putAll(SubjectEntry); + + mv.addObject("Subject", sortedSubjectEntry); + + mv.addObject("viewActive","active"); + return mv; + } + + + /** + * add subject to app + * @param req HttpServletRequest object + * @param selectedSubject subject name + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Subject into database + @RequestMapping(value="/admin/addView/addSubject", method=RequestMethod.POST) + public ModelAndView addSubjectPost(HttpServletRequest req,@RequestParam(name="SelectedSubject") String selectedSubject,Principal principal,ModelAndView mv) { + + int i=0; + boolean subjectExist=false; + Map> SubjectEntry=new HashMap>(); + + User localUser=userService.findByUsername(principal.getName()); + mv.addObject("LoggedUser",localUser); + + if(!ServiceUtility.checkContainNumeralInString(selectedSubject)) { + mv.addObject("statusError", "Please Enter only Charcter value"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExist); // setting variable for view for displaying purpose + mv.addObject("addActive","active"); + + List subjectList=subjectService.findAll(); + for(Subject temp:subjectList) { + List classWithSubject=new ArrayList<>(); + for(SubjectClassMapping temp1:temp.getSubClasMapp()) { + classWithSubject.add(temp1.getStandard().getClassName()); + } + Collections.sort(classWithSubject); + + SubjectEntry.put(temp, classWithSubject); + } + TreeMap> sortedSubjectEntry = new TreeMap<>(); + sortedSubjectEntry.putAll(SubjectEntry); + + mv.addObject("Subject", sortedSubjectEntry); + + + mv.setViewName("addSubject"); // setting view name + return mv; + + } + ArrayList subject=(ArrayList) subjectService.findAll(); + for(Subject temp:subject) { + if(selectedSubject.equalsIgnoreCase(temp.getSubName())) { + subjectExist=true; + } + } + String[] selectedClasses=req.getParameterValues("SelectedClasses"); + if(!subjectExist) { + + User usr=userService.findByUsername(principal.getName()); + + Subject addsubject=new Subject(); + addsubject.setSubId(subjectService.countRow()+1); + addsubject.setSubName(selectedSubject); + addsubject.setDateAdded(ServiceUtility.getCurrentTime()); + addsubject.setUser(usr); + + userService.adduserToSubject(usr, addsubject); + + + try { + Set subjectClassMapping=new HashSet(); + + for(String classes:selectedClasses) { + System.out.println(classes); + Class localClass=classService.findByClassName(Integer.parseInt(classes)); + subjectClassMapping.add(new SubjectClassMapping(subjectClassService.countRow()+i++,localClass,addsubject)); + } + + + subjectClassService.createSubjectClass(addsubject, subjectClassMapping); + + mv.addObject("statusAdd", "Added Successfully"); + } catch (Exception e) { + + subjectService.save(addsubject); + mv.addObject("statusAdd", "Added Successfully"); + } + + + + }else { + + mv.addObject("statusError", "Subject already exists"); + } + + + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExist); // setting variable for view for displaying purpose + mv.addObject("addActive","active"); + + List subjectList=subjectService.findAll(); + for(Subject temp:subjectList) { + List classWithSubject=new ArrayList<>(); + for(SubjectClassMapping temp1:temp.getSubClasMapp()) { + classWithSubject.add(temp1.getStandard().getClassName()); + } + Collections.sort(classWithSubject); + + SubjectEntry.put(temp, classWithSubject); + } + TreeMap> sortedSubjectEntry = new TreeMap<>(); + sortedSubjectEntry.putAll(SubjectEntry); + + mv.addObject("Subject", sortedSubjectEntry); + + + mv.setViewName("addSubject"); // setting view name + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------ADD VIDEO (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * redirects admin to add video resource page + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addVideo View + @RequestMapping(value="/admin/addView/addVideo",method = RequestMethod.GET) + public ModelAndView addVideoGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + mv.setViewName("addVideo"); // setting view name + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + mv.addObject("Video",videoList); + + mv.addObject("viewActive","active"); + return mv; + + } + + /** + * add video resource to app (iframe data) + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Video into database + @RequestMapping(value="/admin/addView/addVideo",method = RequestMethod.POST) + public ModelAndView addVideoGetPost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String url=req.getParameter("url"); + String source=req.getParameter("source"); + String videourl=null; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(url.length()>0) { // check for proper Video Url + + if(!url.startsWith(" classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + mv.addObject("addActive","active"); + + mv.setViewName("addVideo"); + + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + + + + mv.addObject("Video",videoList); + + return mv; + + + + } + + }else { + + } + int videoId=videoService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + User usr=userService.findByUsername(principal.getName()); + + Set videoMapping=new HashSet(); + videoMapping.add(new VideoExternal(videoId, "Video", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, videourl, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToVideo(usr, videoMapping); // persist Video Information + mv.addObject("statusAdd", "Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + + VideoExternal videoTemp=videoService.findById(videoId); + videoService.deleteVideo(videoTemp); + mv.addObject("failure", "Please Try Again Later"); + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + + mv.addObject("Video",videoList); + mv.addObject("addActive","active"); + + mv.setViewName("addVideo"); // setting view name + + + + return mv; + + } + + + /** + * add Video resource to app + * @param video video file to be added + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addVideoUpload",method = RequestMethod.POST) + public ModelAndView addVideoUploadPost(@RequestParam(name="videoUpload") MultipartFile video,HttpServletRequest req,Principal principal,ModelAndView mv) { + + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String source=req.getParameter("source"); + String videourl=null; + String path1=null; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(!ServiceUtility.checkFileExtensionVideo(video)) { + + mv.addObject("failure", "Please upload mp4 or mov file"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + + mv.addObject("Video",videoList); + mv.addObject("addActive","active"); + + mv.setViewName("addVideo"); // setting view name + + + + return mv; + + } + + + if(video.getSize()>videoSize) { + + mv.addObject("failure", "Please upload file size within 50MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + + mv.addObject("Video",videoList); + mv.addObject("addActive","active"); + + mv.setViewName("addVideo"); // setting view name + + + + return mv; + + } + int videoId=videoService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + User usr=userService.findByUsername(principal.getName()); + + Set videoMapping=new HashSet(); + videoMapping.add(new VideoExternal(videoId, "Video", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, "null", 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToVideo(usr, videoMapping); // persist Video Information + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Video/"+videoId+"/"; // path to save video + + boolean ques=ServiceUtility.createFolder(createFolder); + + if(ques) { + + path1=ServiceUtility.uploadVideoFile(video, createFolder); + + int indexToStart=path1.indexOf("Media"); // extracting proper Path from Actual path + String path=path1.substring(indexToStart, path1.length()); + + VideoExternal videoTemp=videoService.findById(videoId); + videoTemp.setUrl(path); + videoService.save(videoTemp); + + mv.addObject("statusAdd", "Added Successfully"); + }else { + VideoExternal videoTemp=videoService.findById(videoId); + videoService.deleteVideo(videoTemp); + mv.addObject("failure", "Please Try Again Later"); + } + + } catch (Exception e) { + + e.printStackTrace(); + VideoExternal videoTemp=videoService.findById(videoId); + videoService.deleteVideo(videoTemp); + mv.addObject("failure", "Please Try Again Later"); + } + + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + + mv.addObject("Video",videoList); + mv.addObject("addActive","active"); + + mv.setViewName("addVideo"); // setting view name + + + + return mv; + + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------ADD QUIZ (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * redirects admin to add quiz page + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addQuiz View + @RequestMapping(value="/admin/addView/addQuiz",method = RequestMethod.GET) + public ModelAndView addQuizGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + mv.setViewName("addQuiz"); // setting view name + List quizListTemp=quizService.findAll(); + List quizList=new ArrayList(); + for(QuizQuestion temp:quizListTemp) { + if(temp.getAcceptedByAdmin()==1) { + quizList.add(temp); + } + } + + mv.addObject("Quiz",quizList ); + + mv.addObject("viewActive","active"); + return mv; + + + } + + /** + * add Quiz data to app + * @param req HttpServletRequest object + * @param question question file to be added + * @param answer answer file to be added + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Quiz into database + @RequestMapping(value="/admin/addView/addQuiz",method = RequestMethod.POST) + public ModelAndView addQuizPost(HttpServletRequest req,@RequestParam(name="Question")MultipartFile[] question,Principal principal,@RequestParam(name="Answer")MultipartFile[] answer,ModelAndView mv) { + + String questionPath=null; + String answerPath=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String remarks=req.getParameter("remarks"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + + if(!ServiceUtility.checkFileExtensionPDF(question)) { // check for PDF file + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "Please Add only Pdf File"); + + mv.setViewName("addQuiz"); + mv.addObject("addActive","active"); + + List quizListTemp=quizService.findAll(); + List quizList=new ArrayList(); + for(QuizQuestion temp:quizListTemp) { + if(temp.getAcceptedByAdmin()==1) { + quizList.add(temp); + } + } + + mv.addObject("Quiz",quizList ); + + return mv; + + + + } + + if(!ServiceUtility.checkFileExtensionPDF(answer)) { // check for PDF file + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "Please Add only Pdf File"); + + mv.setViewName("addQuiz"); + mv.addObject("addActive","active"); + + + List quizListTemp=quizService.findAll(); + List quizList=new ArrayList(); + for(QuizQuestion temp:quizListTemp) { + if(temp.getAcceptedByAdmin()==1) { + quizList.add(temp); + } + } + + mv.addObject("Quiz",quizList ); + + return mv; + + + } + + if(question[0].getSize()>fileSize || answer[0].getSize()>fileSize) { + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "FileSize must be within 10MB"); + + mv.setViewName("addQuiz"); + mv.addObject("addActive","active"); + + + List quizListTemp=quizService.findAll(); + List quizList=new ArrayList(); + for(QuizQuestion temp:quizListTemp) { + if(temp.getAcceptedByAdmin()==1) { + quizList.add(temp); + } + } + + mv.addObject("Quiz",quizList ); + + return mv; + } + int quizId=quizService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + User usr=userService.findByUsername(principal.getName()); + + Set quizMapping=new HashSet(); + quizMapping.add(new QuizQuestion(quizId,"Quiz",ServiceUtility.getCurrentTime(),ServiceUtility.getCurrentTime(),"null","null",0,0,remarks,ServiceUtility.getCurrentTime(),localTopic,usr)); + + userService.addUserToQuizQuestion(usr, quizMapping); // persist Quiz details + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Quiz/"+quizId+"/"; // path to save question and answer + boolean b=ServiceUtility.createFolder(createFolder); + + String CreateFolderQuestion=createFolder+"Question/"; + String CreateFolderAnswer=createFolder+"Answer/"; + + boolean ques=ServiceUtility.createFolder(CreateFolderQuestion); + boolean ans=ServiceUtility.createFolder(CreateFolderAnswer); + + + if(ques && ans) { + + questionPath=ServiceUtility.uploadFile(question, CreateFolderQuestion); + answerPath=ServiceUtility.uploadFile(answer, CreateFolderAnswer); + + + int indexToStart=questionPath.indexOf("Media"); + String pathQuestion=questionPath.substring(indexToStart, questionPath.length()); + + int indexToStart1=answerPath.indexOf("Media"); + String pathAnswer=answerPath.substring(indexToStart1, answerPath.length()); + + QuizQuestion quizTemp=quizService.findById(quizId); + quizTemp.setAnswer(pathAnswer); + quizTemp.setQuestion(pathQuestion); + + quizService.save(quizTemp); + + + + mv.addObject("statusAdd", "Added Successfully"); + + }else { + + QuizQuestion quizTemp=quizService.findById(quizId); + quizService.deleteQuiz(quizTemp); + mv.addObject("failure", " Try again Later"); + } + } catch (Exception e) { + + e.printStackTrace(); + QuizQuestion quizTemp=quizService.findById(quizId); + quizService.deleteQuiz(quizTemp); + + mv.addObject("failure", " Try again Later"); + + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("quizStatus", "Added Successfully"); + mv.addObject("addActive","active"); + + List quizListTemp=quizService.findAll(); + List quizList=new ArrayList(); + for(QuizQuestion temp:quizListTemp) { + if(temp.getAcceptedByAdmin()==1) { + quizList.add(temp); + } + } + + mv.addObject("Quiz",quizList ); + + mv.setViewName("addQuiz"); // setting view name + + + return mv; + + + } + /**********************************************************************************************/ + + /** + * redirects admin to add ConceptMap page + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addConcept-map View + @RequestMapping(value = "/admin/addView/addConceptMap",method = RequestMethod.GET) + public ModelAndView addConceptMapGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List ConceptMapListTemp=conceptService.findAll(); + List ConceptMapList=new ArrayList(); + for(ConceptMap temp:ConceptMapListTemp) { + if(temp.getAcceptedByAdmin()==1) { + ConceptMapList.add(temp); + } + } + + mv.addObject("ConceptMapList",ConceptMapList ); + mv.addObject("viewActive","active"); + mv.setViewName("addConcpetMap"); // setting view name + + return mv; + } + + /** + * add conceptMap data to app + * @param req HttpServletRequest object + * @param conceptMapImage file to be added + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Concept -MAp into database + @RequestMapping(value = "/admin/addView/addConceptMap",method = RequestMethod.POST) + public ModelAndView addConceptMapPost(HttpServletRequest req,Principal principal,@RequestParam(name="conceptMapImage")MultipartFile[] conceptMapImage,ModelAndView mv) { + + String path1=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("descriptionConceptMap"); + String remark=req.getParameter("headlineConceptMap"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(!ServiceUtility.checkFileExtensionImage(conceptMapImage) && !ServiceUtility.checkFileExtensionZip(conceptMapImage)) { // check Image file + mv.addObject("fileError", "File must be a Image File or Zip File"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + List ConceptMapListTemp=conceptService.findAll(); + List ConceptMapList=new ArrayList(); + for(ConceptMap temp:ConceptMapListTemp) { + if(temp.getAcceptedByAdmin()==1) { + ConceptMapList.add(temp); + } + } + + mv.addObject("ConceptMapList",ConceptMapList ); + + mv.addObject("addActive","active"); + + mv.setViewName("addConcpetMap"); + + return mv; + + } + + if(conceptMapImage[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + List ConceptMapListTemp=conceptService.findAll(); + List ConceptMapList=new ArrayList(); + for(ConceptMap temp:ConceptMapListTemp) { + if(temp.getAcceptedByAdmin()==1) { + ConceptMapList.add(temp); + } + } + + mv.addObject("ConceptMapList",ConceptMapList ); + + mv.addObject("addActive","active"); + + mv.setViewName("addConcpetMap"); + + return mv; + } + + int conceptID=conceptService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + User usr=userService.findByUsername(principal.getName()); + + Set conceptMapping=new HashSet(); + conceptMapping.add(new ConceptMap(conceptID, "ConceptMap", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), "null", desc, 0,0, remark, localTopic, usr)); + + userService.addUserToConceptMap(usr, conceptMapping); // persist Concept-map + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/ConceptMap/"+conceptID+"/"; // path to store Concept-map + + ServiceUtility.createFolder(createFolder); + + if(ServiceUtility.checkFileExtensionImage(conceptMapImage)) { + path1=ServiceUtility.uploadFile(conceptMapImage, createFolder); + }else { + path1=ServiceUtility.uploadZipFile(conceptMapImage, createFolder); + } + + int indexToStart=path1.indexOf("Media"); // extracting proper Path from Actual path + String path=path1.substring(indexToStart, path1.length()); + + ConceptMap concepTemp=conceptService.findByid(conceptID); + concepTemp.setUrl(path); + + conceptService.save(concepTemp); + + + mv.addObject("statusAdd", "Concept-Map Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + ConceptMap conceptTemp=conceptService.findByid(conceptID); + conceptService.deleteConceptMap(conceptTemp); + mv.addObject("failure", "Please Try Again"); + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + List ConceptMapListTemp=conceptService.findAll(); + List ConceptMapList=new ArrayList(); + for(ConceptMap temp:ConceptMapListTemp) { + if(temp.getAcceptedByAdmin()==1) { + ConceptMapList.add(temp); + } + } + + mv.addObject("ConceptMapList",ConceptMapList ); + + mv.addObject("addActive","active"); + + mv.setViewName("addConcpetMap"); // setting view name + + + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + /**************************************** ADDING TUTORIAL ********************************************************************************/ + // method to redirect addTutorial View + + /** + * redirects admin to add tutorial data to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/addTutorial",method = RequestMethod.GET) + public ModelAndView addTutorialGet(Principal principal,ModelAndView mv) { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + mv.addObject("viewActive","active"); + + List tempTutorial=tutorialService.getAllTutorial(); + + List tutorialListData=new ArrayList(); + + + for(Tutorial localTemp:tempTutorial) { + + try { + String url="https://spoken-tutorial.org/api/get_tutorialdetails/"+localTemp.getStVideoId()+"/"; + RestTemplate restTemp=new RestTemplate(); + TutorialList localTutorial=restTemp.getForObject(url, TutorialList.class); + + localTutorial.setTutorialId(localTemp.getTutorialId()); + localTutorial.setTopicNAme(localTemp.getTopic().getTopicName()); + localTutorial.setContributedBy(localTemp.getUser().getFname()); + localTutorial.setStatus(localTemp.getStatus()); + System.out.println(localTutorial.getOutline()); + + tutorialListData.add(localTutorial); + } catch (RestClientException e) { + + e.printStackTrace(); + } + } + + + + mv.addObject("Tutorials", tutorialListData); + + + mv.setViewName("addTutorial"); // setting view name + return mv; + + } + + /** + * add Tutorial data to add (Spoken tutorial content) + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Tutorial into database + @RequestMapping(value = "/admin/addView/addTutorial",method = RequestMethod.POST) + public ModelAndView addTutorialPost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String [] tutorialList=req.getParameterValues("fossTutorialSelected"); + int fossid=Integer.parseInt(req.getParameter("fossSelected")); + int stLanguageId=Integer.parseInt(req.getParameter("fossLanguageSelected")); + + User usr=userService.findByUsername(principal.getName()); + + try { + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + Set tempTutorial=new HashSet(); + int tutorialCount=tutorialService.countRow(); + tutorialCount++; + + for(int i=0;i classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("addActive","active"); + + List tempTutorialLocal=tutorialService.getAllTutorial(); + + List tutorialListData=new ArrayList(); + + + for(Tutorial localTemp:tempTutorialLocal) { + + try { + String url="https://spoken-tutorial.org/api/get_tutorialdetails/"+localTemp.getStVideoId()+"/"; + RestTemplate restTemp=new RestTemplate(); + TutorialList localTutorial=restTemp.getForObject(url, TutorialList.class); + + localTutorial.setTutorialId(localTemp.getTutorialId()); + localTutorial.setTopicNAme(localTemp.getTopic().getTopicName()); + localTutorial.setContributedBy(localTemp.getUser().getFname()); + localTutorial.setStatus(localTemp.getStatus()); + System.out.println(localTutorial.getOutline()); + + tutorialListData.add(localTutorial); + } catch (RestClientException e) { + + e.printStackTrace(); + } + } + + + + mv.addObject("Tutorials", tutorialListData); + + mv.setViewName("addTutorial"); // setting view name + + return mv; + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("addActive","active"); + + List tempTutorialLocal=tutorialService.getAllTutorial(); + + List tutorialListData=new ArrayList(); + + + for(Tutorial localTemp:tempTutorialLocal) { + + try { + String url="https://spoken-tutorial.org/api/get_tutorialdetails/"+localTemp.getStVideoId()+"/"; + RestTemplate restTemp=new RestTemplate(); + TutorialList localTutorial=restTemp.getForObject(url, TutorialList.class); + + localTutorial.setTutorialId(localTemp.getTutorialId()); + localTutorial.setTopicNAme(localTemp.getTopic().getTopicName()); + localTutorial.setContributedBy(localTemp.getUser().getFname()); + localTutorial.setStatus(localTemp.getStatus()); + System.out.println(localTutorial.getOutline()); + + tutorialListData.add(localTutorial); + } catch (RestClientException e) { + + e.printStackTrace(); + } + } + + + + mv.addObject("Tutorials", tutorialListData); + + mv.setViewName("addTutorial"); // setting view name + + return mv; + } + + + + + /*******************************************************************************************************************************************/ + + /** + * redirect admin to add testimonial page + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addTestimonial View + @RequestMapping(value = "/admin/addView/addTestimonial",method = RequestMethod.GET) + public ModelAndView addTestimonialGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + mv.addObject("viewActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); // setting view name + + + return mv; + + + } + + /** + * Add Testimonial data to app + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Testimonial into database + @RequestMapping(value = "/admin/addView/addTestimonial",method = RequestMethod.POST) + public ModelAndView addTestimonialPost(HttpServletRequest req,ModelAndView mv,Principal principal) { + + + String name=req.getParameter("Name"); // taking out various information given by user in view. + String organization=req.getParameter("org"); + String Desc=req.getParameter("description"); + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + int testId=testiService.getCount(); + + try { + Testimonial addtestData=new Testimonial(); + addtestData.setTestimonialId(testId); + addtestData.setDateAdded(ServiceUtility.getCurrentTime()); + addtestData.setName(name); + addtestData.setDescription(Desc); + addtestData.setOrganization(organization); + + testiService.save(addtestData); + mv.addObject("returnStatus", "Data Added Successfully"); + mv.addObject("addActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); // setting view name + } catch (Exception e) { + + Testimonial temp=testiService.getbyId(testId); + testiService.deleteTestimonail(temp); + + mv.addObject("returnStatus", "Please Try Again"); + mv.addObject("addActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + e.printStackTrace(); + } + + + return mv; + + } + + /** + * Add video file to app + * @param video Video file to be added + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + * @throws Exception + */ + @RequestMapping(value = "/admin/addView/addVideoTestimonial",method = RequestMethod.POST) + public ModelAndView addVideoTestimonialPost(@RequestParam(name="videoTesti") MultipartFile video ,HttpServletRequest req,ModelAndView mv,Principal principal) throws Exception { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + int testiId=testiService.getCount(); + + if(!ServiceUtility.checkFileExtensionVideo(video)) { + + if(ServiceUtility.checkFileExtensiononeFilePDF(video)) { + + + Testimonial addtestData=new Testimonial(); + addtestData.setTestimonialId(testiId); + addtestData.setDateAdded(ServiceUtility.getCurrentTime()); + addtestData.setName(req.getParameter("Name")); + addtestData.setDescription(req.getParameter("description")); + addtestData.setOrganization(req.getParameter("org")); + + testiService.save(addtestData); + + ServiceUtility.createFolder(env.getProperty("spring.applicationexternalPath.name")+uploadTestimonial+"/"+testiId); + + String pathtoUploadTestData=env.getProperty("spring.applicationexternalPath.name")+uploadTestimonial+"/"+testiId; + + String documentLocal=ServiceUtility.uploadVideoFile(video, pathtoUploadTestData); + + int indexToStart=documentLocal.indexOf("Media"); + + String document=documentLocal.substring(indexToStart, documentLocal.length()); + + Testimonial localTest=testiService.getbyId(testiId); + localTest.setFilePath(document); + + testiService.save(localTest); + + mv.addObject("returnStatus", "Testimonial added Successfully"); + mv.addObject("addVideoActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + return mv; + + + }else { + + Testimonial temp=testiService.getbyId(testiId); + testiService.deleteTestimonail(temp); + mv.addObject("returnStatus", "Video format not Supported (only MP4 and MOV)"); + mv.addObject("addVideoActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + return mv; + } + + } + + if(video.getSize()>videoSize) { + + mv.addObject("returnStatus", "Video size must be less than 50MB"); + mv.addObject("addVideoActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + return mv; + } + + String pathSampleVideo=ServiceUtility.uploadVideoFile(video, env.getProperty("spring.applicationexternalPath.name")+uploadTestimonial); + + IContainer container = IContainer.make(); + int result=10; + result = container.open(pathSampleVideo,IContainer.Type.READ,null); + + if(result<0) { + + mv.addObject("returnStatus", "Please Try again"); + mv.addObject("addVideoActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + return mv; + + }else { + + int testiIDVideo=testiService.getCount(); + if(container.getDuration()>videoDuration) { + + mv.addObject("returnStatus", "duration of file must be 5 minutes or less"); + mv.addObject("addVideoActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + return mv; + }else { + + Path deletePreviousPath=Paths.get(pathSampleVideo); + Files.delete(deletePreviousPath); + + + try { + Testimonial addtestData=new Testimonial(); + addtestData.setTestimonialId(testiId); + addtestData.setDateAdded(ServiceUtility.getCurrentTime()); + addtestData.setName(req.getParameter("Name")); + addtestData.setDescription(req.getParameter("description")); + addtestData.setOrganization(req.getParameter("org")); + + testiService.save(addtestData); + + ServiceUtility.createFolder(env.getProperty("spring.applicationexternalPath.name")+uploadTestimonial+"/"+testiIDVideo); + + String pathtoUploadTestData=env.getProperty("spring.applicationexternalPath.name")+uploadTestimonial+"/"+testiIDVideo; + + String documentLocal=ServiceUtility.uploadVideoFile(video, pathtoUploadTestData); + + int indexToStart=documentLocal.indexOf("Media"); + + String document=documentLocal.substring(indexToStart, documentLocal.length()); + + Testimonial localTest=testiService.getbyId(testiId); + localTest.setVideoPath(document); + + testiService.save(localTest); + + mv.addObject("returnStatus", "Testimonial added Successfully"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + Testimonial temp=testiService.getbyId(testiIDVideo); + testiService.deleteTestimonail(temp); + mv.addObject("returnStatus", "Please Try Again"); + } + + mv.addObject("addVideoActive","active"); + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + mv.setViewName("addTestimonial"); + return mv; + + } + + } + + + + } + + + + /** + * redirects admin to add Event data to app + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to redirect addEvent View + @RequestMapping(value = "/admin/addView/addEvent",method = RequestMethod.GET) + public ModelAndView addEventGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("viewActive","active"); + mv.setViewName("addEvent"); // setting view name + + return mv; + + } + + /** + * add Event data to app + * @param poster file to be added + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add event into database + @RequestMapping(value = "/admin/addView/addEvent",method = RequestMethod.POST) + public ModelAndView addEventPost(@RequestParam("poster") MultipartFile[] poster,HttpServletRequest req,ModelAndView mv,Principal principal) { + + String headline=req.getParameter("headline"); // taking out various information given by user in view. + String Desc=req.getParameter("description"); + String location=req.getParameter("location"); + String mode=req.getParameter("modeEvent"); + String modeOfEvent; + String coordName=req.getParameter("cordinatorName"); + int eventIdNew=-1; + + + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(!ServiceUtility.checkFileExtensionImage(poster)) { // validating Image file of given data + + mv.addObject("returnStatus", "Please upload only Images"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + if(poster[0].getSize()>fileSize) { + + mv.addObject("returnStatus", "FileSize must be within 10MB"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + if(mode.equals("1")) { + modeOfEvent="Remote"; + }else if(mode.equals("2")){ + modeOfEvent="Virtual"; + }else { + + mv.addObject("returnStatus", "Please Try Again"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + } + + try { + String date=req.getParameter("startDate"); + SimpleDateFormat sd1=new SimpleDateFormat("yyyy-MM-dd"); + java.util.Date dateUtil=sd1.parse(date); + Date dateOfEventStart=new Date(dateUtil.getTime()); + + String datetemp1=req.getParameter("endDate"); + dateUtil=sd1.parse(datetemp1); + Date dateOfEventend=new Date(dateUtil.getTime()); + + String datetemp2=req.getParameter("RegStartDate"); + dateUtil=sd1.parse(datetemp2); + Date registStart=new Date(dateUtil.getTime()); + + + String datetemp3=req.getParameter("RegEndDate"); + dateUtil=sd1.parse(datetemp3); + Date registEnd=new Date(dateUtil.getTime()); + + + if(dateOfEventStart.before(ServiceUtility.getCurrentTime())) { + mv.addObject("returnStatus", "Date of Event Must be Future Date"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + if(dateOfEventend.before(dateOfEventStart)) { + mv.addObject("returnStatus", "End Date of Event Must be After Start Date"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + if(registStart.before(ServiceUtility.getCurrentTime()) ) { + mv.addObject("returnStatus", "Regsitration Date of Event Must be Future Date"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + if(registStart.after(dateOfEventStart) || registEnd.after(dateOfEventStart) ) { + mv.addObject("returnStatus", "Regsitration Date of Event Must be Earlier Date"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + if(registEnd.before(registStart) ) { + mv.addObject("returnStatus", "Regsitration End Date of Event Must be Future Date"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); + return mv; + + } + + int eventId=eventService.getCount(); + eventIdNew=eventId; + Events addEvent=new Events(); + addEvent.setEventId(eventId); + addEvent.setDateAdded(ServiceUtility.getCurrentTime()); + addEvent.setDescription(Desc); + addEvent.setHeadline(headline); + addEvent.setDateToHappenStart(dateOfEventStart); + addEvent.setDateToHappenEnd(dateOfEventend); + addEvent.setRegistStart(registStart); + addEvent.setRegistEnd(registEnd); + addEvent.setCoordName(coordName); + addEvent.setLocation(location); + addEvent.setMode(modeOfEvent); + addEvent.setPotser_path("null"); + + eventService.save(addEvent); + + boolean path_creation=ServiceUtility.createFolder(env.getProperty("spring.applicationexternalPath.name")+uploadEvent+"/"+eventId); + + + String pathtoUploadEventData=env.getProperty("spring.applicationexternalPath.name")+uploadEvent+"/"+eventId; + + String documentLocal=ServiceUtility.uploadFile(poster, pathtoUploadEventData); + + int indexToStart=documentLocal.indexOf("Media"); + + String document=documentLocal.substring(indexToStart, documentLocal.length()); + + Events localEvent=eventService.getbyid(eventId); + localEvent.setPotser_path(document); + + eventService.save(localEvent); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + + mv.addObject("returnStatus", "Data Added Successfully"); + mv.setViewName("addEvent"); // setting view name + } catch (Exception e) { + + if(eventIdNew!=-1) { + Events eventTemp=eventService.getbyid(eventIdNew); + eventService.deleteEvent(eventTemp); + } + + + mv.addObject("returnStatus", "Please Try Again"); + + List local=eventService.findAll(); + mv.addObject("Events", local); + mv.addObject("addActive","active"); + mv.setViewName("addEvent"); // setting view name + e.printStackTrace(); + } + + + return mv; + + } + + + /** + * redirect admin to view all the queries made by user + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + //method to redirect page to Message of User + @RequestMapping(value = "/admin/approve/contactInformation",method = RequestMethod.GET) + public ModelAndView getUserMessageget(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List tempContact=contactService.getAllMessages(); + mv.addObject("contactMessages", tempContact); + mv.setViewName("message"); + + + return mv; + + } + + +} diff --git a/src/main/java/com/adminportal/AdminPortalSchoolProjectApplication.java b/src/main/java/com/adminportal/AdminPortalSchoolProjectApplication.java new file mode 100644 index 0000000..797020a --- /dev/null +++ b/src/main/java/com/adminportal/AdminPortalSchoolProjectApplication.java @@ -0,0 +1,130 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Starting point of Spring Project. + */ +package com.adminportal; + +import java.util.HashSet; +import java.util.Set; + +import javax.management.relation.Role; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.core.env.Environment; + +import com.adminportal.domain.RoleDetail; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; + +import com.adminportal.service.RoleDetailService; +import com.adminportal.service.UserRoleService; +import com.adminportal.service.UserService; +import com.spoken.Utility.ServiceUtility; + +/** + * Stating point of launching application + * @author om prakash + * + */ +@SpringBootApplication +public class AdminPortalSchoolProjectApplication extends SpringBootServletInitializer implements CommandLineRunner { + + @Autowired + private UserService userService; + + @Autowired + private RoleDetailService roleService; + + @Autowired + private Environment env; + + + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + + return builder.sources(AdminPortalSchoolProjectApplication.class); + } + + + /** + * First method to run once application starts + * @param args argument to be passed + */ + public static void main(String[] args) { + new java.io.File(HomeController.uploadDirectory).mkdir(); + new java.io.File(HomeController.uploadTeacherDirectory).mkdir(); + SpringApplication.run(AdminPortalSchoolProjectApplication.class, args); + } + + + + /** + * method runs after main method once when application starts + */ + @Override + public void run(String... args) throws Exception { + + +// boolean vik=new java.io.File(env.getProperty("spring.applicationexternalPath.name")+HomeController.uploadDirectory).mkdirs(); +// new java.io.File(env.getProperty("spring.applicationexternalPath.name")+HomeController.uploadTeacherDirectory).mkdirs(); +// new java.io.File(env.getProperty("spring.applicationexternalPath.name")+ HomeController.uploadEvent).mkdirs(); +// new java.io.File(env.getProperty("spring.applicationexternalPath.name")+HomeController.uploadTestimonial).mkdirs(); +// System.out.println(vik); +// System.out.println(env.getProperty("spring.applicationexternalPath.name")+HomeController.uploadDirectory); +// +// System.out.println("starting of application"); +// User usr=new User(); +// usr.setId(1); +// usr.setFname("spoken"); +// usr.setLname("Tutorial"); +// usr.setEmail("spoken@spoken.org"); +// usr.setPassword(ServiceUtility.passwordEncoder().encode("spoken")); +// usr.setDateAdded(ServiceUtility.getCurrentTime()); +// usr.setLastLogin(ServiceUtility.getCurrentTime()); usr.setSex("Male"); +// usr.setRegistered(1); +// usr.setApproveTeacherFlag(0); +// +// +// RoleDetail learner=new RoleDetail(); learner.setRoleId(1); +// learner.setRoleName("Learner"); roleService.save(learner); +// +// +// RoleDetail parent=new RoleDetail(); parent.setRoleId(2); +// parent.setRoleName("Parent"); +// +// roleService.save(parent); +// +// RoleDetail teacher=new RoleDetail(); teacher.setRoleId(3); +// teacher.setRoleName("Teacher"); +// +// roleService.save(teacher); +// +// RoleDetail admin=new RoleDetail(); admin.setRoleId(4); +// admin.setRoleName("Admin"); +// +// roleService.save(admin); +// +// +// RoleDetail role=roleService.findByRoleName("Admin"); +// +// Set userRoles=new HashSet(); userRoles.add(new +// UserRole(1,usr, role)); +// +// +// userService.createUser(usr, userRoles); + + + + + } + + +} diff --git a/src/main/java/com/adminportal/AdminViewController.java b/src/main/java/com/adminportal/AdminViewController.java new file mode 100644 index 0000000..7bccfe8 --- /dev/null +++ b/src/main/java/com/adminportal/AdminViewController.java @@ -0,0 +1,1706 @@ +package com.adminportal; + + +import java.security.Principal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.hibernate.mapping.Array; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mail.MailException; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.stereotype.Controller; +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.SessionAttributes; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.servlet.ModelAndView; + +import com.adminportal.config.MailConstructor; +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.Events; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Testimonial; +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; +import com.adminportal.service.ArticleExternalService; +import com.adminportal.service.ClassService; +import com.adminportal.service.ConceptMapService; +import com.adminportal.service.DocumentExternalService; +import com.adminportal.service.EventService; +import com.adminportal.service.LessonPlanService; +import com.adminportal.service.PhetsService; +import com.adminportal.service.QuizQuestionService; +import com.adminportal.service.RoleDetailService; +import com.adminportal.service.SubjectClassService; +import com.adminportal.service.SubjectService; +import com.adminportal.service.TestimonialService; +import com.adminportal.service.TopicService; +import com.adminportal.service.TutorialService; +import com.adminportal.service.UserService; +import com.adminportal.service.VideoExternalService; +import com.spoken.Utility.ServiceUtility; +import com.spoken.Utility.TutorialList; + +/** + * This Controller makes changes in resource attributes done by Admin role based USer + * @author om prakash + * + */ +@Controller +public class AdminViewController { + + /** + * Path to store resource + */ + public static final String uploadDirectory="Media/content/"; + + /** + * path to store Teacher's role user data + */ + public static final String uploadTeacherDirectory="Media/Teacher/"; + + + @Autowired + private SubjectService subjectService; + + + @Autowired + private TopicService topicService; + + @Autowired + private UserService userService; + + @Autowired + private ArticleExternalService articleService; + + @Autowired + private DocumentExternalService documentService; + + @Autowired + private LessonPlanService lessonService; + + @Autowired + private PhetsService phetService; + + @Autowired + private QuizQuestionService quizService; + + @Autowired + private VideoExternalService videoService; + + @Autowired + private RoleDetailService roleService; + + @Autowired + private TestimonialService testiService; + + @Autowired + private EventService eventService; + + @Autowired + private ConceptMapService conceptService; + + @Autowired + private TutorialService tutorialService; + + @Autowired + private ClassService classService; + + @Autowired + private JavaMailSender mailSender; + + @Autowired + private MailConstructor mailConstructor; + + @Autowired + private SubjectClassService subjectClassService; + +/*------------------------------------------SHOW USER_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * redirect admin user to view all the user list + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/userList",method = RequestMethod.GET) + public ModelAndView userListGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List usr= userService.findAll(); + + mv.addObject("User", usr); + mv.setViewName("userList"); + + return mv; + } + + + /** + * Enable/Disable User By Admin User + * @param principal principal Object + * @param userId User ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/deleteUser",method = RequestMethod.POST) + public ModelAndView userListPost(Principal principal,@RequestParam(name="radiocall") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + User usrTemp=userService.findById(id); + if(usrTemp.getRegistered()==1) { + status=userService.disableEnableUser(0, id); + enableDisable="Disabled"; + }else { + status=userService.disableEnableUser(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "User "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List usr= userService.findAll(); + + mv.addObject("User", usr); + mv.setViewName("userList"); + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + +/*------------------------------------------SHOW SUBJECT_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * Enable/Disable Subject By Admin User + * @param principal principal Object + * @param subjectId subject ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/disableSubject",method = RequestMethod.POST) + public ModelAndView subjectListPost(Principal principal,@RequestParam(name="radioSubject") String subjectId,ModelAndView mv) { + + int id=Integer.parseInt(subjectId); + System.out.println(id); + Subject subTemp=null; + List subjectClassTemp=null; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + try { + subTemp=subjectService.findById(id); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + mv.addObject("status", "Please Try Again"); + Map> SubjectEntry=new HashMap>(); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExist); + + mv.setViewName("addSubject"); // setting view name + + List subjectList=subjectService.findAll(); + for(Subject temp:subjectList) { + List classWithSubject=new ArrayList<>(); + for(SubjectClassMapping temp1:temp.getSubClasMapp()) { + classWithSubject.add(temp1.getStandard().getClassName()); + } + Collections.sort(classWithSubject); + + SubjectEntry.put(temp, classWithSubject); + } + + TreeMap> sortedSubjectEntry = new TreeMap<>(); + sortedSubjectEntry.putAll(SubjectEntry); + + mv.addObject("Subject", sortedSubjectEntry); + + mv.addObject("viewActive","active"); + return mv; + } + + if(subTemp.isStatus()) { + subTemp.setStatus(false); + subjectService.save(subTemp); + + try { + subjectClassTemp=subjectClassService.getClassFromSubject(subTemp); + subjectClassService.updateSubjectinAllField(false, subTemp); + if(!subjectClassTemp.isEmpty()) { + topicService.disableEnableAllByClassStandard(0, subjectClassTemp); + } + mv.addObject("status", "Subject Disabled Successfully"); + } catch (Exception e) { + + subjectClassService.updateSubjectinAllField(true, subTemp); + if(!subjectClassTemp.isEmpty()) { + topicService.disableEnableAllByClassStandard(1, subjectClassTemp); + } + subTemp.setStatus(true); + subjectService.save(subTemp); + mv.addObject("status", "Please Try Again"); + e.printStackTrace(); + + } + + + }else { + subTemp.setStatus(true); + subjectService.save(subTemp); + try { + subjectClassTemp=subjectClassService.getClassFromSubject(subTemp); + subjectClassService.updateSubjectinAllField(true, subTemp); + if(!subjectClassTemp.isEmpty()) { + topicService.disableEnableAllByClassStandard(1, subjectClassTemp); + } + mv.addObject("status", "Subject Enabled Successfully"); + } catch (Exception e) { + + subjectClassService.updateSubjectinAllField(false, subTemp); + if(!subjectClassTemp.isEmpty()) { + topicService.disableEnableAllByClassStandard(0, subjectClassTemp); + } + subTemp.setStatus(false); + subjectService.save(subTemp); + mv.addObject("status", "Please Try Again"); + e.printStackTrace(); + + } + + } + + Map> SubjectEntry=new HashMap>(); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist",classExist); + + mv.setViewName("addSubject"); // setting view name + + List subjectList=subjectService.findAll(); + for(Subject temp:subjectList) { + List classWithSubject=new ArrayList<>(); + for(SubjectClassMapping temp1:temp.getSubClasMapp()) { + classWithSubject.add(temp1.getStandard().getClassName()); + } + Collections.sort(classWithSubject); + + SubjectEntry.put(temp, classWithSubject); + } + + TreeMap> sortedSubjectEntry = new TreeMap<>(); + sortedSubjectEntry.putAll(SubjectEntry); + + mv.addObject("Subject", sortedSubjectEntry); + + mv.addObject("viewActive","active"); + return mv; + + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + + /*------------------------------------------SHOW TOPIC_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * Enable/Disable Topic Resource By Admin User + * @param principal principal Object + * @param topicId topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteTopic",method = RequestMethod.POST) + public ModelAndView topicListPost(Principal principal,@RequestParam(name="radioTopic") String topicId,ModelAndView mv) { + + int id=Integer.parseInt(topicId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + Topic topicTemp=topicService.findById(id); + if(topicTemp.getStatus()==1) { + status=topicService.disableEnableTopicById(0, id); + enableDisable="Disabled"; + }else { + status=topicService.disableEnableTopicById(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Topic "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + List topicList=topicService.findAll(); + + mv.addObject("Topic", topicList); + mv.addObject("viewActive","active"); + mv.setViewName("addTopic"); + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + + /*------------------------------------------SHOW VIDEO_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + + /** + * Enable/Disable Video Resource By Admin User + * @param principal principal Object + * @param videoId Video ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteVideo",method = RequestMethod.POST) + public ModelAndView videoListPost(Principal principal,@RequestParam(name="radioVideo") String videoId,ModelAndView mv) { + + int id=Integer.parseInt(videoId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + VideoExternal videoTemp=videoService.findById(id); + if(videoTemp.isStatus()==1) { + status=videoService.EnableVideoContent(0, id); + enableDisable="Disabled"; + + }else { + status=videoService.EnableVideoContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Video "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + + + List videoListtemp=videoService.findAll(); + List videoList=new ArrayList(); + for(VideoExternal temp:videoListtemp) { + if(temp.getAcceptedByAdmin()==1) { + videoList.add(temp); + } + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + + mv.addObject("Video",videoList); + mv.addObject("viewActive","active"); + + mv.setViewName("addVideo"); + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------SHOW ARTICLE_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * Enable/Disable article Resource By Admin User + * @param principal principal Object + * @param articleId article ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteArticle",method = RequestMethod.POST) + public ModelAndView articleListPost(Principal principal,@RequestParam(name="radioArticle") String articleId,ModelAndView mv) { + + int id=Integer.parseInt(articleId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ArticleExternal articleTemp=articleService.findByid(id); + if(articleTemp.isStatus()==1) { + status=articleService.EnableArticleContent(0, id); + enableDisable="Disabled"; + }else { + status=articleService.EnableArticleContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Article "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + List articleListTemp=articleService.findAll(); + List articleList=new ArrayList(); + for(ArticleExternal temp:articleListTemp) { + if(temp.getAcceptedByAdmin()==1) { + articleList.add(temp); + } + } + + mv.addObject("Article",articleList); + mv.addObject("viewActive","active"); + mv.setViewName("addArticle"); + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + + + /*------------------------------------------SHOW DOCUMENT_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + + /** + * Enable/Disable Document Resource By Admin User + * @param principal principal Object + * @param documentId Document ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteDocument",method = RequestMethod.POST) + public ModelAndView documentListPost(Principal principal,@RequestParam(name="radioDocument") String documentId,ModelAndView mv) { + + int id=Integer.parseInt(documentId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + DocumentExternal documentTemp=documentService.findByid(id); + if(documentTemp.isStatus()==1) { + status=documentService.EnableDocumentContent(0, id); + enableDisable="Disabled"; + }else { + status=documentService.EnableDocumentContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Document "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + List documentListTemp=documentService.findAll(); + List documentList=new ArrayList(); + for(DocumentExternal temp:documentListTemp) { + if(temp.getAcceptedByAdmin()==1) { + documentList.add(temp); + } + } + + mv.addObject("Document",documentList); + mv.addObject("viewActive","active"); + mv.setViewName("addDocument"); + return mv; + } + + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------SHOW PHET_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + /** + * Enable/Disable Phet Resource By Admin User + * @param principal principal Object + * @param phetId Phet ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deletePhet",method = RequestMethod.POST) + public ModelAndView phetsListPost(Principal principal,@RequestParam(name="radioPhet") String phetId,ModelAndView mv) { + + int id=Integer.parseInt(phetId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + Phets phetTemp=phetService.findByid(id); + if(phetTemp.isStatus()==1) { + status=phetService.EnablePhetContent(0, id); + enableDisable="Disabled"; + }else { + status=phetService.EnablePhetContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Phet "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List phetListTemp=phetService.findAll(); + List phetList=new ArrayList(); + for(Phets temp:phetListTemp) { + if(temp.getAcceptedByAdmin()==1) { + phetList.add(temp); + } + } + + mv.addObject("Phet",phetList); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("viewActive","active"); + + mv.setViewName("addPhets"); + return mv; + } + + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------SHOW LESSONPLAN_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + + /** + * Enable/Disable LessonPlan Resource By Admin User + * @param principal principal Object + * @param lessonId lessonPlan ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteLesson",method = RequestMethod.POST) + public ModelAndView lessonPlanListPost(Principal principal,@RequestParam(name="radioLesson") String lessonId,ModelAndView mv) { + + int id=Integer.parseInt(lessonId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + LessonPlan lessonTemp=lessonService.findById(id); + if(lessonTemp.isStatus()==1) { + status=lessonService.EnableLessonPlanContent(0, id); + enableDisable="Disabled"; + }else { + status=lessonService.EnableLessonPlanContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Lesson "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + + List lessonListTemp=lessonService.findAll(); + List lessonList=new ArrayList(); + for(LessonPlan temp:lessonListTemp) { + if(temp.getAcceptedByAdmin()==1) { + lessonList.add(temp); + } + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + mv.addObject("viewActive","active"); + + mv.addObject("Lesson",lessonList); + mv.setViewName("addLessonPlan"); + return mv; + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*------------------------------------------SHOW QUIZ_LIST (ADMIN MODULE)-----------------------------------------------------------------*/ + + + /** + * Enable/Disable Quiz Resource By Admin User + * @param principal principal Object + * @param quizId Quiz ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteQuiz",method = RequestMethod.POST) + public ModelAndView quizListPost(Principal principal,@RequestParam(name="radioQuiz") String quizId,ModelAndView mv) { + + int id=Integer.parseInt(quizId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + QuizQuestion quizTemp=quizService.findById(id); + if(quizTemp.isStatus()==1) { + status=quizService.EnableQuizContent(0, id); + enableDisable="Disabled"; + }else { + status=quizService.EnableQuizContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Quiz "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List quizListTemp=quizService.findAll(); + List quizList=new ArrayList(); + for(QuizQuestion temp:quizListTemp) { + if(temp.getAcceptedByAdmin()==1) { + quizList.add(temp); + } + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + mv.addObject("Quiz",quizList ); + mv.addObject("viewActive","active"); + mv.setViewName("addQuiz"); + return mv; + } + +/*-------------------------------------------CONCEPT-MAP---------------------------------------*/ + + + /** + * Enable/Disable ConcepMap Resource By Admin User + * @param principal principal Object + * @param conceptId conceptMap ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/deleteConcept",method = RequestMethod.POST) + public ModelAndView conceptListPost(Principal principal,@RequestParam(name="radioConcept") String conceptId,ModelAndView mv) { + + int id=Integer.parseInt(conceptId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + ConceptMap conceptTemp=conceptService.findByid(id); + if(conceptTemp.getStatus()==1) { + status=conceptService.EnableConceptContent(0, id); + enableDisable="Disabled"; + }else { + status=conceptService.EnableConceptContent(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Concept "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List ConceptMapListTemp=conceptService.findAll(); + List ConceptMapList=new ArrayList(); + for(ConceptMap temp:ConceptMapListTemp) { + if(temp.getAcceptedByAdmin()==1) { + ConceptMapList.add(temp); + } + } + + + mv.addObject("ConceptMapList",ConceptMapList ); + mv.addObject("viewActive","active"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + mv.setViewName("addConcpetMap"); + return mv; + } + + +/*----------------------------------------------------------END----------------------------------------------------------------------------*/ + + +/*-----------------------------------------------START OF APPROVING/REJECT TECAHER---------------------------------------------------------------------*/ + + /** + * redirect admin user to approve reject Teacher page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectTeacher") + public ModelAndView teacherAprovementGet(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + List local=new ArrayList(); + + List usr= userService.findAll(); + + for(User a:usr) { + List userRole=a.getUserRoles(); + for(UserRole x:userRole) { + if(x.getRole().getRoleName().contentEquals("Teacher") && a.getApproveTeacherFlag()==0) { + local.add(a); + } + } + } + + if(!local.isEmpty()) { + mv.addObject("UserTeacher", local); + + }else { + mv.addObject("TeacherStatus","No Entries Present To Approve"); + } + + + mv.setViewName("approveRejectTeacher"); + + return mv; + } + + /** + * Accept User's Teacher Role By Admin User + * @param principal principal Object + * @param userId User ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveTeacher",method =RequestMethod.POST) + public ModelAndView approveTeacherPost(Principal principal,@RequestParam(name="radiocall") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean statusReg,statusApprove; + + User usrApprove=userService.findById(id); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + statusReg=userService.disableEnableUser(1, id); + + statusApprove=userService.enableApproveTeacher(1, id); + + if(statusReg && statusApprove) { + try { + SimpleMailMessage emailSend=mailConstructor.confirmOnApproveTeacher(usrApprove); + mailSender.send(emailSend); + } catch (MailException e) { + + e.printStackTrace(); + mv.addObject("status", "User Enabled Successfully"); + List local=new ArrayList(); + + List usr= userService.findAll(); + + for(User a:usr) { + List userRole=a.getUserRoles(); + for(UserRole x:userRole) { + if(x.getRole().getRoleName().contentEquals("Teacher") && a.getRegistered()==0) { + local.add(a); + } + } + } + + if(!local.isEmpty()) { + mv.addObject("UserTeacher", local); + + }else { + mv.addObject("TeacherStatus","No Entries Present To Approve"); + } + + + mv.setViewName("approveRejectTeacher"); + + + return mv; + } + + mv.addObject("status", "User Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List local=new ArrayList(); + + List usr= userService.findAll(); + + for(User a:usr) { + List userRole=a.getUserRoles(); + for(UserRole x:userRole) { + if(x.getRole().getRoleName().contentEquals("Teacher") && a.getRegistered()==0) { + local.add(a); + } + } + } + + if(!local.isEmpty()) { + mv.addObject("UserTeacher", local); + + }else { + mv.addObject("TeacherStatus","No Entries Present To Approve"); + } + + + mv.setViewName("approveRejectTeacher"); + + + return mv; + } + + + + + +/*--------------------------------------------------------END----------------------------------------------------------------------------------*/ + + /*-----------------------------------------------START OF APPROVING/REJECT VIDEO---------------------------------------------------------------------*/ + + + /** + * redirect admin user to approve Reject Video page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectVideo") + public ModelAndView videoApprovementGet(Principal principal, ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localVideo=new ArrayList(); + + List videoList=videoService.findAll(); + for(VideoExternal a:videoList) { + if(a.getAcceptedByAdmin()==0) { + localVideo.add(a); + } + } + + if(localVideo.isEmpty()) { + + mv.addObject("VideoStatus","No Entries Present To Approve"); + }else { + mv.addObject("VideoAdded",localVideo); + } + + + + + mv.setViewName("approveRejectVideo"); + + return mv; + } + + /** + * Accept Video Resource By Admin User + * @param principal principal Object + * @param userId Video ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnableVideo",method = RequestMethod.POST) + public ModelAndView enbaleVideoPost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + int id=Integer.parseInt(userId); + boolean status; + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + status=videoService.EnableAcceptedByAdminVideoContent(1, id); + + if(status) { + mv.addObject("status", "Video Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + + List localVideo=new ArrayList(); + + List videoList=videoService.findAll(); + for(VideoExternal a:videoList) { + if(a.getAcceptedByAdmin()==0) { + localVideo.add(a); + } + } + + if(localVideo.isEmpty()) { + + mv.addObject("VideoStatus","No Entries Present To Approve"); + }else { + mv.addObject("VideoAdded",localVideo); + } + + + + + + mv.setViewName("approveRejectVideo"); + + return mv; + } + + +/*-----------------------------------------------START OF APPROVING/REJECT DOCUMENT---------------------------------------------------------------------*/ + + /** + * redirects admin User to approveReject Document Page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectDocument") + public ModelAndView documentApprovementGet(Principal principal, ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localdocument=new ArrayList(); + + List documentList=documentService.findAll(); + for(DocumentExternal a:documentList) { + if(a.getAcceptedByAdmin()==0) { + localdocument.add(a); + } + } + + if(localdocument.isEmpty()) { + + mv.addObject("documentStatus","No Entries Present To Approve"); + }else { + mv.addObject("Documentadded",localdocument); + } + + + mv.setViewName("approveRejectDocument"); + + + return mv; + } + + /** + * Accept Document Resource By Admin User + * @param principal principal Object + * @param userId Document ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnableDocument",method = RequestMethod.POST) + public ModelAndView enbaleDocumentPost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + status=documentService.EnableAcceptedByAdminDocumentContent(1, id); + + if(status) { + mv.addObject("status", "Document Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List localdocument=new ArrayList(); + + List documentList=documentService.findAll(); + for(DocumentExternal a:documentList) { + if(a.getAcceptedByAdmin()==0) { + localdocument.add(a); + } + } + + if(localdocument.isEmpty()) { + + mv.addObject("documentStatus","No Entries Present To Approve"); + }else { + mv.addObject("Documentadded",localdocument); + } + + + + + + mv.setViewName("approveRejectDocument"); + + return mv; + } + + + + /*-----------------------------------------------START OF APPROVING/REJECT ARTICLE---------------------------------------------------------------------*/ + + + /** + * redirects admin user to ApproveReject Article page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectArticle") + public ModelAndView articleApprovementGet(Principal principal, ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localarticle=new ArrayList(); + + List articleList=articleService.findAll(); + for(ArticleExternal a:articleList) { + if(a.getAcceptedByAdmin()==0) { + localarticle.add(a); + } + } + + if(localarticle.isEmpty()) { + + mv.addObject("articleStatus","No Entries Present To Approve"); + }else { + mv.addObject("Article",localarticle); + } + + + mv.setViewName("approveRejectArticle"); + + return mv; + } + + + /** + * Accept Article Resource By Admin User + * @param principal principal Object + * @param userId Article ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnableArticle",method = RequestMethod.POST) + public ModelAndView enbaleArticlePost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + status=articleService.EnableAcceptedByAdminArticleContent(1, id); + + if(status) { + mv.addObject("status", "Article Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List localarticle=new ArrayList(); + + List articleList=articleService.findAll(); + for(ArticleExternal a:articleList) { + if(a.getAcceptedByAdmin()==0) { + localarticle.add(a); + } + } + + if(localarticle.isEmpty()) { + + mv.addObject("articleStatus","No Entries Present To Approve"); + }else { + mv.addObject("Article",localarticle); + } + + + mv.setViewName("approveRejectArticle"); + + return mv; + } + + + /*-----------------------------------------------START OF APPROVING/REJECT PHETS---------------------------------------------------------------------*/ + + /** + * redirects admin user to ApproveReject Phet Page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectPhets") + public ModelAndView phetApprovementGet(Principal principal, ModelAndView mv) { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localphet=new ArrayList(); + + List phetList=phetService.findAll(); + for(Phets a:phetList) { + if(a.getAcceptedByAdmin()==0) { + localphet.add(a); + } + } + + if(localphet.isEmpty()) { + + mv.addObject("phetStatus","No Entries Present To Approve"); + }else { + mv.addObject("PhetsAdded",localphet); + } + + mv.setViewName("approveRejectPhet"); + + + return mv; + } + + + /** + * Accept Phet Resource By Admin User + * @param principal principal Object + * @param userId Phet ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnablePhet",method = RequestMethod.POST) + public ModelAndView enbalePhetPost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + status=phetService.EnableAcceptedByAdminPhetContent(1, id); + + if(status) { + mv.addObject("status", "Phets Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List localphet=new ArrayList(); + + List phetList=phetService.findAll(); + for(Phets a:phetList) { + if(a.getAcceptedByAdmin()==0) { + localphet.add(a); + } + } + + if(localphet.isEmpty()) { + + mv.addObject("phetStatus","No Entries Present To Approve"); + }else { + mv.addObject("PhetsAdded",localphet); + } + + + mv.setViewName("approveRejectPhet"); + + + return mv; + } + + + /*-----------------------------------------------START OF APPROVING/REJECT QUIZ---------------------------------------------------------------------*/ + + /** + * redirects Admin User to ApproveReject Quiz Page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectQuiz") + public ModelAndView quizApprovementGet(Principal principal, ModelAndView mv) { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localQuiz=new ArrayList(); + + List quizList=quizService.findAll(); + for(QuizQuestion a:quizList) { + if(a.getAcceptedByAdmin()==0) { + localQuiz.add(a); + } + } + + if(localQuiz.isEmpty()) { + + mv.addObject("QuizStatus","No Entries Present To Approve"); + }else { + mv.addObject("QuizAdded",localQuiz); + } + + mv.setViewName("approveRejectQuiz"); + + + return mv; + } + + /** + * Accept Quiz Resource By Admin User + * @param principal principal Object + * @param userId Quiz ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnableQuiz",method = RequestMethod.POST) + public ModelAndView enbaleQuizPost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + status=quizService.EnableAcceptedByAdminQuizContent(1, id); + + if(status) { + mv.addObject("status", "Quiz Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List localQuiz=new ArrayList(); + + List quizList=quizService.findAll(); + for(QuizQuestion a:quizList) { + if(a.getAcceptedByAdmin()==0) { + localQuiz.add(a); + } + } + + if(localQuiz.isEmpty()) { + + mv.addObject("QuizStatus","No Entries Present To Approve"); + }else { + mv.addObject("QuizAdded",localQuiz); + } + + mv.setViewName("approveRejectQuiz"); + + return mv; + } + + + + /*-----------------------------------------------START OF APPROVING/REJECT LESSON---------------------------------------------------------------------*/ + + /** + * redirects admin User to ApproveReject Lesson Page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectLesson") + public ModelAndView lessonApprovementGet(Principal principal, ModelAndView mv) { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localLesson=new ArrayList(); + + List lessonList=lessonService.findAll(); + for(LessonPlan a:lessonList) { + if(a.getAcceptedByAdmin()==0) { + localLesson.add(a); + } + } + + if(localLesson.isEmpty()) { + + mv.addObject("LessonStatus","No Entries Present To Approve"); + }else { + mv.addObject("LessonAdded",localLesson); + } + + mv.setViewName("approveRejectLesson"); + + return mv; + } + + /** + * Accept LessonPlan Resource By Admin User + * @param principal principal Object + * @param userId LessonPlan ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnableLesson",method = RequestMethod.POST) + public ModelAndView enbaleLessonPost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + status=lessonService.EnableAcceptedByAdminLessonPlanContent(1, id); + + if(status) { + mv.addObject("status", "Lesson Plan Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List localLesson=new ArrayList(); + + List lessonList=lessonService.findAll(); + for(LessonPlan a:lessonList) { + if(a.getAcceptedByAdmin()==0) { + localLesson.add(a); + } + } + + if(localLesson.isEmpty()) { + + mv.addObject("LessonStatus","No Entries Present To Approve"); + }else { + mv.addObject("LessonAdded",localLesson); + } + + mv.setViewName("approveRejectLesson"); + + return mv; + } + + + /*----------------------------------- APPROVE REJECT CONCEPTS-MAP ------------------------------------------------*/ + + /** + * redirects Admin User to ApproveReject Concept Map Page + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/approveRejectConcept") + public ModelAndView conceptApprovementGet(Principal principal, ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + List localconcept=new ArrayList(); + + List conceptList=conceptService.findAll(); + for(ConceptMap a:conceptList) { + if(a.getAcceptedByAdmin()==0) { + localconcept.add(a); + } + } + + if(localconcept.isEmpty()) { + + mv.addObject("conceptStatus","No Entries Present To Approve"); + }else { + mv.addObject("Conceptadded",localconcept); + } + + mv.setViewName("approveRejectConcept"); + + return mv; + } + + /** + * Accept ConcepMap Resource By Admin User + * @param principal principal Object + * @param userId ConceptMap ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/EnableConcept",method = RequestMethod.POST) + public ModelAndView enbaleConceptPost(Principal principal,@RequestParam(name="selectionRadio") String userId, ModelAndView mv) { + + int id=Integer.parseInt(userId); + boolean status; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + status=conceptService.EnableAcceptedByAdminConceptContent(1, id); + + if(status) { + mv.addObject("status", "Concept-Map Enabled Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List localconcept=new ArrayList(); + + List conceptList=conceptService.findAll(); + for(ConceptMap a:conceptList) { + if(a.getAcceptedByAdmin()==0) { + localconcept.add(a); + } + } + + if(localconcept.isEmpty()) { + + mv.addObject("conceptStatus","No Entries Present To Approve"); + }else { + mv.addObject("Conceptadded",localconcept); + } + + mv.setViewName("approveRejectConcept"); + return mv; + } + /***********************************************************************************************************************/ + + /** + * redirects admin user to view all the Testimonial data exist in application + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/testimonialList",method = RequestMethod.GET) + public ModelAndView testimonialList(Principal principal,ModelAndView mv) { + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + try{ + + List local=testiService.findAll(); + mv.addObject("Testimonial", local); + + mv.setViewName("testimonialList"); + } + catch (Exception e) { + mv.setViewName("redirect:/"); + + } + + return mv; + + + } + + /** + * Redirects Admin user to view all the Event data exist in application. + * @param principal principal Object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value = "/admin/approve/eventList",method = RequestMethod.GET) + public ModelAndView eventList(Principal principal,ModelAndView mv) { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + try{ + List local=eventService.findAll(); + mv.addObject("Events", local); + + mv.setViewName("eventList"); + } + catch (Exception e) { + mv.setViewName("redirect:/"); + + } + + return mv; + + + } + + + // not in use + @RequestMapping(value = "/admin/approve/tutorialList",method = RequestMethod.GET) + public ModelAndView TutorialList(Principal principal,ModelAndView mv) { + + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + List tempTutorial=tutorialService.getAllTutorial(); + + List tutorialListData=new ArrayList(); + + + for(Tutorial localTemp:tempTutorial) { + + try { + String url="https://spoken-tutorial.org/api/get_tutorialdetails/"+localTemp.getStVideoId()+"/"; + RestTemplate restTemp=new RestTemplate(); + TutorialList localTutorial=restTemp.getForObject(url, TutorialList.class); + + localTutorial.setTutorialId(localTemp.getTutorialId()); + localTutorial.setTopicNAme(localTemp.getTopic().getTopicName()); + localTutorial.setContributedBy(localTemp.getUser().getFname()); + localTutorial.setStatus(localTemp.getStatus()); + System.out.println(localTutorial.getOutline()); + + tutorialListData.add(localTutorial); + } catch (RestClientException e) { + + e.printStackTrace(); + } + } + + + + mv.addObject("Tutorials", tutorialListData); + + mv.setViewName("tutorialList"); + + return mv; + + + } + + /** + * Changes Tutorial's attributes value in database + * @param principal principal object + * @param req HttpServletRequest + * @param tutorialId Tutorial Resource ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/admin/addView/disableEnableTutorial",method = RequestMethod.POST) + public ModelAndView enableDisableTutorialListPost(Principal principal,HttpServletRequest req,@RequestParam(name="radioTutorial") String tutorialId,ModelAndView mv) { + + int id=Integer.parseInt(tutorialId); + boolean status; + String enableDisable; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + Tutorial tutorialTemp=tutorialService.getById(id); + if(tutorialTemp.getStatus()==1) { + status=tutorialService.enableDisableTutorial(0, id); + enableDisable="Disabled"; + + }else { + status=tutorialService.enableDisableTutorial(1, id); + enableDisable="Enabled"; + } + if(status) { + mv.addObject("status", "Tutorial "+enableDisable+ " Successfully"); + }else { + mv.addObject("status", "Please try Again"); + } + + List tempTutorial=tutorialService.getAllTutorial(); + + List tutorialListData=new ArrayList(); + + + for(Tutorial localTemp:tempTutorial) { + + try { + String url="https://spoken-tutorial.org/api/get_tutorialdetails/"+localTemp.getStVideoId()+"/"; + RestTemplate restTemp=new RestTemplate(); + TutorialList localTutorial=restTemp.getForObject(url, TutorialList.class); + + localTutorial.setTutorialId(localTemp.getTutorialId()); + localTutorial.setTopicNAme(localTemp.getTopic().getTopicName()); + localTutorial.setContributedBy(localTemp.getUser().getFname()); + localTutorial.setStatus(localTemp.getStatus()); + + tutorialListData.add(localTutorial); + } catch (RestClientException e) { + + e.printStackTrace(); + } + } + + + mv.addObject("Tutorials", tutorialListData); + mv.addObject("viewActive","active"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); + + mv.setViewName("addTutorial"); + return mv; + } + + + + +/************************************************************END********************************************************************************/ + + + + + +} diff --git a/src/main/java/com/adminportal/ContributorController.java b/src/main/java/com/adminportal/ContributorController.java new file mode 100644 index 0000000..c60c599 --- /dev/null +++ b/src/main/java/com/adminportal/ContributorController.java @@ -0,0 +1,1016 @@ +package com.adminportal; + +import java.security.Principal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Controller; +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.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.service.ArticleExternalService; +import com.adminportal.service.ClassService; +import com.adminportal.service.ConceptMapService; +import com.adminportal.service.ContactFormService; +import com.adminportal.service.DocumentExternalService; +import com.adminportal.service.EventService; +import com.adminportal.service.LessonPlanService; +import com.adminportal.service.PhetsService; +import com.adminportal.service.QuizQuestionService; +import com.adminportal.service.SubjectClassService; +import com.adminportal.service.SubjectService; +import com.adminportal.service.TestimonialService; +import com.adminportal.service.TopicService; +import com.adminportal.service.TutorialService; +import com.adminportal.service.UserService; +import com.adminportal.service.VideoExternalService; +import com.spoken.Utility.ServiceUtility; + +/** + * This Controller add all the resources from Teacher Role's User + * @author om prakash + * + */ +@Controller +public class ContributorController { + + /** + * path to store resources + */ + public static final String uploadDirectory="Media/content/"; /* path to which content will get stored */ + /** + * Path to store Event data + */ + public static final String uploadEvent="Media/Event/"; + /** + * SIze of Video file + */ + public static final long videoSize=50*1024*1024; // 50 MB vidoe File max + /** + * SIze of normal file + */ + public static final long fileSize=10*1024*1024; // 10 MB max file max + /** + * Path to store Testimonial data + */ + public static final String uploadTestimonial="Media/Testimonial/"; + /** + * Duration of Video + */ + public static final long videoDuration=300000000L; + + @Autowired + private ClassService classService; + + @Autowired + private SubjectClassService subjectClassService; + + @Autowired + private SubjectService subjectService; + + @Autowired + private TopicService topicService; + + @Autowired + private UserService userService; + + @Autowired + private ArticleExternalService articleService; + + @Autowired + private DocumentExternalService documentService; + + @Autowired + private LessonPlanService lessonService; + + @Autowired + private PhetsService phetService; + + @Autowired + private QuizQuestionService quizService; + + @Autowired + private VideoExternalService videoService; + + @Autowired + private ConceptMapService conceptService; + + @Autowired + private TestimonialService testiService; + + @Autowired + private EventService eventService; + + @Autowired + private TutorialService tutorialService; + + @Autowired + private ContactFormService contactService; + + @Autowired + private Environment env; + + + /** + * add video resource to app (iframe data) from Teacher's Role + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Video into database + @RequestMapping(value="/conVideo/addVideo",method = RequestMethod.POST) + public ModelAndView addVideoGetPost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String url=req.getParameter("url"); + String source=req.getParameter("source"); + String videourl=null; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(url.length()>0) { // check for proper Video Url + + if(!url.startsWith(" classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.setViewName("video"); + + return mv; + + + + } + + }else { + + } + + int videoId=videoService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + User usr=userService.findByUsername(principal.getName()); + + Set videoMapping=new HashSet(); + videoMapping.add(new VideoExternal(videoId, "Video", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, videourl, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToVideo(usr, videoMapping); // persist Video Information + mv.addObject("statusAdd", "Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + + VideoExternal videoTemp=videoService.findById(videoId); + videoService.deleteVideo(videoTemp); + mv.addObject("failure", "Please Try Again Later"); + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("video"); // setting view name + + + + return mv; + + } + + /** + * add Video resource to app from Teacher's Role + * @param video video file to be added + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/conVideo/addVideoUpload",method = RequestMethod.POST) + public ModelAndView addVideoUploadPost(@RequestParam(name="videoUpload") MultipartFile video,HttpServletRequest req,Principal principal,ModelAndView mv) { + + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String source=req.getParameter("source"); + String videourl=null; + String path1=null; + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(!ServiceUtility.checkFileExtensionVideo(video)) { + + mv.addObject("failure", "Please upload mp4 or mov file"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("video"); // setting view name + + + + return mv; + + } + + + if(video.getSize()>videoSize) { + + mv.addObject("failure", "Please upload file size within 50MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("video"); // setting view name + + + + return mv; + + } + + int videoId=videoService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + User usr=userService.findByUsername(principal.getName()); + + Set videoMapping=new HashSet(); + videoMapping.add(new VideoExternal(videoId, "Video", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, "null", 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToVideo(usr, videoMapping); // persist Video Information + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Video/"+videoId+"/"; // path to save video + + boolean ques=ServiceUtility.createFolder(createFolder); + + if(ques) { + + path1=ServiceUtility.uploadVideoFile(video, createFolder); + + int indexToStart=path1.indexOf("Media"); // extracting proper Path from Actual path + String path=path1.substring(indexToStart, path1.length()); + + VideoExternal videoTemp=videoService.findById(videoId); + videoTemp.setUrl(path); + videoService.save(videoTemp); + + mv.addObject("statusAdd", "Added Successfully"); + }else { + VideoExternal videoTemp=videoService.findById(videoId); + videoService.deleteVideo(videoTemp); + mv.addObject("failure", "Please Try Again Later"); + } + + } catch (Exception e) { + + e.printStackTrace(); + VideoExternal videoTemp=videoService.findById(videoId); + videoService.deleteVideo(videoTemp); + mv.addObject("failure", "Please Try Again Later"); + } + + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("video"); // setting view name + + + + return mv; + + } + + /*----------------------------------------------------------END----------------------------------------------------------------------------*/ + /** + * add Quiz data to app from Teacher's Role + * @param req HttpServletRequest object + * @param question question file to be added + * @param answer answer file to be added + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Quiz into database + @RequestMapping(value="/conQuiz/addQuiz",method = RequestMethod.POST) + public ModelAndView addQuizPost(HttpServletRequest req,@RequestParam(name="Question")MultipartFile[] question,Principal principal,@RequestParam(name="Answer")MultipartFile[] answer,ModelAndView mv) { + + String questionPath=null; + String answerPath=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String remarks=req.getParameter("remarks"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + + if(!ServiceUtility.checkFileExtensionPDF(question)) { // check for PDF file + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "Please Add only Pdf File"); + + mv.setViewName("quiz"); + + return mv; + + + + } + + if(!ServiceUtility.checkFileExtensionPDF(answer)) { // check for PDF file + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "Please Add only Pdf File"); + + mv.setViewName("quiz"); + + return mv; + + + } + + if(question[0].getSize()>fileSize || answer[0].getSize()>fileSize) { + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "FileSize must be within 10MB"); + + mv.setViewName("quiz"); + + return mv; + } + int quizId=quizService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + User usr=userService.findByUsername(principal.getName()); + + Set quizMapping=new HashSet(); + quizMapping.add(new QuizQuestion(quizId,"Quiz",ServiceUtility.getCurrentTime(),ServiceUtility.getCurrentTime(),"null","null",0,0,remarks,ServiceUtility.getCurrentTime(),localTopic,usr)); + + userService.addUserToQuizQuestion(usr, quizMapping); // persist Quiz details + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Quiz/"+quizId+"/"; // path to save question and answer + boolean b=ServiceUtility.createFolder(createFolder); + + String CreateFolderQuestion=createFolder+"Question/"; + String CreateFolderAnswer=createFolder+"Answer/"; + + boolean ques=ServiceUtility.createFolder(CreateFolderQuestion); + boolean ans=ServiceUtility.createFolder(CreateFolderAnswer); + + + if(ques && ans) { + + questionPath=ServiceUtility.uploadFile(question, CreateFolderQuestion); + answerPath=ServiceUtility.uploadFile(answer, CreateFolderAnswer); + + + int indexToStart=questionPath.indexOf("Media"); + String pathQuestion=questionPath.substring(indexToStart, questionPath.length()); + + int indexToStart1=answerPath.indexOf("Media"); + String pathAnswer=answerPath.substring(indexToStart1, answerPath.length()); + + QuizQuestion quizTemp=quizService.findById(quizId); + quizTemp.setAnswer(pathAnswer); + quizTemp.setQuestion(pathQuestion); + + quizService.save(quizTemp); + + + + mv.addObject("statusAdd", "Added Successfully"); + + }else { + + QuizQuestion quizTemp=quizService.findById(quizId); + quizService.deleteQuiz(quizTemp); + mv.addObject("failure", " Try again Later"); + } + } catch (Exception e) { + + e.printStackTrace(); + QuizQuestion quizTemp=quizService.findById(quizId); + quizService.deleteQuiz(quizTemp); + + mv.addObject("failure", " Try again Later"); + + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("quizStatus", "Added Successfully"); + + mv.setViewName("quiz"); // setting view name + + return mv; + + + } + + /** + * add conceptMap data to app from Teacher's Role + * @param req HttpServletRequest object + * @param conceptMapImage file to be added + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Concept -MAp into database + @RequestMapping(value = "/conConceptMap/addConceptMap",method = RequestMethod.POST) + public ModelAndView addConceptMapPost(HttpServletRequest req,Principal principal,@RequestParam(name="conceptMapImage")MultipartFile[] conceptMapImage,ModelAndView mv) { + + String path1=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("descriptionConceptMap"); + String remark=req.getParameter("headlineConceptMap"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + if(!ServiceUtility.checkFileExtensionImage(conceptMapImage) && !ServiceUtility.checkFileExtensionZip(conceptMapImage)) { // check Image file + mv.addObject("fileError", "File must be a Image File or Html Page"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.setViewName("conceptMap"); + + return mv; + + } + + if(conceptMapImage[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.setViewName("conceptMap"); + + return mv; + } + + + int conceptID=conceptService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + User usr=userService.findByUsername(principal.getName()); + + Set conceptMapping=new HashSet(); + conceptMapping.add(new ConceptMap(conceptID, "ConceptMap", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), "null", desc, 0,0, remark, localTopic, usr)); + + userService.addUserToConceptMap(usr, conceptMapping); // persist Concept-map + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/ConceptMap/"+conceptID+"/"; // path to store Concept-map + + ServiceUtility.createFolder(createFolder); + + if(ServiceUtility.checkFileExtensionImage(conceptMapImage)) { + path1=ServiceUtility.uploadFile(conceptMapImage, createFolder); + }else { + path1=ServiceUtility.uploadZipFile(conceptMapImage, createFolder); + } + + int indexToStart=path1.indexOf("Media"); // extracting proper Path from Actual path + String path=path1.substring(indexToStart, path1.length()); + + ConceptMap concepTemp=conceptService.findByid(conceptID); + concepTemp.setUrl(path); + + conceptService.save(concepTemp); + + + mv.addObject("statusAdd", "Concept-Map Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + ConceptMap conceptTemp=conceptService.findByid(conceptID); + conceptService.deleteConceptMap(conceptTemp); + mv.addObject("failure", "Please Try Again"); + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("conceptMap"); // setting view name + + return mv; + } + + /** + * Add phet resource to app from Teacher's Role + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Phets into database + @RequestMapping(value="/conPhet/addPhets",method = RequestMethod.POST) + public ModelAndView addPhetsPost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String phet=req.getParameter("phet"); + String source=req.getParameter("source"); + String phetPath=null; + + if(phet.length()>0) { // checking out whether phet link proper or not + + if(!phet.startsWith(" classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("fileError", "Please specify Embed Code"); + + mv.setViewName("phets"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + + } + + }else { + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.addObject("failure", "Please Try Again"); + + mv.setViewName("phets"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + + } + + int phetId=phetService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + User usr=userService.findByUsername(principal.getName()); // retrive Logged In User + + + Set phetMapping=new HashSet(); + phetMapping.add(new Phets(phetId, "Phets", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, phetPath, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + + userService.addUserToPhets(usr, phetMapping); // persist Phet data + mv.addObject("statusAdd", "Added Successfully"); + + + } catch (Exception e) { + + e.printStackTrace(); + Phets phetTemp=phetService.findByid(phetId); + phetService.deletePhet(phetTemp); + mv.addObject("failure", "Please Try Again"); + + + } + + + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("phets"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + } + + /** + * adds Lesson resource to app from Teacher's Role + * @param req HttpServletRequest object + * @param lesson file to be added + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Lesson Plan into database + @RequestMapping(value="/conLessonPlan/addLessonPlan",method = RequestMethod.POST) + public ModelAndView addLessonPlanPost(HttpServletRequest req,@RequestParam(name="lesson") MultipartFile[] lesson,Principal principal,ModelAndView mv) { + + String path1=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + + if(!ServiceUtility.checkFileExtensionPDF(lesson)) { // validation against PDF document + + mv.addObject("fileError", "Please Select PDF file"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("lessonPlan"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + if(lesson[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("lessonPlan"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + } + + int lessonId=lessonService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); + Subject localSubject=subjectService.findBysubName(subjectName); + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); + + + + User usr=userService.findByUsername(principal.getName()); // retrive logged in user + + Set lessonMapping=new HashSet(); + lessonMapping.add(new LessonPlan(lessonId, "Lesson", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), "null", 0, 0,ServiceUtility.getCurrentTime(), localTopic, usr)); + + + userService.addUserToLessonplan(usr, lessonMapping); // saving lessonPaln data + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Lessonplan/"+lessonId+"/"; // path to store lesson Plan + + ServiceUtility.createFolder(createFolder); + + path1=ServiceUtility.uploadFile(lesson, createFolder); // uploading lesson plan to path given + + int indexToStart=path1.indexOf("Media"); // extract path starting from MEDIA to persist . + String path=path1.substring(indexToStart, path1.length()); + + LessonPlan lessonTemp=lessonService.findById(lessonId); + lessonTemp.setLessonPlan(path); + + lessonService.save(lessonTemp); + + mv.addObject("statusAdd", "Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + LessonPlan lessonTemp=lessonService.findById(lessonId); + lessonService.deleteLessonPlan(lessonTemp); + mv.addObject("failure", "Please Try Again"); + + } + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.addObject("lessonStatus", "Added Successfully"); + + mv.setViewName("lessonPlan"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + + return mv; + + } + + + /** + * Adds Document resource to app from Teacher's Role + * @param req HttpServletRequest object + * @param document File to be uploaded + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + // method to add Document into database + @RequestMapping(value="/conDocument/addDocument",method = RequestMethod.POST) + public ModelAndView addDocumentPost(HttpServletRequest req,@RequestParam(name="Question")MultipartFile[] document,Principal principal,ModelAndView mv) { + + String path1=null; + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String source=req.getParameter("source"); + + if(!ServiceUtility.checkFileExtensionPDF(document) && !ServiceUtility.checkFileExtensionImage(document)) { // validation against PDF document + mv.addObject("fileError", "File must be a PDF or JPEG/JPG/PNG"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("document"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + if(document[0].getSize()>fileSize) { + + mv.addObject("fileError", "FileSize must be within 10MB"); + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("document"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + } + + int documentId=documentService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); // retrieving class modal + Subject localSubject=subjectService.findBysubName(subjectName); // retrieving subject modal + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); // retrieving subject class mapping from class and subject + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); // retrieving topic from sucject class mapping + + + User usr=userService.findByUsername(principal.getName()); // retrieving the logged USer + + Set documentMapping=new HashSet(); + documentMapping.add(new DocumentExternal(documentId, "Document", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, "null", 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToDocument(usr, documentMapping); // saving document data into database. + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+className+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Document/"+documentId+"/"; // PATH TO SAVE DOCUMENT UNDER TOPIC + + ServiceUtility.createFolder(createFolder); + + path1=ServiceUtility.uploadFile(document, createFolder); // upload file to path mentioned + + int indexToStart=path1.indexOf("Media"); // extracting path starting from MEDIA to save in database + String path=path1.substring(indexToStart, path1.length()); + + DocumentExternal docuTemp=documentService.findByid(documentId); + docuTemp.setUrl(path); + + documentService.save(docuTemp); + + mv.addObject("statusAdd", "Document Added Successfully"); + + } catch (Exception e) { + + e.printStackTrace(); + DocumentExternal documentTemp=documentService.findByid(documentId); + documentService.deleteDocuemnt(documentTemp); + mv.addObject("failure", "Please Try Again"); + } + + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + mv.setViewName("document"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + + // method to add Article entry into database + /** + * Adds Article resource to app from Teacher's Role + * @param req HttpServletRequest object + * @param principal A principal object + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(value="/conArticle/addArticle",method = RequestMethod.POST) + public ModelAndView addArtcilePost(HttpServletRequest req,Principal principal,ModelAndView mv) { + + String className=req.getParameter("classSelected"); // taking out various information given by user in view. + String subjectName=req.getParameter("subjectSelected"); + String topicName=req.getParameter("topicSelected"); + String desc=req.getParameter("description"); + String url=req.getParameter("url"); + String source=req.getParameter("source"); + + if(!url.startsWith("http")) { // validation against proper Url given against artcile file. + + mv.addObject("fileError","Path specified isn't correct"); + + ArrayList classExist=(ArrayList) classService.findAll(); + + mv.addObject("classExist", classExist); + + mv.setViewName("article"); + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + int articleId=articleService.countRow()+1; + try { + + Class localClass=classService.findByClassName(Integer.parseInt(className)); // fetching class tuple based on given data + Subject localSubject=subjectService.findBysubName(subjectName); // fetching Subject tuple based on given data + SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); // fetching Subject Class mapping tuple based on class and subject + Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicName); // fetching topic tuple based on given data subject class mapping. + + User usr=userService.findByUsername(principal.getName()); // logged in user details. + Set articlemapping=new HashSet(); + articlemapping.add(new ArticleExternal(articleId, "Article", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, url, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); + + userService.addUserToArticle(usr, articlemapping); // saving the article information into database. + + mv.addObject("statusAdd", "Added Successfully"); // setting status for view(success) + + } catch (Exception e) { + + e.printStackTrace(); + ArticleExternal tempArticle=articleService.findByid(articleId); + articleService.deleteArticle(tempArticle); + mv.addObject("failure", "Please try Again Later"); // setting status for view(failure) + + } + + + ArrayList classExist=(ArrayList) classService.findAll(); // fetching out the available list of class from database. + + mv.addObject("classExist", classExist); // setting variable for view for displaying purpose + + + mv.setViewName("article"); // setting view name + + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + return mv; + + } + + +} diff --git a/src/main/java/com/adminportal/HomeController.java b/src/main/java/com/adminportal/HomeController.java new file mode 100644 index 0000000..368697e --- /dev/null +++ b/src/main/java/com/adminportal/HomeController.java @@ -0,0 +1,1379 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This HomeController Class mainly deal with url which will caught from USer side like + * 1. initial Page or index page + * 2. Login Page + * 3. Singup Page + * 4. User Authentication (Not for Admin) + * 5. course information + * 6. content information + */ + +package com.adminportal; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.Principal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +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.UUID; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.validation.Valid; + +import org.apache.logging.log4j.Logger; +import org.aspectj.weaver.patterns.TypePatternQuestions.Question; +import org.hibernate.annotations.Loader; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.HttpRequest; +import org.springframework.mail.MailException; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +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.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.SessionAttributes; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; + +import com.adminportal.config.MailConstructor; +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.Events; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Testimonial; +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.RoleDetail; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; +import com.adminportal.repository.EventsRepository; +import com.adminportal.service.ArticleExternalService; +import com.adminportal.service.ClassService; +import com.adminportal.service.ConceptMapService; +import com.adminportal.service.DocumentExternalService; +import com.adminportal.service.EventService; +import com.adminportal.service.LessonPlanService; +import com.adminportal.service.PhetsService; +import com.adminportal.service.QuizQuestionService; +import com.adminportal.service.RoleDetailService; +import com.adminportal.service.SubjectClassService; +import com.adminportal.service.SubjectService; +import com.adminportal.service.TestimonialService; +import com.adminportal.service.TopicService; +import com.adminportal.service.TutorialService; +import com.adminportal.service.UserService; +import com.adminportal.service.VideoExternalService; +import com.spoken.Utility.ServiceUtility; +import com.spoken.Utility.TutorialList; + +/** + * This Controller Class handles generic redirecting of url + * @author om prakash + * + */ +@Controller +public class HomeController { + + /** + * Path to save resources + */ + public static final String uploadDirectory = "Media/content/"; // Path to save resources + /** + * path to save Teacher Document + */ + public static final String uploadTeacherDirectory = "Media/User/"; // path to save teacher Document + /** + * Path to save event's image + */ + public static final String uploadEvent="Media/Event/"; // path to sabe event images + /** + * Path to save Testimonial data + */ + public static final String uploadTestimonial="Media/Testimonial/"; + + @Autowired + private ClassService classService; + + @Autowired + private SubjectClassService subjectClassService; + + @Autowired + private SubjectService subjectService; + + @Autowired + private TopicService topicService; + + @Autowired + private UserService userService; + + @Autowired + private ArticleExternalService articleService; + + @Autowired + private DocumentExternalService documentService; + + @Autowired + private LessonPlanService lessonService; + + @Autowired + private PhetsService phetService; + + @Autowired + private QuizQuestionService quizService; + + @Autowired + private VideoExternalService videoService; + + @Autowired + private RoleDetailService roleService; + + @Autowired + private TestimonialService testiService; + + @Autowired + private EventService eventService; + + @Autowired + private ConceptMapService conceptMapService; + + @Autowired + private TutorialService tutorialService; + + @Autowired + private JavaMailSender mailSender; + + @Autowired + private MailConstructor mailConstructor; + + @Autowired + private EventsRepository evenRepo; + + /* + * @Autowired HttpServletRequest req; + */ + /* + * ------------------------------------------HOME + * PAGE------------------------------------------------- + */ + + /** + * Redirect to Homepage of application + * @param headers Map Object + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping("/") + public ModelAndView home(@RequestHeader Map headers,ModelAndView mv,Principal principal) { + + /* + * headers.forEach((key,value)->{ + * System.out.println("Header Name: "+key+" Header Value: "+value); }); + * + * System.out.println(req.getRemoteAddr()); + */ + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + ArrayList standard = (ArrayList) classService.findAll(); + + ArrayList subject = (ArrayList) subjectService.findAll(); + + List testidata = testiService.getAlltestimonial(); + + List eventData = eventService.getAllEventdata(); + + if (testidata.size() > 0) { + + List temp2 = new ArrayList(); + for (int i = 0; i < testidata.size(); i++) { + temp2.add(testidata.get(i)); + if(i==2) + break; + } + + mv.addObject("TestimonialRest", temp2); + + } + + if (eventData.size() > 0) { + + List eventTemp = new ArrayList(); + eventTemp.add(eventData.get(0)); + for (int i = 1; i < eventData.size(); i++) { + eventTemp.add(eventData.get(i)); + if(i==3) { + break; + } + } + + mv.addObject("Events", eventTemp); + } + + mv.addObject("classfromDatabase", standard); + mv.addObject("subjectfromDatabase", subject); + + mv.setViewName("Index"); + return mv; + } + + /** + * Redirect to About-us page in application + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/About-Us", method = RequestMethod.GET) + public ModelAndView aboutUsSection(ModelAndView mv, Principal principal) { + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + } + + mv.setViewName("about"); + + return mv; + + } + + + /******************************* + * dASHBOARD FOR CONTRIBUTOR + ********************************************/ + + /** + * redirect to Dashboard of User + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/dashBoard", method = RequestMethod.GET) + public ModelAndView contributorDashBoard(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + mv.setViewName("user"); + + return mv; + } + + /** + * + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conVideo", method = RequestMethod.GET) + public ModelAndView contributorDashBoardVideo(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + + mv.setViewName("video"); + + return mv; + } + + /** + * Redirect Teacher user to add Concept Map page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conConceptMap", method = RequestMethod.GET) + public ModelAndView contributorDashBoardConceptMap(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + + mv.setViewName("conceptMap"); + + return mv; + } + + /** + * Redirect Teacher user to add Quiz page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conQuiz", method = RequestMethod.GET) + public ModelAndView contributorDashBoardQuiz(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + mv.setViewName("quiz"); + + return mv; + } + + /** + * Redirect Teacher user to add Article page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conArticle", method = RequestMethod.GET) + public ModelAndView contributorDashBoardArticle(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + mv.setViewName("article"); + + return mv; + } + + /** + * Redirect Teacher user to add LessonPlan page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conLessonPlan", method = RequestMethod.GET) + public ModelAndView contributorDashBoardLessonPlan(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + mv.setViewName("lessonPlan"); + + return mv; + } + + /** + * Redirect Teacher user to add Document page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conDocument", method = RequestMethod.GET) + public ModelAndView contributorDashBoardDocument(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + mv.setViewName("document"); + + return mv; + } + + /** + * Redirect Teacher user to add Phet page + * @param mv ModelAndView object + * @param principal Principal object + * @return + */ + @RequestMapping(value = "/conPhet", method = RequestMethod.GET) + public ModelAndView contributorDashBoardPhet(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classExist", standard); + mv.setViewName("phets"); + + return mv; + } + + /** + * Redirect Teacher user to view all his/her added resources + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/conView", method = RequestMethod.GET) + public ModelAndView contributorDashBoardStatus(ModelAndView mv, Principal principal) { + + User localUser = userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser", localUser); + + List localQuiz = quizService.findALlByUser(localUser); + List localArticle = articleService.findALlByUser(localUser); + List localDocument = documentService.findALlByUser(localUser); + List localLesson = lessonService.findALlByUser(localUser); + List localvideo = videoService.findALlByUser(localUser); + List localPhets = phetService.findALlByUser(localUser); + List localConcept = conceptMapService.findALlByUser(localUser); + + if (localQuiz.isEmpty()) { + mv.addObject("QuizError", "Nothing To Show"); + } + + if (localArticle.isEmpty()) { + ; + mv.addObject("ArticleError", "Nothing To Show"); + } + + if (localDocument.isEmpty()) { + mv.addObject("DocumentError", "Nothing To Show"); + } + + if (localLesson.isEmpty()) { + mv.addObject("LessonError", "Nothing To Show"); + } + + if (localvideo.isEmpty()) { + mv.addObject("VideoError", "Nothing To Show"); + } + + if (localPhets.isEmpty()) { + mv.addObject("PhetError", "Nothing To Show"); + } + + if (localPhets.isEmpty()) { + mv.addObject("ConceptError", "Nothing To Show"); + } + + mv.addObject("QuizOnUser", localQuiz); + mv.addObject("VideoOnUser", localvideo); + mv.addObject("ArticleOnUser", localArticle); + mv.addObject("DocumentOnUser", localDocument); + mv.addObject("LessonOnUser", localLesson); + mv.addObject("PhetOnUser", localPhets); + mv.addObject("ConceptOnUser", localConcept); + + mv.setViewName("contentView"); + + return mv; + } + + /**************************************** + * END + **************************************************/ + + + +//------------------------------------------LOGIN HYPERLINK-------------------------------------------------------------------- + + /** + * redirect to Login Page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping("/Login") + public ModelAndView login(ModelAndView mv,Principal principal) { + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("accessDeniedPage"); + return mv; + + } + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + mv.setViewName("Login"); + return mv; + } + +//---------------------------------------------END-------------------------------------------------------------------- + +//------------------------------------------- FORGET PASSWORD -------------------------------------------------------- + + /** + * redirect to forget password page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping("/forgetPassword") + public ModelAndView forgetPasswordGet(ModelAndView mv,Principal principal) { + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("accessDeniedPage"); + return mv; + } + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + mv.setViewName("forgetPassword"); + return mv; + + } + + /*------------------- FORGET PASSWORD TAKIN REQUEST FROM VIEW -----------------------------------------*/ + + /** + * Generate Random token for user to change password + * @param req HttpServletRequest object + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/forgetPassword", method = RequestMethod.POST) + public ModelAndView forgetPasswordPost(HttpServletRequest req, ModelAndView mv,Principal principal) { + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("accessDeniedPage"); + return mv; + } + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + String userEmail = req.getParameter("username"); + + User usr = userService.findByUsername(userEmail); + if (usr == null) { + mv.addObject("Error", "E-mail doesn't Exist"); + mv.setViewName("forgetPassword"); + return mv; + } + + try { + String token = UUID.randomUUID().toString(); + usr.setToken(token); + + userService.save(usr); + + String appUrl = "http://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath(); + System.out.println(appUrl); + SimpleMailMessage newEmail = mailConstructor.constructResetTokenEmail(appUrl, req.getLocale(), token, usr); + + mailSender.send(newEmail); + + mv.addObject("Success", "Link to reset password has been sent to your E-mail ID"); + + mv.setViewName("forgetPassword"); + return mv; + } catch (MailException e) { + + e.printStackTrace(); + mv.addObject("Error", "Technical Error"); + + mv.setViewName("forgetPassword"); + return mv; + } + + } + + /*--------------------------- LINK TO WHICH USER WILL SET NEW PASSWORD ----------------------------------*/ + + /** + * redirects to change password page + * @param token Random string + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/reset", method = RequestMethod.GET) + public ModelAndView resetPasswordGet(ModelAndView mv, @RequestParam("token") String token,Principal principal) { + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("accessDeniedPage"); + return mv; + } + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + User usr = userService.findByToken(token); + if (usr == null) { + mv.setViewName("redirect:/"); + return mv; + } + + System.out.println(token); + mv.addObject("resetToken", usr.getToken()); + mv.setViewName("resetPassword"); + return mv; + + } + + /*---------------------------- PERSISTING NEW PASSWORD OF USER ----------------------------------*/ + + /** + * redirect to reset password for user + * @param req HttpServletRequest object + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/resetPassword", method = RequestMethod.POST) + public ModelAndView resetPasswordPost(ModelAndView mv, HttpServletRequest req,Principal principal) { + + String newPassword = req.getParameter("Password"); + String confNewPassword = req.getParameter("Confirm"); + String token = req.getParameter("token"); + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + + mv.setViewName("accessDeniedPage"); + return mv; + } + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + User usr = userService.findByToken(token); + if (usr == null) { + mv.addObject("Error", "Invalid request"); + return mv; + } + + if (!newPassword.contentEquals(confNewPassword)) { + mv.addObject("Error", "Both password doesn't match"); + return mv; + } + + if(newPassword.length()<6) { + mv.addObject("Error", "Password must be atleast 6 character"); + return mv; + } + + usr.setPassword(ServiceUtility.passwordEncoder().encode(newPassword)); + usr.setToken(null); + userService.save(usr); + + mv.addObject("Success", "Password got updated Successfully"); + mv.setViewName("resetPassword"); + return mv; + + } + +//-----------------------------------------END------------------------------------------------------- + +//-----------------------------------------------SIGNUP HYPERLINK------------------------------------------------------------------ + + /** + * redirect to User Registration page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping("/Signup") + public ModelAndView signup(ModelAndView mv,Principal principal) { + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + mv.setViewName("accessDeniedPage"); + return mv; + } + + mv.addObject("checkedOptionLearner", "checked"); + + mv.setViewName("Signup"); + return mv; + + } + +//---------------------------------------------END-------------------------------------------------------------------- + +// ---------------------------------- Event List on USer Side ------------------------------------------ + + /* + * @RequestMapping(value = "/eventsList") public ModelAndView + * viewEvent(ModelAndView mv, @RequestParam(defaultValue = "0") int page) { + * + * // List localEvent=eventService.findAll(); + * + * ArrayList standard = (ArrayList) classService.findAll(); + * + * mv.addObject("classfromDatabase", standard); + * + * ArrayList subjectData = (ArrayList) + * subjectService.findAll(); mv.addObject("subjectfromDatabase", subjectData); + * + * mv.addObject("EventList", evenRepo.findAll(new PageRequest(page, 6))); + * mv.addObject("current", page); mv.setViewName("events"); return mv; } + */ + + /** + * redirect to view all the event data + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/eventsList") + public ModelAndView viewEvent(ModelAndView mv,Principal principal) { + + // List localEvent=eventService.findAll(); + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + + List tempEvent=evenRepo.findAll(); + List prevEvent = new ArrayList<>(); + List futureEvent = new ArrayList<>(); + + for(Events temp:tempEvent) { + + if(!temp.getDateToHappenEnd().before(ServiceUtility.getCurrentTime())) { // future event + prevEvent.add(temp); + + }else { + futureEvent.add(temp); + + } + } + + mv.addObject("PrevEventList", prevEvent); + mv.addObject("FutureEventList", futureEvent); + + mv.setViewName("events"); + return mv; + } + + /************************************************ + * START OF CONTROLLER FOR USER SIDE + ***********************************************************/ + + // COURSES PAGE BASED ON SELECTION OF CLASS AND SUBJECT + + /** + * Redirect to course Page based on class, subject and topic name + * @param req HttpServletRequest object + * @param subject subject name + * @param classSelected class name + * @param topicSelected topic name + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(value = "/courses", method = RequestMethod.GET) + public ModelAndView viewCoursesAvailable(HttpServletRequest req, + @RequestParam(name = "subjectSelected") String subject, + @RequestParam(name = "classSelected") String classSelected, + @RequestParam(name = "topicSelected") String topicSelected,ModelAndView mv,Principal principal) { + /* System.out.println("test"+subject); */ + Class localClass = null; + + Subject localSubject = null; + SubjectClassMapping localSubjectClassMapping; + List localTopictemp = null; + Topic singleTopic=null; + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + + + + try { + + if(!topicSelected.contentEquals("Select Topic")) { + + singleTopic=topicService.findById(Integer.parseInt(topicSelected)); + + mv.setViewName("redirect:contentTutorial/"+singleTopic.getTopicId()); + return mv; + } + + else if (subject.contentEquals("Select Subject") && classSelected.contentEquals("Select Class")) { + localTopictemp = topicService.findAll(); + System.out.println("all value"); + + } + + else if (subject.contentEquals("Select Subject") && !classSelected.contentEquals("Select Class")) { + System.out.println("wow"); + localClass = classService.findByClassName(Integer.parseInt(classSelected.substring(6))); + List tempLocalSubjectClassMapping = subjectClassService + .getClassFromMapping(localClass); + localTopictemp = topicService.findBySubjectClassMppaing(tempLocalSubjectClassMapping); + + } else if (!subject.contentEquals("Select Subject") && classSelected.contentEquals("Select Class")) { + localSubject = subjectService.findBySubjectName(subject); + List tempLocalSubjectClassMapping = subjectClassService + .getClassFromSubject(localSubject); + localTopictemp = topicService.findBySubjectClassMppaing(tempLocalSubjectClassMapping); + + } else if (!subject.contentEquals("Select Subject") && !classSelected.contentEquals("Select Class")) { + localClass = classService.findByClassName(Integer.parseInt(classSelected.substring(6))); + + localSubject = subjectService.findBySubjectName(subject); + + localSubjectClassMapping = subjectClassService.findBysubAndstandard(localClass, localSubject); + + localTopictemp = topicService.findBysubjectclassMapping(localSubjectClassMapping); + + } + } catch (Exception e) { + e.printStackTrace(); + + mv.setViewName("redirect:/"); + + return mv; + + } + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + List localTopic = new ArrayList(); + for (Topic temp : localTopictemp) { + if (temp.getStatus() == 1 && temp.getSubjectClassMapping().isStatus() && temp.getSubjectClassMapping().getSub().isStatus() && temp.getSubjectClassMapping().getStandard().isStatus()) { + localTopic.add(temp); + } + } + + if (!localTopic.isEmpty()) { + mv.addObject("TopicListOnSubjectClass", localTopic); + } else { + mv.addObject("NoTopicAvailable", "No Content Available to Show"); + } + + if (localSubject != null) { + mv.addObject("subjectSelected", localSubject.getSubName()); + } + + if (localClass != null) { + mv.addObject("classSelected", localClass.getClassName()); + } + + mv.setViewName("Courses"); + + return mv; + } + + /****** + * CONTENT PAGE BASED ON CLASS SUBJECT AND TOPIC------------------------------- + */ + + /** + * Shows Spoken Tutorial Content based on Topic ID + * @param topicId Topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/contentTutorial/{topicId}", method = RequestMethod.GET) + public ModelAndView viewTutorialOnTopic(@PathVariable("topicId") int topicId, ModelAndView mv) { + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + Topic localTopic = topicService.findById(topicId); + + if(localTopic.getStatus()==0) { + + mv.setViewName("redirect:/"); + return mv; + + } + + List localTutorial = tutorialService.findAllByTopicAndStatus(localTopic); + + List tutorialListData = new ArrayList(); + + for (Tutorial localTemp : localTutorial) { + + try { + String url = "https://spoken-tutorial.org/api/get_tutorialdetails/" + localTemp.getStVideoId() + "/"; + RestTemplate restTemp = new RestTemplate(); + TutorialList localTut = restTemp.getForObject(url, TutorialList.class); + + System.out.println(localTut.getTut_name()); + + tutorialListData.add(localTut); + } catch (RestClientException e) { + + e.printStackTrace(); + } + } + + if (tutorialListData.isEmpty()) { + mv.addObject("TutorialError", "Nothing To Show"); + } + + mv.addObject("TutorialOnTopic", tutorialListData); + + mv.addObject("subjectSelected", localTopic.getSubjectClassMapping().getSub().getSubName()); + mv.addObject("classSelected", localTopic.getSubjectClassMapping().getStandard().getClassName()); + mv.addObject("TopicSelected", localTopic); + mv.setViewName("contentTutorial"); + return mv; + } + + /** + * Shows Link Content based on Topic ID + * @param topicId Topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/contentLink/{topicId}", method = RequestMethod.GET) + public ModelAndView viewLinksOnTopic(@PathVariable("topicId") int topicId, ModelAndView mv) { + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + Topic localTopic = topicService.findById(topicId); + + if(localTopic.getStatus()==0) { + + mv.setViewName("redirect:/"); + return mv; + + } + + List localArticle = articleService.findAllByTopicAndStatus(localTopic); + List localDocument = documentService.findAllByTopicAndStatus(localTopic); + List localvideo = videoService.findAllByTopicAndStatus(localTopic); + + if (localArticle.isEmpty()) { + ; + mv.addObject("ArticleError", "Nothing To Show"); + } + + if (localDocument.isEmpty()) { + mv.addObject("DocumentError", "Nothing To Show"); + } + + if (localvideo.isEmpty()) { + mv.addObject("VideoError", "Nothing To Show"); + } + + mv.addObject("VideoOnTopic", localvideo); + mv.addObject("ArticleOnTopic", localArticle); + mv.addObject("DocumentOnTopic", localDocument); + + mv.addObject("subjectSelected", localTopic.getSubjectClassMapping().getSub().getSubName()); + mv.addObject("classSelected", localTopic.getSubjectClassMapping().getStandard().getClassName()); + mv.addObject("TopicSelected", localTopic); + mv.setViewName("contentLinks"); + return mv; + } + + /** + * Shows LessonPlan Content based on Topic ID + * @param topicId Topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/contentLesson/{topicId}", method = RequestMethod.GET) + public ModelAndView viewLessonPlanlOnTopic(@PathVariable("topicId") int topicId, ModelAndView mv) { + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + Topic localTopic = topicService.findById(topicId); + + if(localTopic.getStatus()==0) { + + mv.setViewName("redirect:/"); + return mv; + + } + + List localLesson = lessonService.findAllByTopicAndStatus(localTopic); + + if (localLesson.isEmpty()) { + mv.addObject("LessonError", "Nothing To Show"); + } + + mv.addObject("LessonOnTopic", localLesson); + + mv.addObject("subjectSelected", localTopic.getSubjectClassMapping().getSub().getSubName()); + mv.addObject("classSelected", localTopic.getSubjectClassMapping().getStandard().getClassName()); + mv.addObject("TopicSelected", localTopic); + mv.setViewName("contentLessonPlan"); + return mv; + } + + /** + * Shows Phet Content based on Topic ID + * @param topicId Topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/contentPhet/{topicId}", method = RequestMethod.GET) + public ModelAndView viewPhetOnTopic(@PathVariable("topicId") int topicId, ModelAndView mv) { + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + Topic localTopic = topicService.findById(topicId); + + if(localTopic.getStatus()==0) { + + mv.setViewName("redirect:/"); + return mv; + + } + + List localPhets = phetService.findAllByTopicAndStatus(localTopic); + + if (localPhets.isEmpty()) { + mv.addObject("PhetError", "Nothing To Show"); + } + + mv.addObject("PhetOnTopic", localPhets); + + mv.addObject("subjectSelected", localTopic.getSubjectClassMapping().getSub().getSubName()); + mv.addObject("classSelected", localTopic.getSubjectClassMapping().getStandard().getClassName()); + mv.addObject("TopicSelected", localTopic); + mv.setViewName("contentPhet"); + return mv; + } + + /** + * Shows Quiz Content based on Topic ID + * @param topicId Topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/contentQuiz/{topicId}", method = RequestMethod.GET) + public ModelAndView viewQuizOnTopic(@PathVariable("topicId") int topicId, ModelAndView mv) { + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + Topic localTopic = topicService.findById(topicId); + + if(localTopic.getStatus()==0) { + + mv.setViewName("redirect:/"); + return mv; + + } + List localQuiz = quizService.findAllByTopicAndStatus(localTopic); + + if (localQuiz.isEmpty()) { + mv.addObject("QuizError", "Nothing To Show"); + } + + mv.addObject("QuizOnTopic", localQuiz); + + mv.addObject("subjectSelected", localTopic.getSubjectClassMapping().getSub().getSubName()); + mv.addObject("classSelected", localTopic.getSubjectClassMapping().getStandard().getClassName()); + mv.addObject("TopicSelected", localTopic); + mv.setViewName("contentQuiz"); + return mv; + } + + /** + * Shows ConceptMap Content based on Topic ID + * @param topicId Topic ID + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/contentConcept/{topicId}", method = RequestMethod.GET) + public ModelAndView viewContentonTopic(@PathVariable("topicId") int topicId, ModelAndView mv) { + + ArrayList standard = (ArrayList) classService.findAll(); + mv.addObject("classfromDatabase", standard); + + ArrayList subjectData = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subjectData); + + Topic localTopic = topicService.findById(topicId); + + if(localTopic.getStatus()==0) { + + mv.setViewName("redirect:/"); + return mv; + + } + + List localConcept = conceptMapService.findAllByTopicAndStatus(localTopic); + + if (localConcept.isEmpty()) { + mv.addObject("ConceptError", "Nothing To Show"); + } + + mv.addObject("ConceptOnTopic", localConcept); + + mv.addObject("subjectSelected", localTopic.getSubjectClassMapping().getSub().getSubName()); + mv.addObject("classSelected", localTopic.getSubjectClassMapping().getStandard().getClassName()); + mv.addObject("TopicSelected", localTopic); + mv.setViewName("contentConceptMap"); + return mv; + } + + + + /************************************** Testimonial Page *****************************************************/ + /** + * redirect to Testimonial Page + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(path = "testimonials", method = RequestMethod.GET) + public ModelAndView testimonialPage(ModelAndView mv,Principal principal) { + + List textTestimonial=new ArrayList<>(); + List mediaTestimonial=new ArrayList<>(); + List fileTestimonial=new ArrayList<>(); + List localTestimonial=testiService.findAll(); + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + for(Testimonial temp:localTestimonial) { + if(temp.getVideoPath() != null) { + + mediaTestimonial.add(temp); + }else if(temp.getFilePath() !=null){ + + fileTestimonial.add(temp); + }else { + textTestimonial.add(temp); + } + } + + mv.addObject("textTestimonial",textTestimonial); + mv.addObject("mediaTestimonial",mediaTestimonial); + mv.addObject("fileTestimonial",fileTestimonial); + mv.addObject("textActive","active"); + mv.setViewName("testimonial"); + return mv; + } + + /** + * redirect to logout Page + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/logout-success" ,method = RequestMethod.GET) + public ModelAndView logout(ModelAndView mv) { + + mv.setViewName("logout"); + return mv; + + } + + /** + * redirect to forbidden error page + * @param mv ModelAndView object + * @return ModelAndView object + */ + @RequestMapping(path = "/accessDenied" ,method = RequestMethod.GET) + public ModelAndView accessDenied(ModelAndView mv) { + + mv.setViewName("accessDeniedPage"); + return mv; + + } + + /** + * redirect page to display courses based on Class name + * @param classId name of class in integer + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(path = "/topicOnClass/{classID}", method = RequestMethod.GET) + public ModelAndView viewTopicOnClass(@PathVariable("classID") int classId, ModelAndView mv,Principal principal) { + + Class localClass; + List localTopictemp = null; + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + try { + localClass=classService.findByClassName(classId); + List tempLocalSubjectClassMapping = subjectClassService + .getClassFromMapping(localClass); + localTopictemp = topicService.findBySubjectClassMppaing(tempLocalSubjectClassMapping); + List localTopic = new ArrayList(); + for (Topic temp : localTopictemp) { + if (temp.getStatus() == 1) { + localTopic.add(temp); + } + } + + if (!localTopic.isEmpty()) { + mv.addObject("TopicListOnSubjectClass", localTopic); + } else { + mv.addObject("NoTopicAvailable", "No Content Available to Show"); + } + + mv.addObject("classSelected", localClass.getClassName()); + + + } catch (Exception e) { + e.printStackTrace(); + mv.setViewName("redirect:/"); + return mv; + + } + + + mv.setViewName("Courses"); + return mv; + } + + /** + * redirect page to display courses based on subject name + * @param SubName name of subject + * @param mv ModelAndView object + * @param principal Principal object + * @return ModelAndView object + */ + @RequestMapping(path = "/topicOnSubject/{subName}", method = RequestMethod.GET) + public ModelAndView viewTopicOnSubject(@PathVariable("subName") String SubName, ModelAndView mv,Principal principal) { + Subject localSubject; + List localTopictemp = null; + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + try { + localSubject=subjectService.findBySubjectName(SubName); + List tempLocalSubjectClassMapping = subjectClassService + .getClassFromSubject(localSubject); + localTopictemp = topicService.findBySubjectClassMppaing(tempLocalSubjectClassMapping); + List localTopic = new ArrayList(); + for (Topic temp : localTopictemp) { + if (temp.getStatus() == 1) { + localTopic.add(temp); + } + } + + if (!localTopic.isEmpty()) { + mv.addObject("TopicListOnSubjectClass", localTopic); + } else { + mv.addObject("NoTopicAvailable", "No Content Available to Show"); + } + + mv.addObject("subjectSelected", localSubject.getSubName()); + + + } catch (Exception e) { + e.printStackTrace(); + mv.setViewName("redirect:/"); + return mv; + + } + + + mv.setViewName("Courses"); + return mv; + } + + + /*--------------------------------------------------------END----------------------------------------------------------------------------------*/ +} diff --git a/src/main/java/com/adminportal/HomeControllerRest.java b/src/main/java/com/adminportal/HomeControllerRest.java new file mode 100644 index 0000000..c2473cd --- /dev/null +++ b/src/main/java/com/adminportal/HomeControllerRest.java @@ -0,0 +1,3527 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.Principal; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.validation.Valid; + +import org.apache.tomcat.jni.File; +import org.hibernate.mapping.Array; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import org.w3c.dom.ls.LSInput; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.ContactForm; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.Events; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Testimonial; +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.RoleDetail; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; +import com.adminportal.repository.ClassRepository; +import com.adminportal.repository.ContactFormRepository; +import com.adminportal.repository.SubjectClassMappingRepository; +import com.adminportal.repository.SubjectRepository; +import com.adminportal.repository.TopicRepository; +import com.adminportal.service.ArticleExternalService; +import com.adminportal.service.ClassService; +import com.adminportal.service.CommentReplyService; +import com.adminportal.service.CommentService; +import com.adminportal.service.ConceptMapService; +import com.adminportal.service.DocumentExternalService; +import com.adminportal.service.EventService; +import com.adminportal.service.LessonPlanService; +import com.adminportal.service.PhetsService; +import com.adminportal.service.QuizQuestionService; +import com.adminportal.service.SubjectClassService; +import com.adminportal.service.SubjectService; +import com.adminportal.service.TestimonialService; +import com.adminportal.service.TopicService; +import com.adminportal.service.TutorialService; +import com.adminportal.service.UserService; +import com.adminportal.service.VideoExternalService; +import com.spoken.Utility.CommentAjaxQueryResolver; +import com.spoken.Utility.CommentReplyAjaxQueryResolver; +import com.spoken.Utility.LoadUserLearner; +import com.spoken.Utility.ServiceUtility; +import com.spoken.Utility.SubjectAjaxQueryResolver; +import com.spoken.Utility.SubjectClassAjaxQueryResolver; +import com.spoken.Utility.passwordUpdateAjaxQueryResolver; + +import antlr.debug.Event; + +/** + * This rest controller handles all the ajax call made in application. + * @author om prakash + * + */ +@RestController +public class HomeControllerRest { + + /** + * path to save resource + */ + public static String uploadDirectory="Media/content/"; + /** + * path to save Event Data + */ + public static final String uploadEvent="Media/Event/"; + /** + * Maximum file Size + */ + public static final long fileSize=10*1024*1024; + + /** + * Maximum video file Size + */ + public static final long videoSize=50*1024*1024; + + /** + * + */ + public static String deleteDirectory=""; + + @Autowired + private ClassService classService; + + @Autowired + private SubjectClassService subjectClassService; + + @Autowired + private SubjectService subjectService; + + + @Autowired + private TopicService topicService; + + @Autowired + private UserService userService; + + @Autowired + private QuizQuestionService quizService; + + @Autowired + private VideoExternalService videoService; + + @Autowired + private ArticleExternalService articleService; + + @Autowired + private DocumentExternalService docuService; + + @Autowired + private PhetsService phetServcie; + + @Autowired + private CommentService comService; + + @Autowired + private LessonPlanService lessonService; + + @Autowired + private CommentReplyService comReplyService; + + @Autowired + private ContactFormRepository contactFormService; + + @Autowired + private TestimonialService testiService; + + @Autowired + private EventService eventService; + + @Autowired + private ConceptMapService concepMapService; + + @Autowired + private TutorialService tutorialService; + + @Autowired + private Environment env; + + /** + * Get method to Count number of resource added inside a particular topic + * @param topicId Topic ID + * @return number of resource + */ + @GetMapping("/countResourceFromTopic") + public @ResponseBody int countResourceFromTopic(int topicId){ + + Topic tempTopic=topicService.findById(topicId); + int TotalResource=articleService.countTotalResource(tempTopic); + return TotalResource; + + + } + + /** + * Get method to Count number of resource added inside a particular topic based on subject name + * @param subId subject ID + * @return number of resource + */ + @GetMapping("/countResourceFromSubject") + public @ResponseBody int countResourceFromSubject(int subId){ + + List tempTopic=null; + try { + Subject subTemp=subjectService.findById(subId); + List subClassMapp=subjectClassService.getClassFromSubject(subTemp); + if(!subClassMapp.isEmpty()) { + tempTopic=topicService.findBySubjectClassMppaing(subClassMapp); + } + + int totalResource=articleService.countTotalResource(tempTopic); + return totalResource; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return -1; + } + + + + } + + /** + * Get method to Count number of resource added inside a particular topic based on Class name + * @param classId class ID + * @return number of resource + */ + @GetMapping("/countResourceFromClass") + public @ResponseBody int countResourceFromClass(int classId){ + + List tempTopic=null; + List subClassMapp=null; + try { + Class classTemp=classService.findByClassName(classId); + subClassMapp=subjectClassService.getSubjectFromClass(classTemp); + if(!subClassMapp.isEmpty()) { + tempTopic=topicService.findBySubjectClassMppaing(subClassMapp); + } + int totalResource=articleService.countTotalResource(tempTopic); + return totalResource; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return -1; + } + + + } + + /*------------------------------------UPDATING USER FIRST AND LAST NAME-------------------------------------*/ + /** + * Get method to update User Details + * @param fname first name of user to be updated + * @param lname last name of the user to be updated + * @param principal Principal Object + * @return Boolean value based on successful or failure of operation ? + */ + @GetMapping("/updateUserDetails") + public @ResponseBody boolean updateUserInfo(String fname,String lname,Principal principal){ + + User usrTemp=userService.findByUsername(principal.getName()); + boolean updateStatus=userService.updateUserDetails(fname, lname, usrTemp.getId()); + if(updateStatus) { + return true; + }else { + return false; + } + + + } + + /** + * Enable/Disable Class given Class ID + * @param class_id Class Id + * @return Boolean value based on successful or failure of operation ? + */ + @GetMapping("/enableDisableClass") + public @ResponseBody boolean enableDisableClass(int class_id){ + Class classTemp=null; + List subjectClassMapping=null; + + try { + classTemp=classService.findByClassName(class_id); + subjectClassMapping=subjectClassService.getSubjectFromClass(classTemp); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return false; + } + + if(classTemp.isStatus()) { + classTemp.setStatus(false); + classService.save(classTemp); + subjectClassService.updateClassinAllField(false, classTemp); + if(!subjectClassMapping.isEmpty()) { + topicService.disableEnableAllByClassStandard(0, subjectClassMapping); + } + return true; + + }else { + classTemp.setStatus(true); + classService.save(classTemp); + subjectClassService.updateClassinAllField(true, classTemp); + if(!subjectClassMapping.isEmpty()) { + topicService.disableEnableAllByClassStandard(1, subjectClassMapping); + } + return true; + } + + } + + /*--------------------------------- VALIDITY CHECK AGANIST SUBJECT ****************************************/ + /** + * Check status value for subject data + * @param id subject ID + * @return status value of subject + */ + @GetMapping("/loadByValiditySubject") + public @ResponseBody boolean loadByValiditySubject(String id) { + Subject tempSubject=null; + + try { + tempSubject = subjectService.findById(Integer.parseInt(id)); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return tempSubject.isStatus(); + } + + + /*--------------------------------------TAKING CONTACT FORM DATA FROM INDEX PAGE ------------------------------------------------------*/ + /** + * Post method to add User Query Form + * @param contactData ContactForm object + * @return success or failure in List + */ + @PostMapping("/addContactForm") + public @ResponseBody List addContactData(@Valid @RequestBody ContactForm contactData){ + List status=new ArrayList(); + + + + try { + ContactForm addLocal=new ContactForm(); + addLocal.setContactId((int) (contactFormService.count()+1)); + addLocal.setDataAdded(ServiceUtility.getCurrentTime()); + addLocal.setEmail(contactData.getEmail()); + addLocal.setMessage(contactData.getMessage()); + addLocal.setName(contactData.getName()); + + contactFormService.save(addLocal); + status.add("Success"); + + } catch (Exception e) { + + status.add("Failure"); + e.printStackTrace(); + } + + + + return status; + } + + + + + /*-----------------------------------------------------END------------------------------------------------------------------------------*/ + + /*---------------------------------------------LOADING DATA INTO MODAL FROM TESTIMIONIAL ID -----------------------------------------------*/ + + /** + * Post method to load Testimonial data + * @param localdata Testimonial object + * @return Testimonial object + */ + @PostMapping("/loadByTestimonialID") + public @ResponseBody Testimonial loadByTestimonial(@Valid @RequestBody Testimonial localdata) { + + Testimonial temp=testiService.getbyId(localdata.getTestimonialId()); + + return temp; + + } + + /** + * Post method to load event data + * @param localdata Events object + * @return Events Object + */ + @PostMapping("/loadByEventID") + public @ResponseBody Events loadByevent(@Valid @RequestBody Events localdata) { + + Events temp=eventService.getbyid(localdata.getEventId()); + + return temp; + + } + + /** + * Post method to update testimonial data + * @param localdata Testimonial object + * @return success or failure in List + */ + @PostMapping("/updateTestimonial") + public @ResponseBody List updateTestimonial(@Valid @RequestBody Testimonial localdata){ + + List status=new ArrayList(); + + Testimonial tempTest=testiService.getbyId(localdata.getTestimonialId()); + String name; + String desc; + String org; + + if(localdata.getName().isEmpty()) { + name=tempTest.getName(); + }else { + name=localdata.getName(); + } + + if(localdata.getOrganization().isEmpty()) { + org=tempTest.getOrganization(); + }else { + org=localdata.getOrganization(); + } + + if(localdata.getDescription().isEmpty()) { + desc=tempTest.getDescription(); + }else { + desc=localdata.getDescription(); + } + + try { + boolean result=testiService.updateTestimonial(name, desc, org, tempTest.getTestimonialId()); + + if(result) { + status.add("Success"); + }else { + status.add("Failure"); + } + + }catch (Exception e) { + status.add("Failure"); + + } + + return status; + + } + + + /** + * Update Event Data + * @param uploadPoster file to be updated + * @param corrdName Coordinator name + * @param eventHead Headline + * @param eventDesc Description + * @param eventId Event ID + * @param starttemp Start date + * @param endtemp End date + * @param regStarttemp registration start date + * @param regEndtemp registration end date + * @return success or failure in List + * @throws Exception + */ + @PostMapping("/updateEvent") + public @ResponseBody List updateEvent(@RequestParam("poster") MultipartFile[] uploadPoster,@RequestParam("eventCoordName") String corrdName,@RequestParam("eventHead") String eventHead,@RequestParam("eventDesc") String eventDesc,@RequestParam("eventId") String eventId, + @RequestParam("startDate") String starttemp, + @RequestParam("endDate") String endtemp, + @RequestParam("regStartDate") String regStarttemp, + @RequestParam("regEndDate") String regEndtemp) throws Exception{ + + List status=new ArrayList(); + + Events localEvent=eventService.getbyid(Integer.parseInt(eventId)); + String headline; + String desc; + java.sql.Date startdate; + java.sql.Date enddate; + java.sql.Date regStartdate; + java.sql.Date regEnddate; + boolean fileExist=true; + + if(eventHead.length()>0) { + headline=eventHead; + }else { + headline=localEvent.getHeadline(); + } + + if(eventDesc.length()>0) { + desc=eventDesc; + }else { + desc=localEvent.getDescription(); + } + + try { + if(starttemp.length()>0) { + System.out.println(starttemp); + startdate=ServiceUtility.convertStringToDate(starttemp); + }else { + startdate=localEvent.getDateToHappenStart(); + } + + if(endtemp.length()>0) { + enddate=ServiceUtility.convertStringToDate(endtemp); + }else { + enddate=localEvent.getDateToHappenEnd(); + } + + if(regStarttemp.length()>0) { + regStartdate=ServiceUtility.convertStringToDate(regStarttemp); + }else { + regStartdate=localEvent.getRegistStart(); + } + + if(regEndtemp.length()>0) { + regEnddate=ServiceUtility.convertStringToDate(regEndtemp); + }else { + regEnddate=localEvent.getRegistEnd(); + } + } catch (ParseException e1) { + + e1.printStackTrace(); + status.add("failure"); + return status; + + } + +// if(startdate.before(ServiceUtility.getCurrentTime())) { +// status.add("failure"); +// return status; +// +// } + + if(enddate.before(startdate)) { + status.add("failure"); + return status; + + } + +// if(regStartdate.before(ServiceUtility.getCurrentTime()) ) { +// status.add("failure"); +// return status; +// +// } + + if(regStartdate.after(startdate) || regEnddate.after(startdate) ) { + status.add("failure"); + return status; + + } + + if(regEnddate.before(regStartdate) ) { + status.add("failure"); + return status; + + } + + for(MultipartFile temp:uploadPoster) { + + if(temp.getSize()>0) { + if(!ServiceUtility.checkFileExtensionImage(uploadPoster)) { + status.add("failure"); + return status; + } + }else { + fileExist=false; + } + } + + + System.out.println(startdate); + System.out.println(enddate); + System.out.println(regStartdate); + System.out.println(regEnddate); + if(fileExist) { + + String previousPath=env.getProperty("spring.applicationexternalPath.name")+localEvent.getPotser_path(); + Path deletePreviousPath=Paths.get(previousPath); + + String uploadDocument=env.getProperty("spring.applicationexternalPath.name")+uploadEvent+localEvent.getEventId(); + + String document=ServiceUtility.uploadFile(uploadPoster, uploadDocument); + + int indexToStart=document.indexOf("Media"); + String documentToUpload=document.substring(indexToStart, document.length()); + + boolean done=eventService.updateEvent(headline, desc, startdate,enddate,regStartdate,regEnddate,corrdName, documentToUpload,localEvent.getEventId()); + + if(done) { + try { + Files.delete(deletePreviousPath); + + + } catch (IOException e) { + + + } + status.add("Success"); + return status; + + }else { + status.add("failure"); + return status; + } + }else { + boolean done=eventService.updateEvent(headline, desc, startdate,enddate,regStartdate,regEnddate,corrdName, localEvent.getPotser_path(),localEvent.getEventId()); + + if(done) { + status.add("Success"); + return status; + }else { + status.add("failure"); + return status; + } + } + + + } + + + + + /**************************************************END*********************************************************************************/ + + + /********************************************** UPDATE PASSWORD ***************************************************************/ + /** + * Post method to update user password + * @param localpass passwordUpdateAjaxQueryResolver object + * @param principal Principal object + * @return success or failure in List + */ + @PostMapping("/updatePassword") + public @ResponseBody List updateUserPassword(@Valid @RequestBody passwordUpdateAjaxQueryResolver localpass,Principal principal){ + List status=new ArrayList(); + boolean statusPassword=false; + + User usr=userService.findByUsername(principal.getName()); + if(localpass.getPassword().length()<6) { + System.out.println("vik"); + status.add("passwordLengthError"); + return status; + } + + statusPassword =ServiceUtility.passwordEncoder().matches(localpass.getCurrentPassword(), usr.getPassword()); + + if(statusPassword) { + if(userService.updateUserPassword(ServiceUtility.passwordEncoder().encode(localpass.getPassword()), usr.getId())) { + status.add("Success"); + }else { + status.add("failure"); + } + }else { + status.add("failure"); + } + + + return status; + + } + + /*******************************************************END*********************************************************************/ + + + + /*------------------------------------------------VALIDATE EMAIL---------------------------------------------------------------*/ + /** + * Validate Email + * @param email Email in list + * @return success or failure in List + */ + @PostMapping("/validateEmail") + public @ResponseBody List validateNewEmail(@Valid @RequestBody List email){ + List status=new ArrayList(); + + if(userService.existByEmail(email.get(0))) { + status.add("TRUE"); + }else { + status.add("FALSE"); + } + + + return status; + + } + + + + + /*--------------------------------------------------END-------------------------------------------------------------------------*/ + +/*--------------------------------------------------LOAD BY CLASS NAME----------------------------------------------------------------------*/ + + /** + * Load Subject given class name + * @param classSelected Class object + * @return set of string + * @throws Exception + */ + @PostMapping("/loadByClassName") + public @ResponseBody List loadByClassName(@Valid @RequestBody Class classSelected ) throws Exception{ + + List subjectName=new ArrayList(); + + Class tempClass=classService.findByClassName(classSelected.getClassName()); + + System.out.println(tempClass.getClass_id()); + + List temp=(ArrayList) subjectClassService.getSubjectFromClass(tempClass); + + for(SubjectClassMapping s:temp) { + + subjectName.add(s.getSub().getSubName()); + + } + + Collections.sort(subjectName); + + return subjectName; + + } + + /** + * Load Subject given class name on homepage + * @param classSelected Class object + * @return set String + * @throws Exception + */ + @PostMapping("/loadByClassNameHome") + public @ResponseBody List loadByClassNameHome(@Valid @RequestBody Class classSelected ) throws Exception{ + + List subjectName=new ArrayList(); + + Class tempClass=classService.findByClassName(classSelected.getClassName()); + + System.out.println(tempClass.getClass_id()); + + List temp=(ArrayList) subjectClassService.getSubjectFromClass(tempClass); + + for(SubjectClassMapping s:temp) { + if(s.getStandard().isStatus() && s.getSub().isStatus()) { + subjectName.add(s.getSub().getSubName()); + } + + } + + Collections.sort(subjectName); + + return subjectName; + + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*------------------------------------- LOAD CLASS BY SUBJECT NAME------------------------------------------------------*/ + + /** + * Return class name based on Subject Name + * @param subjectSelected subject object + * @return set string + * @throws Exception + */ + @PostMapping("/loadBySubjectName") + public @ResponseBody List loadBySubjectName(@Valid @RequestBody Subject subjectSelected) throws Exception{ + + List subjectName=new ArrayList(); + + Subject tempSubject=subjectService.findBySubjectName(subjectSelected.getSubName()); + + System.out.println(tempSubject.getSubId()); + + List temp=(ArrayList) subjectClassService.getClassFromSubject(tempSubject); + + for(SubjectClassMapping s:temp) { + if(s.getStandard().isStatus() && s.getSub().isStatus()) { + subjectName.add(s.getStandard().getClassName()); + } + } + + Collections.sort(subjectName); + + return subjectName; + + } + + + /** + * returns all the topic name based on class and subject on homepage + * @param subName subject name + * @param className class name + * @return set of topic name + * @throws Exception + */ + @GetMapping("/loadByTopicName") + public @ResponseBody HashMap loadByTopicName(@Valid String subName,int className ) throws Exception{ + HashMap topicName=new HashMap<>(); + boolean classExist=true,SubjectExist=true;; + Class classTemp=null; + Subject subTemp=null; + try { + classTemp=classService.findByClassName(className); + } catch (Exception e) { + classExist=false; + e.printStackTrace(); + } + + try { + subTemp =subjectService.findBySubjectName(subName); + } catch (Exception e) { + SubjectExist=false; + e.printStackTrace(); + } + + if(classExist && SubjectExist) { + SubjectClassMapping temp=subjectClassService.findBysubAndstandard(classTemp, subTemp); + List topicLocal=topicService.findBysubjectclassMapping(temp); + for(Topic x:topicLocal) { + if(x.getStatus()==1 && x.getSubjectClassMapping().isStatus() && x.getSubjectClassMapping().getSub().isStatus() && x.getSubjectClassMapping().getStandard().isStatus()) + topicName.put(x.getTopicId(),x.getTopicName()); + } + } + + return topicName; + + } + + + /*------------------------------------------ END ---------------------------------------------------------------*/ + + /*--------------------------------------------------LOAD BY CLASS NAME AND SUBJECT NAME----------------------------------------------------------------------*/ + + /** + * return topic name based on class and subject + * @param subjectClassSelected SubjectClassAjaxQueryResolver object + * @return set of topic + * @throws Exception + */ + @PostMapping("/loadByClassnameAndSubject") + public @ResponseBody List loadByClassnameAndSubject(@Valid @RequestBody SubjectClassAjaxQueryResolver subjectClassSelected) throws Exception{ + List topicName=new ArrayList(); + + + Class tempClass=classService.findByClassName(subjectClassSelected.getClassName()); + + Subject tempSubject=subjectService.findBySubjectName(subjectClassSelected.getSubject()); + + + SubjectClassMapping tempSubjectClassmapping=subjectClassService.findBysubAndstandard(tempClass,tempSubject); + + + + List tempTopic= topicService.findBysubjectclassMapping(tempSubjectClassmapping); + + for(Topic local:tempTopic) { + topicName.add(local.getTopicName()); + } + + Collections.sort(topicName); + + return topicName; + + + + + } + + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOADING USER DETIAILS----------------------------------------------------------------------*/ + + /** + * returns USer data + * @param usr User object + * @return LoadUserLearner object + */ + @PostMapping("/loadByUser") + public LoadUserLearner loadByUser(@Valid @RequestBody User usr){ + + User localUser=userService.findById(usr.getId()); + LoadUserLearner local=new LoadUserLearner(); + local.setFname(localUser.getFname()); + local.setLname(localUser.getLname()); + local.setEmail(localUser.getEmail()); + local.setSex(localUser.getSex()); + local.setDateOfBirth(localUser.getDateOfBirth()); + local.setSchoolName(localUser.getSchoolName()); + local.setSchoolAddress(localUser.getSchoolAddress()); + local.setPincode(localUser.getPincode()); + + + return local; + + + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOAD BY VALIDITY OF USER----------------------------------------------------------------------*/ + /** + * returns user validity + * @param usr User object + * @return User registered value + */ + @PostMapping("/loadByValidity") + public List loadByValidity(@Valid @RequestBody User usr){ + List data=new ArrayList(); + + User local=userService.findById(usr.getId()); + data.add(local.getRegistered()); + + return data; + } + + /** + * returns topic validity + * @param topic topic object + * @return topic status value + */ + @PostMapping("/loadByValidityTopic") + public List loadByValidityTopic(@Valid @RequestBody Topic topic){ + List data=new ArrayList(); + + Topic local=topicService.findById(topic.getTopicId()); + data.add(local.getStatus()); + + return data; + } + + /** + * return phet validity + * @param phet phet object + * @return phet status value + */ + @PostMapping("/loadByValidityPhet") + public List loadByValidityPhet(@Valid @RequestBody Phets phet){ + List data=new ArrayList(); + + Phets local=phetServcie.findByid(phet.getPhetId()); + data.add(local.isStatus()); + + return data; + } + + /** + * return Document validity + * @param document document object + * @return document status value + */ + @PostMapping("/loadByValidityDocument") + public List loadByValidityDocument(@Valid @RequestBody DocumentExternal document){ + List data=new ArrayList(); + + DocumentExternal local=docuService.findByid(document.getDocumentId()); + data.add(local.isStatus()); + + return data; + } + + /** + * return Lesson validity + * @param lesson Lesson object + * @return lesson status value + */ + @PostMapping("/loadByValidityLesson") + public List loadByValidityLesson(@Valid @RequestBody LessonPlan lesson){ + List data=new ArrayList(); + + LessonPlan local=lessonService.findById(lesson.getLessonPlanId()); + data.add(local.isStatus()); + + return data; + } + + /** + * return Article validity + * @param article article object + * @return article status value + */ + @PostMapping("/loadByValidityArticle") + public List loadByValidityArticle(@Valid @RequestBody ArticleExternal article){ + List data=new ArrayList(); + + ArticleExternal local=articleService.findByid(article.getArticleId()); + data.add(local.isStatus()); + + return data; + } + + /** + * return QuizQuestion validity + * @param quiz QuizQuestion object + * @return QuizQuestion status value + */ + @PostMapping("/loadByValidityQuiz") + public List loadByValidityQuiz(@Valid @RequestBody QuizQuestion quiz){ + List data=new ArrayList(); + + QuizQuestion local=quizService.findById(quiz.getQuizQuestionId()); + data.add(local.isStatus()); + + return data; + } + + /** + * return VideoExternal validity + * @param video VideoExternal object + * @return VideoExternal status value + */ + @PostMapping("/loadByValidityVideo") + public List loadByValidityVideo(@Valid @RequestBody VideoExternal video){ + List data=new ArrayList(); + + VideoExternal local=videoService.findById(video.getVideoId()); + data.add(local.isStatus()); + + return data; + } + + /** + * return ConceptMap validity + * @param concept ConceptMap object + * @return ConceptMap status value + */ + @PostMapping("/loadByValidityConcept") + public List loadByValidityConcept(@Valid @RequestBody ConceptMap concept){ + List data=new ArrayList(); + + ConceptMap local=concepMapService.findByid(concept.getConcepMapid()); + data.add(local.getStatus()); + + return data; + } + + /** + * return Tutorial validity + * @param tutorial Tutorial object + * @return Tutorial status value + */ + @PostMapping("/loadByValidityTutorial") + public List loadByValidityTutorial(@Valid @RequestBody Tutorial tutorial){ + List data=new ArrayList(); + + Tutorial local=tutorialService.getById(tutorial.getTutorialId()); + data.add(local.getStatus()); + + return data; + } + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOAD BY SUBJECT----------------------------------------------------------------------*/ + + /** + * return subject data + * @param sub Subject object + * @return SubjectAjaxQueryResolver object + * @throws Exception + */ + @PostMapping("/loadBySubject") + public SubjectAjaxQueryResolver loadBySubject(@Valid @RequestBody Subject sub)throws Exception { + + SubjectAjaxQueryResolver local=new SubjectAjaxQueryResolver(); + Subject localSub=subjectService.findById(sub.getSubId()); + local.setId(localSub.getSubId()); + local.setSubName(localSub.getSubName()); + return local; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOAD BY CLASS NAME----------------------------------------------------------------------*/ + + /** + * returns class value + * @return set of class value + */ + @PostMapping("/loadByClass") + public List loadByClass() { + List< Integer> local=new ArrayList(); + + List localClass=classService.findAll(); + + for(Class a:localClass) { + local.add(a.getClassName()); + } + return local; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOAD BY SUBJECT CLASS----------------------------------------------------------------------*/ + + /** + * returns class name based on Subject object + * @param sub Subject object + * @return set of class value + * @throws Exception + */ + @PostMapping("/loadBySubjectClass") + public Set loadBySubjectClass(@Valid @RequestBody Subject sub) throws Exception{ + Set subName= new HashSet(); + + Subject localSub=subjectService.findById(sub.getSubId()); + + Set local=localSub.getSubClasMapp(); /*--------------------------------------------------LOAD ----------------------------------------------------------------------*/ + for(SubjectClassMapping a:local) { + subName.add(a.getStandard().getClassName()); + } + return subName; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOADING TOPIC DETAILS----------------------------------------------------------------------*/ + /** + * returns topic name based on Topic Object + * @param topic Topic object + * @return set of String (topic name) + */ + @PostMapping("/loadByTopic") + public List loadByTopicTopicName(@Valid @RequestBody Topic topic) { + + List topicdata=new ArrayList(); + + Topic localTopic=topicService.findById(topic.getTopicId()); + + topicdata.add(localTopic.getTopicName()); + + return topicdata; + } + + + + /** + * returns description based on Topic Object + * @param topic Topic object + * @return set of String (description) + */ + @PostMapping("/loadByTopicDesc") + public List loadByTopicDesc(@Valid @RequestBody Topic topic) { + + List topicdata=new ArrayList(); + + Topic localTopic=topicService.findById(topic.getTopicId()); + + topicdata.add(localTopic.getDescription()); + + return topicdata; + } + + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOADING QUIZ DETAILS----------------------------------------------------------------------*/ + + /** + * returns remark based on QuizQuestion Object + * @param quiz QuizQuestion object + * @return set of String (remark) + */ + @PostMapping("/loadByQuizQuestionID") + public List loadByQuizQuestionId(@Valid @RequestBody QuizQuestion quiz){ + + List quizdata=new ArrayList(); + + QuizQuestion quiz1=quizService.findById(quiz.getQuizQuestionId()); + + quizdata.add(quiz1.getRemark()); + return quizdata; + } + + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + /*--------------------------------------------------LOAD ----------------------------------------------------------------------*/ + /*--------------------------------------------------LOADING VIDEO DETAILS----------------------------------------------------------------------*/ + + /** + * returns description based on VideoExternal Object + * @param video VideoExternal object + * @return set of String (description) + */ + @PostMapping("/loadByVideoID") + public List loadByVideoID(@Valid @RequestBody VideoExternal video){ + + List videodata=new ArrayList(); + + VideoExternal local=videoService.findById(video.getVideoId()); + + videodata.add(local.getDescription()); + + if(local.getUrl().startsWith("Media")) { + videodata.add("Upload"); + }else { + videodata.add("Embed"); + } + + return videodata; + } + + + /** + * returns source based on VideoExternal Object + * @param video VideoExternal object + * @return set of String (source) + */ + @PostMapping("/loadByVideoIDSource") + public List loadByVideoIDSource(@Valid @RequestBody VideoExternal video){ + + List videodata=new ArrayList(); /*--------------------------------------------------LOAD ----------------------------------------------------------------------*/ + + VideoExternal local=videoService.findById(video.getVideoId()); + + videodata.add(local.getSource()); + + if(local.getUrl().startsWith("Media")) { + videodata.add("Upload"); + }else { + videodata.add("Embed"); + } + + return videodata; + } + /** + * returns url based on VideoExternal Object + * @param video VideoExternal object + * @return set of String (url) + */ + @PostMapping("/loadByVideoIDUrl") + public List loadByVideoIDUrl(@Valid @RequestBody VideoExternal video){ + + List videodata=new ArrayList(); /*--------------------------------------------------LOAD ----------------------------------------------------------------------*/ + + VideoExternal local=videoService.findById(video.getVideoId()); + + videodata.add(local.getUrl()); + + return videodata; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + /***************************************** LOADING CONCEPT-MAP DETAILS ********************************************************/ + + /** + * returns Description and remark based on ConceptMap Object + * @param concept ConceptMap object + * @return set of String (Description and remark) + */ + @PostMapping("/loadByConceptID") + public List loadByConceptID(@Valid @RequestBody ConceptMap concept){ + + List conceptdata=new ArrayList(); + + ConceptMap local=concepMapService.findByid(concept.getConcepMapid()); + + conceptdata.add(local.getDescription()); + conceptdata.add(local.getRemark()); + + return conceptdata; + } + + /****************************************************END****************************************************************************/ + + /*--------------------------------------------------LOADING ARTICLE DETAILS----------------------------------------------------------------------*/ + /** + * returns source based on ArticleExternal Object + * @param article ArticleExternal object + * @return set of String (source) + */ + @PostMapping("/loadByArtcileID") + public List loadByArtcileID(@Valid @RequestBody ArticleExternal article){ + + List articledata=new ArrayList(); + + ArticleExternal local=articleService.findByid(article.getArticleId()); + + articledata.add(local.getSource()); + + return articledata; + } + + + /** + * returns Description based on ArticleExternal Object + * @param article ArticleExternal object + * @return set of String (Description) + */ + @PostMapping("/loadByArtcileIDDesc") + public List loadByArtcileIDDesc(@Valid @RequestBody ArticleExternal article){ + + List articledata=new ArrayList(); + + ArticleExternal local=articleService.findByid(article.getArticleId()); + + articledata.add(local.getDescription()); + + return articledata; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOADING DOCUMENT DETAILS----------------------------------------------------------------------*/ + + /** + * returns source based on DocumentExternal Object + * @param document DocumentExternal object + * @return set of String (source) + */ + @PostMapping("/loadByDocumentID") + public List loadByDocumentID(@Valid @RequestBody DocumentExternal document){ + + List articledata=new ArrayList(); + + DocumentExternal local=docuService.findByid(document.getDocumentId()); + + articledata.add(local.getSource()); + + return articledata; + } /*--------------------------------------------------LOAD ----------------------------------------------------------------------*/ + + + /** + * returns Description based on DocumentExternal Object + * @param document DocumentExternal object + * @return set of String (Description) + */ + @PostMapping("/loadByDocumentIDDesc") + public List loadByDocumentIDDesc(@Valid @RequestBody DocumentExternal document){ + + List articledata=new ArrayList(); + + DocumentExternal local=docuService.findByid(document.getDocumentId()); + + articledata.add(local.getDescription()); + + return articledata; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------LOADING PHET DETAILS----------------------------------------------------------------------*/ + + + /** + * returns source based on Phets Object + * @param phet Phets object + * @return list of string (source) + */ + @PostMapping("/loadByphetID") + public List loadByphetID(@Valid @RequestBody Phets phet){ + + List articledata=new ArrayList(); + + Phets local=phetServcie.findByid(phet.getPhetId()); + + articledata.add(local.getSource()); /*--------------------------------------------------LOAD ----------------------------------------------------------------------*/ + + return articledata; + } + + + /** + * returns description based on Phets Object + * @param phet Phets object + * @return list of string (Description) + */ + @PostMapping("/loadByphetIDDesc") + public List loadByphetIDDesc(@Valid @RequestBody Phets phet){ + + List articledata=new ArrayList(); + + Phets local=phetServcie.findByid(phet.getPhetId()); + + articledata.add(local.getDescription()); + + return articledata; + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING SUBJECT----------------------------------------------------------------------*/ + + /** + * update Subject resource + * @param data data in list + * @return Success or failure in list + * @throws Exception + */ + @PostMapping("/updateSubject") + public List updateSubject(@Valid @RequestBody List data) throws Exception { + int index=0; + boolean subjectExist=false; + List msg=new ArrayList(); + int size=data.size(); + Set subjectClassMapping=new HashSet(); + + if(size>1) { + String sub=data.get(size-2); + int idsub=Integer.parseInt(sub); + System.out.println(sub); + Subject subject=subjectService.findById(idsub); + + + if(!(data.get(size-1).length()>0)) { + msg.add("failure"); + + return msg; + } + ArrayList subjectTemp=(ArrayList) subjectService.findAll(); + for(Subject temp:subjectTemp) { + if(temp.getSubId()!=subject.getSubId()) { + if(data.get(size-1).equalsIgnoreCase(temp.getSubName())) { + subjectExist=true; + } + } + } + + if(!ServiceUtility.checkContainNumeralInString(data.get(size-1)) || subjectExist) { + msg.add("failure"); + + return msg; + + } + + + + subjectService.updateSubjectName(data.get(size-1), idsub); + + + for(int i=0;i updateTopic(@RequestParam("posterQ") MultipartFile[] uploadfiles, @RequestParam("topicDesc") String desc, @RequestParam("TopicId") String TopicID, @RequestParam("TopicName") String topicName) throws Exception{ + List msg=new ArrayList(); + + boolean fileExist=true; + boolean status; + Topic temptopic=topicService.findById(Integer.parseInt(TopicID)); + + for(MultipartFile temp:uploadfiles) { + if(temp.getSize()>0) { + + if(!ServiceUtility.checkFileExtensionImage(uploadfiles)) { + msg.add("invalid-data'"); + return msg; + } + if(uploadfiles[0].getSize()>fileSize) { + msg.add("invalid-data"); + return msg; + } + }else { + fileExist=false; + } + } + + + + + if(!(desc.length()>0)) { + desc=temptopic.getDescription(); + } + + + if(fileExist) { + String previousPath=env.getProperty("spring.applicationexternalPath.name")+temptopic.getPoster(); + + Path fileToDeletePath=Paths.get(previousPath); + + String pathToUpload=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+temptopic.getSubjectClassMapping().getStandard().getClassName()+"_"+temptopic.getSubjectClassMapping().getSub().getSubId()+"/"+temptopic.getTopicId()+"/"; + System.out.println(pathToUpload); + String newFilePath=ServiceUtility.uploadFile(uploadfiles, pathToUpload); + + int indexToStart=newFilePath.indexOf("Media"); + String posterPath=newFilePath.substring(indexToStart, newFilePath.length()); + + status=topicService.updateTopic(desc, posterPath,topicName, ServiceUtility.getCurrentTime(), temptopic.getTopicId()); + + + if(status) { + + try { + Files.delete(fileToDeletePath); + } catch (IOException e) { + + e.printStackTrace(); + } + msg.add("Success"); + return msg; + + }else { + + msg.add("failure"); + return msg; + + } + }else { + + status=topicService.updateTopicDesc(desc,topicName, ServiceUtility.getCurrentTime(), temptopic.getTopicId()); + + if(status) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + + } + + + + + + } + + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING QUIZ----------------------------------------------------------------------*/ + + + + /** + * updated Quiz resource + * @param uploadQuestion question file + * @param uploadAnswer answer file + * @param quizID QuizQuestion ID + * @return Success or failure in list + * @throws Exception + */ + @PostMapping("/updateQuiz") + public @ResponseBody List updateQuiz(@RequestParam("question") MultipartFile[] uploadQuestion, @RequestParam("answer") MultipartFile[] uploadAnswer, @RequestParam("quizId") String quizID) throws Exception{ + List msg=new ArrayList(); + boolean fileExistAnswer=true; + boolean fileExistQuestion=true; + for(MultipartFile temp:uploadAnswer) { + + if(temp.getSize()>0) { + if(!ServiceUtility.checkFileExtensionPDF(uploadAnswer)) { + msg.add("invalid-data"); + return msg; + } + if(uploadAnswer[0].getSize()>fileSize) { + msg.add("invalid-data"); + return msg; + } + + }else { + fileExistAnswer=false; + } + } + + + for(MultipartFile temp:uploadQuestion) { + + if(temp.getSize()>0) { + if(!ServiceUtility.checkFileExtensionPDF(uploadQuestion)) { + msg.add("invalid-data"); + return msg; + } + if(uploadQuestion[0].getSize()>fileSize) { + msg.add("invalid-data"); + return msg; + } + + }else { + fileExistQuestion=false; + } + } + + QuizQuestion tempQuiz=quizService.findById(Integer.parseInt(quizID)); + + + if(fileExistAnswer && fileExistQuestion) { + + String previousQuestion=env.getProperty("spring.applicationexternalPath.name")+tempQuiz.getQuestion(); + String previousAnswer=env.getProperty("spring.applicationexternalPath.name")+tempQuiz.getAnswer(); + + Path deletepreviousQuestion=Paths.get(previousQuestion); + + Path deletepreviousAnswer=Paths.get(previousAnswer); + + String pathToUploadQuestion=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+tempQuiz.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+tempQuiz.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+tempQuiz.getTopic().getTopicId()+"/"+"Quiz/"+tempQuiz.getQuizQuestionId()+"/Question/"; + + String pathToUploadAnswer=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+tempQuiz.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+tempQuiz.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+tempQuiz.getTopic().getTopicId()+"/"+"Quiz/"+tempQuiz.getQuizQuestionId()+"/Answer/"; + + String questiontemp=ServiceUtility.uploadFile(uploadQuestion, pathToUploadQuestion); + String answertemp=ServiceUtility.uploadFile(uploadAnswer, pathToUploadAnswer); + + System.out.println(previousAnswer); + System.out.println(previousQuestion); + System.out.println(pathToUploadAnswer); + System.out.println(pathToUploadQuestion); + + int indexToStart=questiontemp.indexOf("Media"); + String question=questiontemp.substring(indexToStart, questiontemp.length()); + + indexToStart=answertemp.indexOf("Media"); + String answer=answertemp.substring(indexToStart, answertemp.length()); + + + boolean status=quizService.updateQuiz(question, answer, ServiceUtility.getCurrentTime(), tempQuiz.getQuizQuestionId()); + + if(status) { + + try { + Files.delete(deletepreviousQuestion); + Files.delete(deletepreviousAnswer); + + } catch (IOException e) { + + e.printStackTrace(); + } + + msg.add("Success"); + return msg; + + }else { + + msg.add("failure"); + return msg; + } + }else if(fileExistAnswer) { + + String previousAnswer=env.getProperty("spring.applicationexternalPath.name")+tempQuiz.getAnswer(); + + Path deletepreviousAnswer=Paths.get(previousAnswer); + + String pathToUploadAnswer=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+tempQuiz.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+tempQuiz.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+tempQuiz.getTopic().getTopicId()+"/"+"Quiz/"+tempQuiz.getQuizQuestionId()+"/Answer/"; + + String answertemp=ServiceUtility.uploadFile(uploadAnswer, pathToUploadAnswer); + + System.out.println(previousAnswer); + + System.out.println(pathToUploadAnswer); + + int indexToStart=answertemp.indexOf("Media"); + String answer=answertemp.substring(indexToStart, answertemp.length()); + + + boolean status=quizService.updateQuizAnswer(answer, ServiceUtility.getCurrentTime(), tempQuiz.getQuizQuestionId()); + + if(status) { + try { + Files.delete(deletepreviousAnswer); + + } catch (IOException e) { + + e.printStackTrace(); + } + msg.add("Success"); + return msg; + + }else { + + msg.add("failure"); + return msg; + } + + }else if(fileExistQuestion) { + + String previousQuestion=env.getProperty("spring.applicationexternalPath.name")+tempQuiz.getQuestion(); + + Path deletepreviousQuestion=Paths.get(previousQuestion); + + String pathToUploadQuestion=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+tempQuiz.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+tempQuiz.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+tempQuiz.getTopic().getTopicId()+"/"+"Quiz/"+tempQuiz.getQuizQuestionId()+"/Question/"; + + String questiontemp=ServiceUtility.uploadFile(uploadQuestion, pathToUploadQuestion); + + System.out.println(previousQuestion); + + System.out.println(pathToUploadQuestion); + + int indexToStart=questiontemp.indexOf("Media"); + String question=questiontemp.substring(indexToStart, questiontemp.length()); + + + boolean status=quizService.updateQuizQuestion(question, ServiceUtility.getCurrentTime(), tempQuiz.getQuizQuestionId()); + + if(status) { + try { + Files.delete(deletepreviousQuestion); + + } catch (IOException e) { + + e.printStackTrace(); + } + msg.add("Success"); + return msg; + + }else { + + msg.add("failure"); + return msg; + } + + } + + return msg; + + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING DOCUMENT----------------------------------------------------------------------*/ + + /** + * Update Document resource + * @param uploadQuestion file to be updated + * @param dSource source to be updated + * @param documentId DocuemntExternal ID + * @param desc description to be updated + * @return Success or failure in list + * @throws Exception + */ + @PostMapping("/updateDocument") + public @ResponseBody List updateDocument(@RequestParam("document") MultipartFile[] uploadQuestion,@RequestParam("documentsource") String dSource,@RequestParam("documentId") String documentId,@RequestParam("documentDesc") String desc) throws Exception{ + List msg=new ArrayList(); + boolean fileExist=true; + + for(MultipartFile temp:uploadQuestion) { + + if(temp.getSize()>0) { + if(!ServiceUtility.checkFileExtensionPDF(uploadQuestion) && !ServiceUtility.checkFileExtensionImage(uploadQuestion)) { + msg.add("invalid-data"); + return msg; + }else if(uploadQuestion[0].getSize()>fileSize) { + msg.add("invalid-data"); + return msg; + } + }else { + fileExist=false; + } + } + + + + DocumentExternal docuTemp=docuService.findByid(Integer.parseInt(documentId)); + + if(!(desc.length()>0)) { + desc=docuTemp.getDescription(); + } + + if(!(dSource.length()>0)) { + dSource=docuTemp.getSource(); + } + + if(fileExist) { + + String previousPath=env.getProperty("spring.applicationexternalPath.name")+docuTemp.getUrl(); + Path deletePreviousPath=Paths.get(previousPath); + + String uploadDocument=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+docuTemp.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+docuTemp.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+docuTemp.getTopic().getTopicId()+"/"+"Document/"+docuTemp.getDocumentId()+"/"; + + String document=ServiceUtility.uploadFile(uploadQuestion, uploadDocument); + + int indexToStart=document.indexOf("Media"); + String documentToUpload=document.substring(indexToStart, document.length()); + + boolean done=docuService.updateDocument(desc, dSource, documentToUpload, ServiceUtility.getCurrentTime(), docuTemp.getDocumentId()); + + if(done) { + try { + Files.delete(deletePreviousPath); + + + } catch (IOException e) { + + + } + msg.add("Success"); + return msg; + + }else { + msg.add("failure"); + return msg; + } + }else { + boolean done=docuService.updateDocumentDesc(desc, dSource, ServiceUtility.getCurrentTime(), docuTemp.getDocumentId()); + + if(done) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + } + + + } + + /*------------------------------------------------------------END--------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING CONCEPT-MAP-------------------------------------------------------------*/ + /** + * Update Concept map resource + * @param conceptImage Image to be updated + * @param desc Description to be updated + * @param conceptId ConceptMap ID + * @param remark remark to be updated + * @return Success or failure in list + * @throws Exception + */ + @PostMapping("/updateConcept") + public @ResponseBody List updateConcept(@RequestParam("conceptImage") MultipartFile[] conceptImage,@RequestParam("conceptDesc") String desc,@RequestParam("conceptId") String conceptId,@RequestParam("conceptHeadline") String remark) throws Exception{ + List msg=new ArrayList(); + + boolean fileExist=true; + + for(MultipartFile temp:conceptImage) { + + if(temp.getSize()>0) { + if(!ServiceUtility.checkFileExtensionImage(conceptImage) && !ServiceUtility.checkFileExtensionZip(conceptImage) ) { + msg.add("invalid-data"); + return msg; + }else if(conceptImage[0].getSize()>fileSize) { + msg.add("invalid-data"); + return msg; + } + }else { + fileExist=false; + } + } + + ConceptMap conceptTemp=concepMapService.findByid(Integer.parseInt(conceptId)); + + + + if(!(desc.length()>0)) { + desc=conceptTemp.getDescription(); + } + + if(!(remark.length()>0) ){ + remark=conceptTemp.getRemark(); + } + + if(fileExist) { + + String previousPath=env.getProperty("spring.applicationexternalPath.name")+conceptTemp.getUrl(); + Path deletePreviousPath=Paths.get(previousPath); + + String uploadconceptImage=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+conceptTemp.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+conceptTemp.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+conceptTemp.getTopic().getTopicId()+"/"+"ConceptMap/"+conceptTemp.getConcepMapid()+"/"; + + String document=null; + + if(ServiceUtility.checkFileExtensionImage(conceptImage)) { + document=ServiceUtility.uploadFile(conceptImage, uploadconceptImage); + }else { + document=ServiceUtility.uploadZipFile(conceptImage, uploadconceptImage); + } + + + int indexToStart=document.indexOf("Media"); + String documentToUpload=document.substring(indexToStart, document.length()); + + boolean done=concepMapService.updateConcept(desc, documentToUpload, remark, ServiceUtility.getCurrentTime(), conceptTemp.getConcepMapid()); + if(done) { + try { + Files.delete(deletePreviousPath); + + + } catch (IOException e) { + + + } + msg.add("Success"); + return msg; + + }else { + msg.add("failure"); + return msg; + } + }else { + + boolean done=concepMapService.updateConceptDesc(desc, remark, ServiceUtility.getCurrentTime(), conceptTemp.getConcepMapid()); + if(done) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + } + + + } + + + /*--------------------------------------------------------------END-----------------------------------------------------------------* + * + */ + + /*--------------------------------------------------UPDATING VIDEO----------------------------------------------------------------------*/ + + /** + * Update Video resource + * @param VSource source to be updated + * @param videoId VideoExternal ID + * @param desc description to set + * @param url Url of video + * @return success or failure in list + */ + @PostMapping("/updateVideo") + public @ResponseBody List updateVideo(@RequestParam("videosource") String VSource,@RequestParam("videoId") String videoId,@RequestParam("videoDesc") String desc,@RequestParam("videourl") String url){ + List msg=new ArrayList(); + + String description=null; + String urlUpload=null; + + VideoExternal videotemp=videoService.findById(Integer.parseInt(videoId)); + + if(url.length()>0) { + + if(!url.startsWith("0) { + description=desc; + + }else { + description=videotemp.getDescription(); + } + + if(VSource.length()>0) { + + }else { + VSource=videotemp.getSource(); + } + + boolean status=videoService.updateVideo(description, VSource, urlUpload, ServiceUtility.getCurrentTime(), videotemp.getVideoId()); + + if(status) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + } + + /** + * Update Video resource + * @param VSource source to be updated + * @param videoId VideoExternal ID + * @param desc description to set + * @param videourl Video file to be set + * @return Success or failue in list + */ + @PostMapping("/updateVideoUpload") + public @ResponseBody List updateVideoUpload(@RequestParam("videosource") String VSource,@RequestParam("videoId") String videoId,@RequestParam("videoDesc") String desc,@RequestParam("videourl") MultipartFile videourl){ + List msg=new ArrayList(); + + String description=null; + String urlUpload=null; + + VideoExternal videotemp=videoService.findById(Integer.parseInt(videoId)); + + if(!videourl.isEmpty()) { + if(!ServiceUtility.checkFileExtensionVideo(videourl)) { + msg.add("failure"); + return msg; + } + if(videourl.getSize()>videoSize) { + msg.add("failure"); + return msg; + } + + String previousPath=env.getProperty("spring.applicationexternalPath.name")+videotemp.getUrl(); + Path deletePreviousPath=Paths.get(previousPath); + + String uploadconceptImage=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+videotemp.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+videotemp.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+videotemp.getTopic().getTopicId()+"/"+"Video/"+videotemp.getVideoId(); + + String document; + + try { + document = ServiceUtility.uploadVideoFile(videourl, uploadconceptImage); + int indexToStart=document.indexOf("Media"); + urlUpload=document.substring(indexToStart, document.length()); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + }else { + urlUpload=videotemp.getUrl(); + } + + if(desc.length()>0) { + description=desc; + + }else { + description=videotemp.getDescription(); + } + + if(VSource.length()>0) { + + }else { + VSource=videotemp.getSource(); + } + + boolean status=videoService.updateVideo(description, VSource, urlUpload, ServiceUtility.getCurrentTime(), videotemp.getVideoId()); + + if(status) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + } + + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING PHETS----------------------------------------------------------------------*/ + + /** + * Update Phet resource + * @param PSource source to be updated + * @param phetId Phets ID + * @param desc description to be set + * @param url Url path to be updated + * @return Success or failue in list + */ + @PostMapping("/updatePhet") + public @ResponseBody List updatePhet(@RequestParam("phetsource") String PSource,@RequestParam("phetId") String phetId,@RequestParam("phetDesc") String desc,@RequestParam("phetUrl") String url){ + List msg=new ArrayList(); + + String description=null; + String urlUpload=null; + + Phets phetemp=phetServcie.findByid(Integer.parseInt(phetId)); + + if(url.length()>0) { + + if(!url.startsWith("0) { + description=desc; + + }else { + description=phetemp.getDescription(); + } + + boolean status=phetServcie.updatePhet(PSource, urlUpload, ServiceUtility.getCurrentTime(), description, phetemp.getPhetId()); + + if(status) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + + + } + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING Lesson Plan----------------------------------------------------------------------*/ + /** + * Update LessonPlan Object + * @param uploadLessonPlan File to be updated + * @param documentId LessonPlan ID + * @return Success or failue in list + * @throws Exception + */ + @PostMapping("/updateLesson") + public @ResponseBody List updateLesson(@RequestParam("lessonPlan") MultipartFile[] uploadLessonPlan,@RequestParam("lessonId") String documentId) throws Exception{ + List msg=new ArrayList(); + + if(!ServiceUtility.checkFileExtensionPDF(uploadLessonPlan)) { + msg.add("invalid-data"); + return msg; + } + + if(uploadLessonPlan[0].getSize()>fileSize) { + msg.add("invalid-data"); + return msg; + } + + LessonPlan lessonTemp=lessonService.findById(Integer.parseInt(documentId)); + + String previousPath=env.getProperty("spring.applicationexternalPath.name")+lessonTemp.getLessonPlan(); + Path deletePreviousPath=Paths.get(previousPath); + + String uploadDocument=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+lessonTemp.getTopic().getSubjectClassMapping().getStandard().getClassName()+"_"+lessonTemp.getTopic().getSubjectClassMapping().getSub().getSubId()+"/"+lessonTemp.getTopic().getTopicId()+"/"+"Lessonplan/"+lessonTemp.getLessonPlanId()+"/"; + + String document=ServiceUtility.uploadFile(uploadLessonPlan, uploadDocument); + + int indexToStart=document.indexOf("Media"); + String documentToUpload=document.substring(indexToStart, document.length()); + + System.out.println(lessonTemp.getLessonPlanId()); + + + boolean done=lessonService.updateLessonPlan(ServiceUtility.getCurrentTime(), documentToUpload, lessonTemp.getLessonPlanId()); + + if(done) { + try { + Files.delete(deletePreviousPath); + + + } catch (IOException e) { + + + } + msg.add("Success"); + return msg; + + }else { + msg.add("failure"); + return msg; + } + + + + } + + + /*------------------------------------------------------------END------------------------------------------------------------------*/ + + /*--------------------------------------------------UPDATING ARTICLE----------------------------------------------------------------------*/ + + /** + * Update Article object + * @param ASource source to be updated + * @param articleId Article ID + * @param desc description to be updated + * @param url Url path to be set + * @return Success or failue in list + */ + @PostMapping("/updateArticle") + public @ResponseBody List updateArticle(@RequestParam("articlesource") String ASource,@RequestParam("artcileId") String articleId,@RequestParam("articleDesc") String desc,@RequestParam("articleurl") String url){ + List msg=new ArrayList(); + + String description=null; + String urlUpload=null; + + ArticleExternal articletemp=articleService.findByid(Integer.parseInt(articleId)); + + if(url.length()>0) { + + if(!url.startsWith("http")) { + msg.add("Invalid Data"); + return msg; + } + urlUpload=url; + + + }else { + urlUpload=articletemp.getUrl(); + } + + if(desc.length()>0) { + description=desc; + + }else { + description=articletemp.getDescription(); + } + + boolean status=articleService.updateArticle(description, ASource, urlUpload, ServiceUtility.getCurrentTime(), articletemp.getArticleId()); + + if(status) { + msg.add("Success"); + return msg; + }else { + msg.add("failure"); + return msg; + } + } + + + + /*****************************************************************END************************************************************************/ + + + /*---------------------------------------------------------COMMENT SECTION FOR VIDEO---------------------------------------------------------*/ + /** + * return comment based on video resource + * @param video VideoExternal object + * @return list of CommentAjaxQueryResolver object + */ + @PostMapping("/loadByVideoComment") + public @ResponseBody List fetchCommentOnVideo(@Valid @RequestBody VideoExternal video) { + + VideoExternal localVideo=videoService.findById(video.getVideoId()); + + List localComment=comService.getCommentByVideoId(localVideo); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + /** + * save comment based on Video + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver object + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnVideo") + public List uploadCommentonVideo(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + + List msg=new ArrayList(); + + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idVideo=data.getId(); + VideoExternal localVideo=videoService.findById(idVideo); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, localVideo)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + + +} + +/*****************************************************************END****************************************************************/ + + /*----------------------------------------------COLLECTION OF REPLY ON COMMENT--------------------------------------------------------------*/ + + /** + * return reply on Comment object + * @param coment Comment object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadReplyOnComment") + public List fetchReplyOnComment(@Valid @RequestBody Comment coment){ + List replyOnComment=new ArrayList(); + + Comment localComment=comService.findById(coment.getCommentid()); + + List commentReplyInstance=comReplyService.getReplyOnComment(localComment); + + for(CommentReply x:commentReplyInstance) { + + String date=ServiceUtility.daysDifference(x.getDateAdded())+" day Ago"; + replyOnComment.add(new CommentAjaxQueryResolver(x.getComment().getCommentid(), x.getCommentReply(), x.getUser().getFname(), date)); + } + + return replyOnComment; + + } + + /*---------------------------------------------------------------END----------------------------------------------------------------------------*/ + + + /*---------------------------------------------------------COMMENT SECTION FOR ARTICLE---------------------------------------------------------*/ + /** + * returns set of comment based on ArticleExternal object + * @param article ArticleExternal object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadByArticleComment") + public @ResponseBody List fetchCommentOnArtcile(@Valid @RequestBody ArticleExternal article) { + + ArticleExternal localArticle=articleService.findByid(article.getArticleId()); + + List localComment=comService.getCommentByArticleId(localArticle); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + /** + * save comment reply on comment (Article) + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver object + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnArticle") + public List uploadCommentonArtcile(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + +// List msg=new ArrayList(); +// int size=data.size(); +// +// HttpSession session=req.getSession(false); +// String emailToIdentifyUser=(String) session.getAttribute("UserLoged"); +// User usr=userService.findByUsername(emailToIdentifyUser); +// +// String sub=data.get(size-1); +// int idArticle=Integer.parseInt(sub); +// ArticleExternal localArticle=articleService.findByid(idArticle); +// +// +// Set comment=new HashSet(); +// comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.get(0), usr, localArticle)); +// +// userService.addUserToComment(usr, comment); +// +// +// msg.add("Success"); +// return msg; + + List msg=new ArrayList(); + + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idArticle=data.getId(); + ArticleExternal localArticle=articleService.findByid(idArticle); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, localArticle)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + + + +} + + + /*---------------------------------------------------------------END----------------------------------------------------------------------------*/ + + + + /*---------------------------------------------------------COMMENT SECTION FOR DOCUMENT---------------------------------------------------------*/ + + /** + * return set of comment based on DocumentExternal object + * @param document DocumentExternal object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadByDocumentComment") + public @ResponseBody List fetchCommentOnDocument(@Valid @RequestBody DocumentExternal document) { + System.out.println(document.getDocumentId()); + + DocumentExternal localDocument=docuService.findByid(document.getDocumentId()); + + List localComment=comService.getCommentByDocumentId(localDocument); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + /** + * save comment reply on comment (document) + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver object + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnDocument") + public List uploadCommentonDocument(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + + + List msg=new ArrayList(); + + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idDocument=data.getId(); + DocumentExternal localDocument=docuService.findByid(idDocument); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, localDocument)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + + + + +} + + /*---------------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*---------------------------------------------------------COMMENT SECTION FOR QUIZ---------------------------------------------------------*/ + + + /** + * return comment based on QuizQuestion object + * @param quiz QuizQuestion object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadByQuizComment") + public @ResponseBody List fetchCommentOnQuiz(@Valid @RequestBody QuizQuestion quiz) { + + QuizQuestion localquiz=quizService.findById(quiz.getQuizQuestionId()); + + List localComment=comService.getCommentByQuizId(localquiz); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + /** + * save comment reply on comment + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnQuiz") + public List uploadCommentonQuiz(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + +// List msg=new ArrayList(); +// int size=data.size(); +// +// HttpSession session=req.getSession(false); +// String emailToIdentifyUser=(String) session.getAttribute("UserLoged"); +// User usr=userService.findByUsername(emailToIdentifyUser); +// +// String sub=data.get(size-1); +// int idQuiz=Integer.parseInt(sub); +// QuizQuestion localQuiz=quizService.findById(idQuiz); +// +// +// Set comment=new HashSet(); +// comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.get(0), usr, localQuiz)); +// +// userService.addUserToComment(usr, comment); +// +// +// msg.add("Success"); +// return msg; + + List msg=new ArrayList(); + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idQuiz=data.getId(); + QuizQuestion localQuiz=quizService.findById(idQuiz); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, localQuiz)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + + +} + + /*---------------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*---------------------------------------------------------COMMENT SECTION FOR PHET---------------------------------------------------------*/ + + /** + * return comment object based on Phet object + * @param phet phets Object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadByPhetComment") + public @ResponseBody List fetchCommentOnPhet(@Valid @RequestBody Phets phet) { + + Phets localphet=phetServcie.findByid(phet.getPhetId()); + + List localComment=comService.getCommentByPhetId(localphet); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + /** + * Save comment on Phet resource + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnPhet") + public List uploadCommentonPhet(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + +// List msg=new ArrayList(); +// int size=data.size(); +// +// HttpSession session=req.getSession(false); +// String emailToIdentifyUser=(String) session.getAttribute("UserLoged"); +// User usr=userService.findByUsername(emailToIdentifyUser); +// +// String sub=data.get(size-1); +// int idphet=Integer.parseInt(sub); +// Phets localphet=phetServcie.findByid(idphet); +// +// +// Set comment=new HashSet(); +// comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.get(0), usr, localphet)); +// +// userService.addUserToComment(usr, comment); +// +// +// msg.add("Success"); +// return msg; + + List msg=new ArrayList(); + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idPhet=data.getId(); + Phets localphet=phetServcie.findByid(idPhet); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, localphet)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + + +} + + /*---------------------------------------------------------------END----------------------------------------------------------------------------*/ + + /**************************************** COMMENT SECTION FOR CONCEPTS-MAP********************************************/ + + /** + * returns Comment made on ConceptMap object + * @param conceptMap ConceptMap object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadByConceptComment") + public @ResponseBody List fetchCommentOnLesson(@Valid @RequestBody ConceptMap conceptMap) { + + ConceptMap localConcept=concepMapService.findByid(conceptMap.getConcepMapid()); + + List localComment=comService.getCommentByConceptMap(localConcept); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + /** + * Save comment reply on Concept resource + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver object + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnConcept") + public List uploadCommentonConcept(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + + + List msg=new ArrayList(); + + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idConcept=data.getId(); + ConceptMap localConcept=concepMapService.findByid(idConcept); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, localConcept)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + + +} + + + /*---------------------------------------------------------COMMENT SECTION FOR LESSON---------------------------------------------------------*/ + + /** + * return all the comment made on LessonPlan object + * @param lesson LessonPlan object + * @return list of CommentAjaxQueryResolver + */ + @PostMapping("/loadByLessonComment") + public @ResponseBody List fetchCommentOnLesson(@Valid @RequestBody LessonPlan lesson) { + + LessonPlan locallesson=lessonService.findById(lesson.getLessonPlanId()); + + List localComment=comService.getCommentByLessonId(locallesson); + + List temp=new ArrayList(); + + for(Comment data:localComment) { + + String date=ServiceUtility.daysDifference(data.getDateAdded())+" day Ago"; + + temp.add(new CommentAjaxQueryResolver(data.getCommentid(), data.getComment(), data.getUser().getFname(), date)); + + } + + + + return temp; + } + + + + /** + * Save comment on Lesson resource + * @param principal Principal object + * @param data CommentReplyAjaxQueryResolver object + * @return success or failure in list + * @throws Exception + */ + @PostMapping("/uploadCommentOnLesson") + public List uploadCommentonLesson(Principal principal,@Valid @RequestBody CommentReplyAjaxQueryResolver data) throws Exception { + +// List msg=new ArrayList(); +// int size=data.size(); +// +// HttpSession session=req.getSession(false); +// String emailToIdentifyUser=(String) session.getAttribute("UserLoged"); +// User usr=userService.findByUsername(emailToIdentifyUser); +// +// String sub=data.get(size-1); +// int idLesson=Integer.parseInt(sub); +// LessonPlan locallesson=lessonService.findById(idLesson); +// +// +// Set comment=new HashSet(); +// comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.get(0), usr, locallesson)); +// +// userService.addUserToComment(usr, comment); +// +// +// msg.add("Success"); +// return msg; + + + List msg=new ArrayList(); + + + User usr=userService.findByUsername(principal.getName()); + + try { + if(data.isReply()) { + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + Comment localComment=comService.findById(data.getId()); + + Set reply= new HashSet(); + reply.add(new CommentReply(comReplyService.countRow()+1, data.getComment(), ServiceUtility.getCurrentTime(), localComment, usr)); + + userService.addUserToCommentReply(usr, reply); + + msg.add("Success"); + + }else { + + if(data.getComment().isEmpty()) { + msg.add("failure"); + return msg; + + } + + int idLesson=data.getId(); + LessonPlan locallesson=lessonService.findById(idLesson); + + + Set comment=new HashSet(); + comment.add(new Comment(comService.countRow()+1, ServiceUtility.getCurrentTime(), data.getComment(), usr, locallesson)); + + userService.addUserToComment(usr, comment); + + msg.add("Success"); + } + } catch (Exception e) { + + e.printStackTrace(); + msg.add("failure"); + } + + + return msg; + +} + + +// @PostMapping("/addArticleFromUser") +// public @ResponseBody List addArticleFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("description") String desc,@RequestParam("source") String source,@RequestParam("url") String url){ +// List status=new ArrayList(); +// +// if(!url.startsWith("http")) { // validation against proper Url given against artcile file. +// +// status.add("failure"); +// +// return status; +// +// } +// +// +// try { +// Class localClass=classService.findByClassName(Integer.parseInt(classSelected)); +// Subject localSubject=subjectService.findBysubName(subSelected); +// SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); +// Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicSelected); +// +// +// +// User usr=userService.findByUsername(principal.getName()); +// Set articlemapping=new HashSet(); +// articlemapping.add(new ArticleExternal(articleService.countRow()+1, "Article", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, url, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); +// +// +// +// userService.addUserToArticle(usr, articlemapping); +// status.add("Success"); +// } catch (Exception e) { +// +// status.add("failure"); +// } +// +// +// +// return status; +// } +// +// @PostMapping("/addPhetFromUser") +// public @ResponseBody List addPhetFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("description") String desc,@RequestParam("source") String source,@RequestParam("phet") String phet){ +// +// List status=new ArrayList(); +// String phetPath=null; +// +// try { +// if(phet.length()>0) { +// +// if(!phet.startsWith(" phetMapping=new HashSet(); +// phetMapping.add(new Phets(phetServcie.countRow()+1, "Phets", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, phetPath, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); +// +// +// userService.addUserToPhets(usr, phetMapping); +// status.add("Success"); +// +// } catch (Exception e) { +// +// status.add("failure"); +// System.out.println("baby"); +// } +// +// +// +// return status; +// } +// +// @PostMapping("/addVideoFromUser") +// public @ResponseBody List addVideoFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("description") String desc,@RequestParam("source") String source,@RequestParam("url") String url){ +// List status=new ArrayList(); +// +// String videourl=null; +// +// +// try { +// if(url.length()>0) { +// +// if(!url.startsWith(" videoMapping=new HashSet(); +// videoMapping.add(new VideoExternal(videoService.countRow()+1, "Video", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, videourl, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); +// +// +// +// userService.addUserToVideo(usr, videoMapping); +// status.add("Success"); +// +// } catch (Exception e) { +// +// status.add("failure"); +// e.printStackTrace(); +// } +// +// +// +// +// +// +// +// return status; +// } +// +// @PostMapping("/addLessonFromUser") +// public @ResponseBody List addLessonFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("lesson") MultipartFile[] uploadLessonPlan) throws Exception{ +// +// List status=new ArrayList(); +// +// if(!ServiceUtility.checkFileExtensionPDF(uploadLessonPlan)) { +// +// status.add("failure"); +// return status; +// +// } +// +// if(uploadLessonPlan[0].getSize()>fileSize) { +// +// status.add("failure"); +// return status; +// +// } +// +// Class localClass=classService.findByClassName(Integer.parseInt(classSelected)); +// Subject localSubject=subjectService.findBysubName(subSelected); +// SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); +// Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicSelected); +// +// String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+localClass.getClassName()+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Lessonplan/"; +// +// try { +// String path1=ServiceUtility.uploadFile(uploadLessonPlan, createFolder); +// +// int indexToStart=path1.indexOf("Media"); +// String path=path1.substring(indexToStart, path1.length()); +// +// User usr=userService.findByUsername(principal.getName()); +// +// Set lessonMapping=new HashSet(); +// lessonMapping.add(new LessonPlan(lessonService.countRow()+1, "Lesson", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), path, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); +// +// +// userService.addUserToLessonplan(usr, lessonMapping); +// status.add("Success"); +// +// } catch (Exception e) { +// +// status.add("failure"); +// } +// +// +// +// +// return status; +// } +// +// @PostMapping("/addQuizFromUser") +// public @ResponseBody List addQuizFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("remarks") String remark,@RequestParam("Question") MultipartFile[] uploadQuestion, +// @RequestParam("Answer") MultipartFile[] uploadAnswer) throws Exception{ +// +// List status=new ArrayList(); +// +// String questionPath=null; +// String answerPath=null; +// +// if(!ServiceUtility.checkFileExtensionPDF(uploadAnswer)) { +// System.out.println("file error"); +// status.add("failure"); +// return status; +// +// } +// +// if(!ServiceUtility.checkFileExtensionPDF(uploadQuestion)) { +// +// status.add("failure"); +// return status; +// } +// +// if(uploadAnswer[0].getSize()>fileSize || uploadQuestion[0].getSize()>fileSize) { +// +// status.add("failure"); +// return status; +// } +// +// Class localClass=classService.findByClassName(Integer.parseInt(classSelected)); +// Subject localSubject=subjectService.findBysubName(subSelected); +// SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); +// Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicSelected); +// +// +// try { +// String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+localClass.getClassName()+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Quiz/"+remark+"/"; +// boolean b=ServiceUtility.createFolder(createFolder); +// +// String CreateFolderQuestion=createFolder+"Question/"; +// String CreateFolderAnswer=createFolder+"Answer/"; +// +// boolean ques=ServiceUtility.createFolder(CreateFolderQuestion); +// boolean ans=ServiceUtility.createFolder(CreateFolderAnswer); +// +// if(ques && ans) { +// +// questionPath=ServiceUtility.uploadFile(uploadQuestion, CreateFolderQuestion); +// answerPath=ServiceUtility.uploadFile(uploadAnswer, CreateFolderAnswer); +// +// +// int indexToStart=questionPath.indexOf("Media"); +// String pathQuestion=questionPath.substring(indexToStart, questionPath.length()); +// +// int indexToStart1=answerPath.indexOf("Media"); +// String pathAnswer=answerPath.substring(indexToStart1, answerPath.length()); +// +// +// +// User usr=userService.findByUsername(principal.getName()); +// +// +// +// +// +// Set quizMapping=new HashSet(); +// quizMapping.add(new QuizQuestion(quizService.countRow()+1,"Quiz",ServiceUtility.getCurrentTime(),ServiceUtility.getCurrentTime(),pathQuestion,pathAnswer,0,0,remark,ServiceUtility.getCurrentTime(),localTopic,usr)); +// +// +// +// userService.addUserToQuizQuestion(usr, quizMapping); +// +// status.add("Success"); +// +// }else { +// System.out.println("status error"); +// status.add("failure"); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// status.add("failure"); +// +// } +// +// +// +// return status; +// } +// +// @PostMapping("/addDocumentFromUser") +// public @ResponseBody List addDocumentFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("description") String desc,@RequestParam("source") String source,@RequestParam("Question") MultipartFile[] uploadDocument) throws Exception{ +// +// List status=new ArrayList(); +// +// if(!ServiceUtility.checkFileExtensionPDF(uploadDocument) && !ServiceUtility.checkFileExtensionImage(uploadDocument)) { +// +// status.add("failure"); +// System.out.println("fail-document"); +// return status; +// +// } +// +// if(uploadDocument[0].getSize()>fileSize) { +// +// status.add("failure"); +// return status; +// +// } +// +// Class localClass=classService.findByClassName(Integer.parseInt(classSelected)); +// Subject localSubject=subjectService.findBysubName(subSelected); +// SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); +// Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicSelected); +// +// String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+localClass.getClassName()+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/Document/"; +// +// +// try { +// String path1=ServiceUtility.uploadFile(uploadDocument, createFolder); +// +// +// +// int indexToStart=path1.indexOf("Media"); +// String path=path1.substring(indexToStart, path1.length()); +// +// +// User usr=userService.findByUsername(principal.getName()); +// +// Set documentMapping=new HashSet(); +// documentMapping.add(new DocumentExternal(docuService.countRow()+1, "Document", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), desc, source, path, 0,0, ServiceUtility.getCurrentTime(), localTopic, usr)); +// +// +// userService.addUserToDocument(usr, documentMapping); +// status.add("Success"); +// +// } catch (Exception e) { +// +// status.add("failure"); +// e.printStackTrace(); +// +// } +// +// +// +// return status; +// } +// +// /************************** ----------------------------------- ******************************************/ +// +// @PostMapping("/addConceptFromUser") +// public @ResponseBody List addConceptFromUser(@RequestParam("classSelected") String classSelected,@RequestParam("subjectSelected") String subSelected, +// @RequestParam("topicSelected") String topicSelected,Principal principal, +// @RequestParam("descriptionConceptMap") String desc,@RequestParam("headlineConceptMap") String remark,@RequestParam("conceptMapImage") MultipartFile[] uploadDocument) throws Exception{ +// +// List status=new ArrayList(); +// +// +// if(!ServiceUtility.checkFileExtensionImage(uploadDocument) && !ServiceUtility.checkFileExtensionZip(uploadDocument)) { +// +// status.add("failure"); +// return status; +// +// } +// +// if(uploadDocument[0].getSize()>fileSize) { +// +// status.add("failure"); +// return status; +// } +// +// Class localClass=classService.findByClassName(Integer.parseInt(classSelected)); +// Subject localSubject=subjectService.findBysubName(subSelected); +// SubjectClassMapping localSubjectClass=subjectClassService.findBysubAndstandard( localClass,localSubject); +// Topic localTopic=topicService.findBysubjectClassMappingAndtopicName(localSubjectClass, topicSelected); +// +// String createFolder=env.getProperty("spring.applicationexternalPath.name")+uploadDirectory+localClass.getClassName()+"_"+localSubject.getSubId()+"/"+localTopic.getTopicId()+"/ConceptMap/"; +// +// +// try { +// String path1=ServiceUtility.uploadFile(uploadDocument, createFolder); +// +// +// +// int indexToStart=path1.indexOf("Media"); +// String path=path1.substring(indexToStart, path1.length()); +// +// +// +// User usr=userService.findByUsername(principal.getName()); +// +// Set conceptMapping=new HashSet(); +// conceptMapping.add(new ConceptMap(concepMapService.countRow()+1, "ConceptMap", ServiceUtility.getCurrentTime(), ServiceUtility.getCurrentTime(), path, desc, 0,0, remark, localTopic, usr)); +// +// userService.addUserToConceptMap(usr, conceptMapping); +// status.add("Success"); +// +// } catch (Exception e) { +// +// status.add("failure"); +// System.out.println("this is failure point"); +// +// } +// +// +// +// return status; +// } + + /*---------------------------------------------------------------END----------------------------------------------------------------------------*/ + + /*----------------- UPDATE PROFILE PICTURE ----------------------------------*/ + + /** + * update USer profile picture + * @param uploadPhoto Image file to be updated + * @param principal Principal object + * @return ok or failure + * @throws Exception + */ + @PostMapping("/updateProfilePic") + public @ResponseBody String updateProfilePic(@RequestParam("profilePicture") MultipartFile[] uploadPhoto,Principal principal) throws Exception{ + + + ServiceUtility.createFolder(env.getProperty("spring.applicationexternalPath.name")+"Media/User/"+principal.getName()+"/Profile"); + + String createFolder=env.getProperty("spring.applicationexternalPath.name")+"Media/User/"+principal.getName()+"/Profile"; + + String documentLocal=ServiceUtility.uploadFile(uploadPhoto, createFolder); + + int indexToStart=documentLocal.indexOf("Media"); + + String document=documentLocal.substring(indexToStart, documentLocal.length()); + + User localUser=userService.findByUsername(principal.getName()); + localUser.setProfilePic(document); + + userService.save(localUser); + + + return "ok"; + } + + + + + /*----------------------- END -------------------------------------------------*/ + + + + +} + + + +/*------------------------------------------------------------END------------------------------------------------------------------*/ diff --git a/src/main/java/com/adminportal/HttpRequestLogger.java b/src/main/java/com/adminportal/HttpRequestLogger.java new file mode 100644 index 0000000..7cc0fd3 --- /dev/null +++ b/src/main/java/com/adminportal/HttpRequestLogger.java @@ -0,0 +1,28 @@ +package com.adminportal; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.logging.log4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.AbstractRequestLoggingFilter; + +@Component +public class HttpRequestLogger extends AbstractRequestLoggingFilter{ + + org.slf4j.Logger logger=LoggerFactory.getLogger(HttpRequestLogger.class); + + @Override + protected void beforeRequest(HttpServletRequest request, String message) { + + logger.info("{},{},{},{}",request.getMethod(),request.getRequestURL(),request.getRemoteAddr(),request.getHeader("User-Agent")); + + } + + @Override + protected void afterRequest(HttpServletRequest request, String message) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/com/adminportal/RegistrationController.java b/src/main/java/com/adminportal/RegistrationController.java new file mode 100644 index 0000000..954c763 --- /dev/null +++ b/src/main/java/com/adminportal/RegistrationController.java @@ -0,0 +1,550 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This Class is a Controller Class + * All Registration url will be caught here. + * New User is categorized in Learner,Parent and teacher + */ + +package com.adminportal; + +import java.security.Principal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Controller; +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.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; + +import com.adminportal.content.Class; +import com.adminportal.content.Events; +import com.adminportal.content.Subject; +import com.adminportal.content.Testimonial; +import com.adminportal.domain.RoleDetail; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; +import com.adminportal.service.ClassService; +import com.adminportal.service.EventService; +import com.adminportal.service.RoleDetailService; +import com.adminportal.service.SubjectService; +import com.adminportal.service.TestimonialService; +import com.adminportal.service.UserRoleService; +import com.adminportal.service.UserService; +import com.spoken.Utility.ServiceUtility; + +/** + * Registration controller to register user under various role + * @author om Prakash + * + */ +@Controller +public class RegistrationController { + + /** + * path to save user data + */ + public static final String uploadTeacherDirectory="Media/User/"; /* path to which teachers document will get stored */ + /** + * Maximum file size of user document + */ + public static final long fileSize=10*1024*1024; + + @Autowired + private UserService userService; + + @Autowired + private ClassService classService; + + @Autowired + private RoleDetailService roleService; + + @Autowired + private UserRoleService userRoleService; + + @Autowired + private Environment env; + + @Autowired + private SubjectService subjectService; + + @Autowired + private TestimonialService testiService; + + @Autowired + private EventService eventService; + +/*------------------------------------------Registration Task Method (LEARNER)-----------------------------------------------------------------*/ + + + /** + * Registers User under Learner Role + * @param req HttpServletRequest object + * @param mv ModelAndView object + * @param principal principal object + * @return ModelAndView object + * @throws Exception + */ + @RequestMapping(value = "/newUserL", method = RequestMethod.POST ) + public ModelAndView addNewUserLearner(HttpServletRequest req,ModelAndView mv,Principal principal) throws Exception { + String email=req.getParameter("email"); + String fname=req.getParameter("txtLearnersFirstname"); + String lname=req.getParameter("txtLearnersLastname"); + String password=req.getParameter("password1"); + String gender=req.getParameter("gender"); + String school_name=req.getParameter("txtLearnersSchoolName"); + String school_address=req.getParameter("txtLearnersSchoolAddress"); + String pincodeString=req.getParameter("txtPincode"); + int pincode=0; + String passwordEncrypt=ServiceUtility.passwordEncoder().encode(password); + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + ArrayList subject = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subject); + + if(pincodeString.length()>6) { + + mv.addObject("FailureL", "Please Enter 6 Digit Pincode"); + mv.addObject("checkedOptionLearner", "checked"); + mv.setViewName("Signup"); + + return mv; + + }else { + + pincode=Integer.parseInt(pincodeString); + + } + + if(!ServiceUtility.checkEmailValidity(email)) { + + mv.addObject("FailureL", "Please Enter valid E-mail"); + mv.addObject("checkedOptionLearner", "checked"); + mv.setViewName("Signup"); + + return mv; + } + + if(userService.existByEmail(email)) { // check for already email exist + + mv.addObject("FailureL", "E-mail Already Exist"); + mv.addObject("checkedOptionLearner", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + if(!password.equals(req.getParameter("password2"))) { // check for password and confirm password equality + + mv.addObject("FailureL", "Password & Confirm Password Doesn't match"); + mv.addObject("checkedOptionLearner", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + String date=req.getParameter("txtdate"); // conversion String to DAte Object value + SimpleDateFormat sd1=new SimpleDateFormat("yyyy-MM-dd"); + java.util.Date dateUtil=sd1.parse(date); + Date dateOfBirth=new Date(dateUtil.getTime()); + + if(!dateOfBirth.before(ServiceUtility.getCurrentTime())) { + + mv.addObject("FailureL", "Please enter previous date"); + mv.addObject("checkedOptionLearner", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + RoleDetail role=roleService.findByRoleName("Learner"); + + User usr=new User(); + usr.setId(userService.countRow()+1); + usr.setEmail(email); + usr.setPassword(passwordEncrypt); + usr.setFname(fname); + usr.setLname(lname); + usr.setSex(gender); + usr.setSchoolName(school_name); + usr.setSchoolAddress(school_address); + usr.setPincode(pincode); + usr.setDateAdded(ServiceUtility.getCurrentTime()); + usr.setLastLogin(ServiceUtility.getCurrentTime()); + usr.setDateOfBirth(dateOfBirth); + usr.setRegistered(1); + usr.setApproveTeacherFlag(0); + + Set userRoles=new HashSet(); + userRoles.add(new UserRole(userRoleService.countRow()+1,usr, role)); // persisting user(Learner) + + + userService.createUser(usr, userRoles); + mv.addObject("registerDone", "yes"); + + ArrayList standard = (ArrayList) classService.findAll(); + + ArrayList subject1 = (ArrayList) subjectService.findAll(); + + List testidata = testiService.getAlltestimonial(); + + List eventData = eventService.getAllEventdata(); + + if (testidata.size() > 0) { + + + List temp2 = new ArrayList(); + for (int i = 0; i < testidata.size(); i++) { + temp2.add(testidata.get(i)); + if(i==2) + break; + } + + mv.addObject("TestimonialRest", temp2); + + } + + if (eventData.size() > 0) { + + List eventTemp = new ArrayList(); + eventTemp.add(eventData.get(0)); + for (int i = 1; i < eventData.size(); i++) { + eventTemp.add(eventData.get(i)); + if(i==2) { + break; + } + } + + mv.addObject("Events", eventTemp); + } + + mv.addObject("classfromDatabase", standard); + mv.addObject("subjectfromDatabase", subject1); + + mv.setViewName("Index"); + return mv; + + } + + +/*-------------------------------------------------------END-------------------------------------------------------------------------------- + /*------------------------------------------Registration Task Method (PARENT)-----------------------------------------------------------------*/ + + + /** + * Registers User under Parent Role + * @param req HttpServletRequest object + * @param mv ModelAndView object + * @param principal principal object + * @return ModelAndView object + * @throws Exception + */ + @RequestMapping(value = "/newUserP", method = RequestMethod.POST ) + public ModelAndView addNewUserParent(HttpServletRequest req,ModelAndView mv,Principal principal) throws Exception { + + String email=req.getParameter("email"); + String fname=req.getParameter("txtParentsFirstname"); + String lname=req.getParameter("txtParentsLastname"); + String password=req.getParameter("password"); + String gender=req.getParameter("gender"); + String passwordEncrypt=ServiceUtility.passwordEncoder().encode(password); + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + ArrayList subject = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subject); + + if(!ServiceUtility.checkEmailValidity(email)) { + + mv.addObject("FailureP", "Please Enter Valid E-mail"); + mv.addObject("checkedOptionParent", "checked"); + mv.setViewName("Signup"); + + return mv; + } + + if(userService.existByEmail(email)) { // check for already email exist + + + mv.addObject("FailureP", "E-mail Already Exist"); + mv.addObject("checkedOptionParent", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + if(!password.equals(req.getParameter("Confpassword"))) { // check for password and confirm password equality + + + mv.addObject("FailureP", "Password & Confirm Password Doesn't match"); + mv.addObject("checkedOptionParent", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + + RoleDetail role=roleService.findByRoleName("Parent"); + + User usr=new User(); + usr.setId(userService.countRow()+1); + usr.setEmail(email); + usr.setPassword(passwordEncrypt); + usr.setFname(fname); + usr.setLname(lname); + usr.setSex(gender); + usr.setDateAdded(ServiceUtility.getCurrentTime()); + usr.setLastLogin(ServiceUtility.getCurrentTime()); + usr.setRegistered(1); + usr.setApproveTeacherFlag(0); + + Set userRoles=new HashSet(); + userRoles.add(new UserRole(userRoleService.countRow()+1,usr, role)); + + + userService.createUser(usr, userRoles); // persisting user(Parent) + + mv.addObject("registerDone", "yes"); + ArrayList standard = (ArrayList) classService.findAll(); + + ArrayList subject1 = (ArrayList) subjectService.findAll(); + + List testidata = testiService.getAlltestimonial(); + + List eventData = eventService.getAllEventdata(); + + if (testidata.size() > 0) { + + + List temp2 = new ArrayList(); + for (int i = 0; i < testidata.size(); i++) { + temp2.add(testidata.get(i)); + if(i==2) + break; + } + + mv.addObject("TestimonialRest", temp2); + + } + + if (eventData.size() > 0) { + + List eventTemp = new ArrayList(); + eventTemp.add(eventData.get(0)); + for (int i = 1; i < eventData.size(); i++) { + eventTemp.add(eventData.get(i)); + if(i==2) { + break; + } + } + + mv.addObject("Events", eventTemp); + } + + mv.addObject("classfromDatabase", standard); + mv.addObject("subjectfromDatabase", subject1); + + mv.setViewName("Index"); + return mv; + } + + /*------------------------------------------------------END-------------------------------------------------------------------------------------*/ + /*------------------------------------------Registration Task Method (TEACHER)-----------------------------------------------------------------*/ + + /** + * Registers User under Teacher Role + * @param principal principal object + * @param uploadDocument Document of user to be uploaded + * @param req HttpServletRequest object + * @param mv ModelAndView object + * @return ModelAndView object + * @throws Exception + */ + @RequestMapping(value = "/newUserT", method = RequestMethod.POST ) + public ModelAndView addNewUserTeacher(Principal principal,@RequestParam("txtTeacherDocument") MultipartFile[] uploadDocument,HttpServletRequest req,ModelAndView mv) throws Exception { + + String email=req.getParameter("email"); + String fname=req.getParameter("txtTeacherFirstname"); + String lname=req.getParameter("txtTeacherLastname"); + String password=req.getParameter("password"); + String gender=req.getParameter("gender"); + String passwordEncrypt=ServiceUtility.passwordEncoder().encode(password); + + if(principal != null) { + User localUser=userService.findByUsername(principal.getName()); + + mv.addObject("LoggedUser",localUser); + } + + ArrayList subject = (ArrayList) subjectService.findAll(); + mv.addObject("subjectfromDatabase", subject); + + if(!ServiceUtility.checkEmailValidity(email)) { + + mv.addObject("FailureT", "Please Enter Valid E-mail"); + mv.addObject("checkedOptionTeacher", "checked"); + mv.setViewName("Signup"); + + return mv; + } + + if(!ServiceUtility.checkFileExtensionImage(uploadDocument)) { // validate against Image file + + mv.addObject("checkedOptionTeacher", "checked"); + mv.addObject("FailureT", "Please Upload only Image File"); + mv.setViewName("Signup"); + + return mv; + + } + + if(uploadDocument[0].getSize()>fileSize) { + + mv.addObject("checkedOptionTeacher", "checked"); + mv.addObject("FailureT", "FileSize must be within 10MB"); + mv.setViewName("Signup"); + + return mv; + } + + + + if(userService.existByEmail(email)) { // check for already email exist + + mv.addObject("FailureT", "E-mail Already Exist"); + mv.addObject("checkedOptionTeacher", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + if(!password.equals(req.getParameter("Confpassword"))) { // check for password and confirm password equality + + + mv.addObject("FailureT", "Password & Confirm Password Doesn't match"); + mv.addObject("checkedOptionTeacher", "checked"); + mv.setViewName("Signup"); + + return mv; + + } + + /***************** creating folder for Storing Teacher data *************************************/ + + try { + boolean path_creation=ServiceUtility.createFolder(env.getProperty("spring.applicationexternalPath.name")+uploadTeacherDirectory+email+"/Document"); + + + String pathtoUploadteacherData=env.getProperty("spring.applicationexternalPath.name")+uploadTeacherDirectory+email+"/Document"; + + String documentLocal=ServiceUtility.uploadFile(uploadDocument, pathtoUploadteacherData); + + int indexToStart=documentLocal.indexOf("Media"); + + String document=documentLocal.substring(indexToStart, documentLocal.length()); + + + RoleDetail role=roleService.findByRoleName("Teacher"); + + User usr=new User(); + usr.setId(userService.countRow()+1); + usr.setEmail(email); + usr.setPassword(passwordEncrypt); + usr.setFname(fname); + usr.setLname(lname); + usr.setSex(gender); + usr.setDateAdded(ServiceUtility.getCurrentTime()); + usr.setLastLogin(ServiceUtility.getCurrentTime()); + usr.setRegistered(0); + usr.setApproveTeacherFlag(0); + usr.setDocument(document); + + + Set userRoles=new HashSet(); + userRoles.add(new UserRole(userRoleService.countRow()+1,usr, role)); + + + userService.createUser(usr, userRoles); // persist user (Teacher) + + mv.addObject("registerDone", "yes"); + } catch (Exception e) { + + mv.addObject("FailureT", "Please Try Again"); + e.printStackTrace(); + } + + + ArrayList standard = (ArrayList) classService.findAll(); + + ArrayList subject1 = (ArrayList) subjectService.findAll(); + + List testidata = testiService.getAlltestimonial(); + + List eventData = eventService.getAllEventdata(); + + if (testidata.size() > 0) { + + + List temp2 = new ArrayList(); + for (int i = 0; i < testidata.size(); i++) { + temp2.add(testidata.get(i)); + if(i==2) + break; + } + + mv.addObject("TestimonialRest", temp2); + + } + + if (eventData.size() > 0) { + + List eventTemp = new ArrayList(); + eventTemp.add(eventData.get(0)); + for (int i = 1; i < eventData.size(); i++) { + eventTemp.add(eventData.get(i)); + if(i==2) { + break; + } + } + + mv.addObject("Events", eventTemp); + } + + mv.addObject("classfromDatabase", standard); + mv.addObject("subjectfromDatabase", subject1); + + mv.setViewName("Index"); + return mv; + } + + +/*----------------------------------------------------------------------------------END---------------------------------------------------------------*/ + + + +} diff --git a/src/main/java/com/adminportal/config/ExternalFileConfig.java b/src/main/java/com/adminportal/config/ExternalFileConfig.java new file mode 100644 index 0000000..ab9695b --- /dev/null +++ b/src/main/java/com/adminportal/config/ExternalFileConfig.java @@ -0,0 +1,38 @@ +package com.adminportal.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * This class is responsible for configuring external path(outside project Directory) to save resource like file and videos + * to be used in project + * @author om prakash + * + */ +@Configuration +public class ExternalFileConfig implements WebMvcConfigurer{ + + @Autowired + private Environment env; + + + /** + *This method is to register path which can be used for saving resources outside the project Directory + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + + + registry.addResourceHandler("/files/**") + .addResourceLocations("file:"+env.getProperty("spring.applicationexternalPath.name")); + + System.out.println("Config side"); + + } + + + +} diff --git a/src/main/java/com/adminportal/config/MailConstructor.java b/src/main/java/com/adminportal/config/MailConstructor.java new file mode 100644 index 0000000..0df71ab --- /dev/null +++ b/src/main/java/com/adminportal/config/MailConstructor.java @@ -0,0 +1,57 @@ +package com.adminportal.config; + +import java.util.Locale; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.stereotype.Component; + +import com.adminportal.domain.User; + +/** + * This class construct Email with all different property + * @author om prakash + * + */ +@Component +public class MailConstructor { + + /** + * This create simpleMail Template to send mail to user for retrieving password for their account. + * @param contextPath A full qualified Url + * @param locale locale Object + * @param token A String consisting random set of string + * @param user User Object + * @return SimpleMailMessage Object with inducted Configuration. + */ + public SimpleMailMessage constructResetTokenEmail( + String contextPath, Locale locale, String token, User user + ) { + + String url = contextPath + "/reset?token="+token; + String message = "\nPlease click on this link to Update your password"; + SimpleMailMessage email = new SimpleMailMessage(); + email.setTo(user.getEmail()); + email.setSubject("Reset Password"); + email.setText(url+message); + /* email.setFrom(env.getProperty("support.email")); */ + return email; + + } + + /** + * This create simpleMail Template to send mail to user on getting approved for Teacher Role. + * @param usr User Object + * @return SimpleMailMessage Object with inducted Configuration. + */ + public SimpleMailMessage confirmOnApproveTeacher(User usr) { + String message="Hello your account has been verified now you can login into our website"; + SimpleMailMessage email=new SimpleMailMessage(); + email.setSubject("Account Activated"); + email.setText(message); + email.setTo(usr.getEmail()); + return email; + } +} + diff --git a/src/main/java/com/adminportal/config/SecurityConfig.java b/src/main/java/com/adminportal/config/SecurityConfig.java new file mode 100644 index 0000000..734dcb8 --- /dev/null +++ b/src/main/java/com/adminportal/config/SecurityConfig.java @@ -0,0 +1,172 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This class is used for setting up the basic property under Spring security framework like + * 1. Authentication + * 2. Authorization + * 3. Login + * 4. Logout + * 5. Security on various Pages. + * Not in Use Now, but will come into picture once Log-in and Log-out made it from Spring Security framework. + */ + +package com.adminportal.config; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import com.adminportal.service.impl.UserSecurityService; +import com.spoken.Utility.ServiceUtility; + +/** + * This class Configures Spring security in project + * @author om prakash + * + */ +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled=true) +public class SecurityConfig extends WebSecurityConfigurerAdapter{ + + @Autowired + private Environment env; + + @Autowired + private UserSecurityService userSecurityService; + + private BCryptPasswordEncoder passwordEncoder() { + return ServiceUtility.passwordEncoder(); + } + + /** + * All url matchers don't want to get authenticated before use. + */ + private static final String[] PUBLIC_MATCHERS = { + "/css/**", + "/js/**", + "/Images/**", + "/img/**", + "/js/**", + "/static/**", + "/font/**", + "/", + "/datatables.min.js", + "/datatables.min.css", + "/webfonts/**", + "/Login", + "/courses", + "/Signup", + "/files/**", + "/loadByClassName", + "/loadBySubjectName", + "/validateEmail", + "/newUserP", + "/newUserL", + "/newUserT", + "/content/**", + "/contentTutorial/**", + "/contentLesson/**", + "/contentPhet/**", + "/contentQuiz/**", + "/contentLink/**", + "/contentConcept/**", + "/addContactForm", + "/eventsList/**", + "/testimonials", + "/forgetPassword/**", + "/reset", + "/resetPassword", + "/loadByTopicName", + "/topicOnClass/**", + "/topicOnSubject/**", + "/loadByTestimonialID", + "/About-Us/**", + + "/loadByClassnameAndSubject", + "/loadByUser", + "/loadByValidity", + "/loadBySubject", + "/loadByClass", + "/loadBySubjectClass", + "/loadByTopic", + "/loadByTopicDesc", + "/loadByQuizQuestionID", + "/loadByVideoID", + "/loadByVideoIDSource", + "/loadByArtcileID", + "/loadByArtcileIDDesc", + "/loadByDocumentID", + "/loadByDocumentIDDesc", + "/loadByphetID", + "/loadByphetIDDesc", + "/updateSubject", + "/updateTopic", + "/updateQuiz", + "/updateDocument", + "/updateVideo", + "/updatePhet", + "/updateArticle" + + + }; + + /** + * ALl Url made especially under Contributor Role + */ + public static final String[] CONTRIBUTOR_URL= { + "/conVideo/**", + "/conDocument/**", + "/conArticle/**", + "/conQuiz/**", + "/conPhet/**", + "/conLessonPlan/**", + "/conConceptMap/**", + "/conView/**" + }; + + /** + * This method configure security in project like login, authentication, authorization etc. + */ + @Override + protected void configure(HttpSecurity http)throws Exception{ + + http.authorizeRequests() + .antMatchers("/admin/**").hasAnyAuthority("Admin") + .antMatchers(CONTRIBUTOR_URL).hasAnyAuthority("Teacher") + .antMatchers(PUBLIC_MATCHERS).permitAll() + .anyRequest().authenticated() + .and() + .exceptionHandling().accessDeniedPage("/accessDenied"); + + http. + formLogin().failureUrl("/Login?error").defaultSuccessUrl("/") + .loginPage("/Login").permitAll() + .and() + .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")) + .logoutSuccessUrl("/logout-success").deleteCookies("remember-me").permitAll() + .and() + .rememberMe(); + + + + + + } + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(userSecurityService).passwordEncoder(passwordEncoder()); + } + + + +} diff --git a/src/main/java/com/adminportal/content/ArticleExternal.java b/src/main/java/com/adminportal/content/ArticleExternal.java new file mode 100644 index 0000000..e077932 --- /dev/null +++ b/src/main/java/com/adminportal/content/ArticleExternal.java @@ -0,0 +1,229 @@ + +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : The is a Modal Class to persist Article related data to database + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Article Resource data + * @author om Prakash + * + */ +@Entity +@Table(name="content") +public class ArticleExternal { + + /** + * A unique ID representing single Article Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int articleId; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + /** + * A long description of resource + */ + @Column(name="description",length = 10000) + private String description; + + /** + * Reference to from which resource is taken + */ + @Column(name="source") + private String source; + + /** + * A proper link of resource + */ + @Column(name="url") + private String url; + + /** + * Visibility + */ + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + /** + * date on which resource got approved. + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "article",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public ArticleExternal() {} + + public ArticleExternal(int articleId, String type, Timestamp dateAdded, Timestamp dateModified, String description, + String source, String url, int status, int acceptedByAdmin,Timestamp dateApproved, Topic topic, User user) { + + this.articleId = articleId; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.description = description; + this.source = source; + this.url = url; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.dateApproved = dateApproved; + this.topic = topic; + this.user = user; + } + + public int getArticleId() { + return articleId; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public void setArticleId(int articleId) { + this.articleId = articleId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public int isStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Timestamp getDateApproved() { + return dateApproved; + } + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + +} + diff --git a/src/main/java/com/adminportal/content/Class.java b/src/main/java/com/adminportal/content/Class.java new file mode 100644 index 0000000..0bfd43f --- /dev/null +++ b/src/main/java/com/adminportal/content/Class.java @@ -0,0 +1,109 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Class Modal to persist Class related data into database. + */ +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +import com.adminportal.domain.User; +/** + * This class Represent Entity which stores Class data + * @author om prakash + * + */ +@Entity +@Table(name="Class") +public class Class { + + /** + * A unique ID representing single Class + */ + @Id + @Column(nullable = false,updatable = false) + private int class_id; + + /** + * Name of class like 1,2 etc + */ + @Column(name="class_name",nullable = false) + private int className; + + /** + * Visibility + */ + @Column(name="status",nullable = false) + private boolean status=true; + + /** + * date on which class is being added. + */ + @Column(name="date_added",nullable = false) + private Timestamp dateAdded; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "standard",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set subClasMapp=new HashSet(); + + + + public Set getSubClasMapp() { + return subClasMapp; + } + public void setSubClasMapp(Set subClasMapp) { + this.subClasMapp = subClasMapp; + } + + public int getClass_id() { + return class_id; + } + public void setClass_id(int class_id) { + this.class_id = class_id; + } + public int getClassName() { + return className; + } + public void setClassName(int className) { + this.className = className; + } + public Timestamp getDateAdded() { + return dateAdded; + } + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + public User getUser() { + return user; + } + public void setUser(User user) { + this.user = user; + } + public boolean isStatus() { + return status; + } + public void setStatus(boolean status) { + this.status = status; + } + + + +} diff --git a/src/main/java/com/adminportal/content/Comment.java b/src/main/java/com/adminportal/content/Comment.java new file mode 100644 index 0000000..f12df60 --- /dev/null +++ b/src/main/java/com/adminportal/content/Comment.java @@ -0,0 +1,213 @@ + +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Comment Modal for capturing comment from various USer from View and subsequently persist same to database. + */ +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Comment made in system under various resources + * @author om Prakash + * + */ +@Entity +@Table(name="comment") +public class Comment { + + /** + * A unique ID representing single Comment + */ + @Id + @Column(name="comment_id",nullable = false,updatable = false) + private int commentid; + + /** + * DAte on which comment is made + */ + @Column(name="date_added",nullable = false,updatable = false) + private Timestamp dateAdded; + + /** + * Actual Comment + */ + @Column(name="comment",nullable = false) + private String comment; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "comment",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set commentreply=new HashSet(); + + @ManyToOne(fetch=FetchType.LAZY) + @JoinColumn(name="article_id",updatable = false) + private ArticleExternal article; + + @ManyToOne(fetch=FetchType.LAZY) + @JoinColumn(name="quiz_id",updatable = false) + private QuizQuestion quiz; + + @ManyToOne(fetch=FetchType.LAZY) + @JoinColumn(name="lesson_id",updatable = false) + private LessonPlan lesson; + + @ManyToOne(fetch=FetchType.LAZY) + @JoinColumn(name="video_id",updatable = false) + private VideoExternal video; + + @ManyToOne(fetch=FetchType.LAZY) + @JoinColumn(name="phet_id",updatable = false) + private Phets phet; + + @ManyToOne(fetch=FetchType.LAZY) + @JoinColumn(name="document_id",updatable = false) + private DocumentExternal document; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ConceptMap_id",updatable = false) + private ConceptMap conceptMap; + + public int getCommentid() { + return commentid; + } + + public void setCommentid(int commentid) { + this.commentid = commentid; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public Comment() {} + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, VideoExternal video) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.video = video; + } + + + + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, DocumentExternal document) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.document = document; + } + + + + + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, Phets phet) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.phet = phet; + } + + + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, LessonPlan lesson) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.lesson = lesson; + } + + + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, QuizQuestion quiz) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.quiz = quiz; + } + + + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, ArticleExternal article) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.article = article; + } + + public Comment(int commentid, Timestamp dateAdded, String comment, User user, ConceptMap concept) { + + this.commentid = commentid; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + this.conceptMap = concept; + } + + + + public Set getCommentreply() { + return commentreply; + } + + public void setCommentreply(Set commentreply) { + this.commentreply = commentreply; + } + + + +} diff --git a/src/main/java/com/adminportal/content/CommentReply.java b/src/main/java/com/adminportal/content/CommentReply.java new file mode 100644 index 0000000..15e20ab --- /dev/null +++ b/src/main/java/com/adminportal/content/CommentReply.java @@ -0,0 +1,123 @@ + +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Comment Reply modal to capture reply of each comment made earlier from various user and then persist to database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import com.adminportal.domain.User; +/** + * This class Represent Entity which stores CommentReply + * @author om prakash + * + */ +@Entity +@Table(name="Comment_Reply") +public class CommentReply { + + /** + * A unique ID representing single CommentReply + */ + @Id + @Column(name="com_reply_Id",nullable = false,updatable = false) + private int commentReplyId; + + /** + * Actual Reply to Comment + */ + @Column(name = "comment",nullable = false) + private String commentReply; + + /** + * Date on which reply is made. + */ + @Column(name = "date_added",nullable = false,updatable = false) + private Timestamp dateAdded; + + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="comment_id") + private Comment comment; + + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="user_id") + private User user; + + public CommentReply() {} + + + + public CommentReply(int commentReplyId, String commentReply, Timestamp dateAdded, Comment comment, User user) { + + this.commentReplyId = commentReplyId; + this.commentReply = commentReply; + this.dateAdded = dateAdded; + this.comment = comment; + this.user = user; + } + + + public int getCommentReplyId() { + return commentReplyId; + } + + + public void setCommentReplyId(int commentReplyId) { + this.commentReplyId = commentReplyId; + } + + + public String getCommentReply() { + return commentReply; + } + + + public void setCommentReply(String commentReply) { + this.commentReply = commentReply; + } + + + public Timestamp getDateAdded() { + return dateAdded; + } + + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + + public Comment getComment() { + return comment; + } + + + public void setComment(Comment comment) { + this.comment = comment; + } + + + public User getUser() { + return user; + } + + + public void setUser(User user) { + this.user = user; + } + + +} diff --git a/src/main/java/com/adminportal/content/ConceptMap.java b/src/main/java/com/adminportal/content/ConceptMap.java new file mode 100644 index 0000000..902d211 --- /dev/null +++ b/src/main/java/com/adminportal/content/ConceptMap.java @@ -0,0 +1,234 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Comment Concept-map modal to capture all concept-map related data and then persist same to database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; +/** + * This class Represent Entity which stores ConceptMap Resource data + * @author om Prakash + * + */ +@Entity +@Table(name="content") +public class ConceptMap { + + /** + * A unique ID representing single ConceptMap Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int concepMapid; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + /** + * A proper link of resource + */ + @Column(name="url") + private String url; + + + /** + * A long description of resource + */ + @Column(name="description",length = 10000) + private String description; + + /** + * date on which resource got approved. + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + @Column(name="remarks") + private String remark; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "conceptMap",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public ConceptMap() {} + + + + public Timestamp getDateApproved() { + return dateApproved; + } + + + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + + + public ConceptMap(int concepMapid, String type, Timestamp dateAdded, Timestamp dateModified, String url, + String description, int status,int acceptedByAdmin, String remark, Topic topic, User user) { + super(); + this.concepMapid = concepMapid; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.url = url; + this.description = description; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.remark = remark; + this.topic = topic; + this.user = user; + } + + + + public int getConcepMapid() { + return concepMapid; + } + + public void setConcepMapid(int concepMapid) { + this.concepMapid = concepMapid; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + + + +} diff --git a/src/main/java/com/adminportal/content/ContactForm.java b/src/main/java/com/adminportal/content/ContactForm.java new file mode 100644 index 0000000..cb9359d --- /dev/null +++ b/src/main/java/com/adminportal/content/ContactForm.java @@ -0,0 +1,106 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Comment feedback/contact form modal to capture visitor information and persist same to database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.hibernate.validator.constraints.Length; + +/** + * This class Represent Entity which stores All the Queries made to the web application + * @author om prakash + * + */ +@Entity +@Table(name = "contact_Form") +public class ContactForm { + + /** + * A unique Id represent Entity + */ + @Id + @Column(updatable = false,nullable = false) + private int contactId; + + /** + * name of person + */ + @Column(updatable = false,nullable = false) + private String name; + + /** + * email of person + */ + @Column(updatable = false,nullable = false) + private String email; + + /** + * A long Description + */ + @Column(updatable = false,nullable = false,length = 10000) + private String message; + + /** + * date on which query is made + */ + @Column(updatable = false,nullable = false) + Timestamp dataAdded; + + public int getContactId() { + return contactId; + } + + public void setContactId(int contactId) { + this.contactId = contactId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Timestamp getDataAdded() { + return dataAdded; + } + + public void setDataAdded(Timestamp dataAdded) { + this.dataAdded = dataAdded; + } + + @Override + public String toString() { + return "ContactForm [contactId=" + contactId + ", name=" + name + ", email=" + email + ", Message=" + message + + ", dataAdded=" + dataAdded + "]"; + } + + + +} diff --git a/src/main/java/com/adminportal/content/DocumentExternal.java b/src/main/java/com/adminportal/content/DocumentExternal.java new file mode 100644 index 0000000..1c251e1 --- /dev/null +++ b/src/main/java/com/adminportal/content/DocumentExternal.java @@ -0,0 +1,226 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This Document Modal to capture All document related data and then persist same to database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Document Resource data + * @author om Prakash + * + */ +@Entity +@Table(name="content") +public class DocumentExternal { + + /** + * A unique ID representing single Document Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int documentId; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + + /** + * A long description of resource + */ + @Column(name="description",length = 10000) + private String description; + + /** + * A reference from where resource is used + */ + @Column(name="source") + private String source; + + /** + * A proper link of resource + */ + @Column(name="url") + private String url; + + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + /** + * date on which resource got approved. + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "document",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public DocumentExternal() {} + + public DocumentExternal(int documentId, String type, Timestamp dateAdded, Timestamp dateModified, + String description, String source, String url, int status,int acceptedByAdmin, Timestamp dateApproved, Topic topic, + User user) { + + this.documentId = documentId; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.description = description; + this.source = source; + this.url = url; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.dateApproved = dateApproved; + this.topic = topic; + this.user = user; + } + + public int getDocumentId() { + return documentId; + } + + public void setDocumentId(int documentId) { + this.documentId = documentId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public int isStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Timestamp getDateApproved() { + return dateApproved; + } + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + +} diff --git a/src/main/java/com/adminportal/content/Events.java b/src/main/java/com/adminportal/content/Events.java new file mode 100644 index 0000000..211d49a --- /dev/null +++ b/src/main/java/com/adminportal/content/Events.java @@ -0,0 +1,202 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Event modal to persist Event related data into database. + */ +package com.adminportal.content; + +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.hibernate.validator.constraints.Length; + +/** + * This class Represent Entity which stores Event data + * @author om prakash + * + */ +@Entity +@Table(name = "Event") +public class Events { + + /** + * A unique ID of event + */ + @Id + @Column(nullable = false,updatable = false) + private int eventId; + + /** + * String based Description + */ + @Column(nullable = false) + private String headline; + + /** + * Name of Coordinator + */ + @Column(nullable = false) + private String coordName; + + /** + * A long description about Event + */ + @Column(nullable = false,length = 10000) + @Length(max = 10000) + private String description; + + /** + * Date on which Event added + */ + @Column(nullable = false,updatable = false) + private Timestamp dateAdded; + + /** + * Start date of event + */ + @Column(nullable = false) + private Date dateToHappenStart; + + /** + * end date of event + */ + @Column(nullable = false) + private Date dateToHappenEnd; + + /** + * Start date of Registration + */ + @Column(nullable = false) + private Date registStart; + + /** + * End date of Registration + */ + @Column(nullable = false) + private Date registEnd; + + /** + * Path of poster + */ + @Column(nullable = false) + private String potser_path; + + /** + * Mode of event like, virtual etc + */ + @Column(nullable = false) + private String mode; + + /** + * Location + */ + @Column(nullable = false) + private String location; + + public int getEventId() { + return eventId; + } + + public void setEventId(int eventId) { + this.eventId = eventId; + } + + public String getHeadline() { + return headline; + } + + public void setHeadline(String headline) { + this.headline = headline; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + + public String getPotser_path() { + return potser_path; + } + + public void setPotser_path(String potser_path) { + this.potser_path = potser_path; + } + + public String getMode() { + return mode; + } + + public void setMode(String mode) { + this.mode = mode; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getCoordName() { + return coordName; + } + + public void setCoordName(String coordName) { + this.coordName = coordName; + } + + + public Date getDateToHappenStart() { + return dateToHappenStart; + } + + public void setDateToHappenStart(Date dateToHappenStart) { + this.dateToHappenStart = dateToHappenStart; + } + + public Date getDateToHappenEnd() { + return dateToHappenEnd; + } + + public void setDateToHappenEnd(Date dateToHappenEnd) { + this.dateToHappenEnd = dateToHappenEnd; + } + + public Date getRegistStart() { + return registStart; + } + + public void setRegistStart(Date registStart) { + this.registStart = registStart; + } + + public Date getRegistEnd() { + return registEnd; + } + + public void setRegistEnd(Date registEnd) { + this.registEnd = registEnd; + } + + + + +} diff --git a/src/main/java/com/adminportal/content/LessonPlan.java b/src/main/java/com/adminportal/content/LessonPlan.java new file mode 100644 index 0000000..9fe73ab --- /dev/null +++ b/src/main/java/com/adminportal/content/LessonPlan.java @@ -0,0 +1,195 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : this is LEsson Plan Modal to store data related to lesson plan into database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores LessonPlan Resource data + * @author om Prakash + * + */ +@Entity +@Table(name="content") +public class LessonPlan { + + /** + * A unique ID representing single LessonPlan Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int lessonPlanId; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + /** + * Path to save LessonPlan Document + */ + @Column(name="lesson_plan") + private String lessonPlan; + + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + /** + * date on which resource got approved. + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "lesson",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public LessonPlan () {} + + public LessonPlan(int lessonPlanId, String type, Timestamp dateAdded, Timestamp dateModified, String lessonPlan, + int status,int acceptedByAdmin, Timestamp dateApproved, Topic topic, User user) { + super(); + this.lessonPlanId = lessonPlanId; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.lessonPlan = lessonPlan; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.dateApproved = dateApproved; + this.topic = topic; + this.user = user; + } + + public int getLessonPlanId() { + return lessonPlanId; + } + + public void setLessonPlanId(int lessonPlanId) { + this.lessonPlanId = lessonPlanId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getLessonPlan() { + return lessonPlan; + } + + public void setLessonPlan(String lessonPlan) { + this.lessonPlan = lessonPlan; + } + + public int isStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Timestamp getDateApproved() { + return dateApproved; + } + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + + +} diff --git a/src/main/java/com/adminportal/content/Phets.java b/src/main/java/com/adminportal/content/Phets.java new file mode 100644 index 0000000..007de60 --- /dev/null +++ b/src/main/java/com/adminportal/content/Phets.java @@ -0,0 +1,230 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Decription : This is Phets Modal to store its related data to database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Phet Resource data + * @author om Prakash + * + */ +@Entity +@Table(name="content") +public class Phets { + + /** + * A unique ID representing single Phet Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int phetId; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + + /** + * A long description of resource + */ + @Column(name="description",length = 10000) + private String description; + + /** + * A reference from where resource is used + */ + @Column(name="source") + private String source; + + /** + * A proper link of resource + */ + @Column(name="url") + private String url; + + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + /** + * date on which resource got approved. + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "phet",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public Phets() {} + + public Phets(int phetId, String type, Timestamp dateAdded, Timestamp dateModified, String description, + String source, String url, int status,int acceptedByAdmin, Timestamp dateApproved, Topic topic, User user) { + + this.phetId = phetId; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.description = description; + this.source = source; + this.url = url; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.dateApproved = dateApproved; + this.topic = topic; + this.user = user; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public int getPhetId() { + return phetId; + } + + public void setPhetId(int phetId) { + this.phetId = phetId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public int isStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Timestamp getDateApproved() { + return dateApproved; + } + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + + public void setDesc(String desc) { + this.description = desc; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + +} diff --git a/src/main/java/com/adminportal/content/QuizQuestion.java b/src/main/java/com/adminportal/content/QuizQuestion.java new file mode 100644 index 0000000..f3e02f3 --- /dev/null +++ b/src/main/java/com/adminportal/content/QuizQuestion.java @@ -0,0 +1,225 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Quiz Modal to store Quiz related information like question and answer. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Quiz Resource data + * @author om Prakash + * + */ +@Entity +@Table(name="content") +public class QuizQuestion { + + /** + * A unique ID representing single Quiz Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int quizQuestionId; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + /** + * Path to store Question_Paper + */ + @Column(name="question_path") + private String question; + + /** + * Path to store Answer_paper + */ + @Column(name="answer_path") + private String answer; + + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + + /** + * A description of resource + */ + @Column(name="remarks") + private String remark; + + /** + * date on which resource got approved. + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "quiz",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public QuizQuestion() {} + + public QuizQuestion(int id,String type, Timestamp dateAdded, Timestamp dateModified, String question, String answer, + int status,int acceptedByAdmin, String remark, Timestamp dateApproved, Topic topic, User user) { + + this.quizQuestionId=id; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.question = question; + this.answer = answer; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.remark = remark; + this.dateApproved = dateApproved; + this.topic = topic; + this.user = user; + } + + public int getQuizQuestionId() { + return quizQuestionId; + } + + public void setQuizQuestionId(int quizQuestionId) { + this.quizQuestionId = quizQuestionId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getQuestion() { + return question; + } + + public void setQuestion(String question) { + this.question = question; + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + public int isStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Timestamp getDateApproved() { + return dateApproved; + } + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + +} diff --git a/src/main/java/com/adminportal/content/Subject.java b/src/main/java/com/adminportal/content/Subject.java new file mode 100644 index 0000000..22e1d01 --- /dev/null +++ b/src/main/java/com/adminportal/content/Subject.java @@ -0,0 +1,123 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Subject Modal to Store subject related infor into database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Subjecr data + * @author om prakash + * + */ +@Entity +@Table(name="Subject") +public class Subject implements Comparable{ + + /** + * A unique ID of subject + */ + @Id + @Column(nullable = false,updatable = false) + private int subId; + + /** + * Subject Name + */ + @Column(name="sub_name",nullable = false) + private String subName; + + @Column(name="status",nullable = false) + private boolean status=true; + + /** + * date on which subject is added. + */ + @Column(name="date_added",nullable = false) + private Timestamp dateAdded; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy ="sub",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set subClasMapp=new HashSet(); + + + public int getSubId() { + return subId; + } + + public void setSubId(int subId) { + this.subId = subId; + } + + public String getSubName() { + return subName; + } + + public void setSubName(String subName) { + this.subName = subName; + } + + public Set getSubClasMapp() { + return subClasMapp; + } + + public void setSubClasMapp(Set subClasMapp) { + this.subClasMapp = subClasMapp; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public boolean isStatus() { + return status; + } + + public void setStatus(boolean status) { + this.status = status; + } + + @Override + public int compareTo(Subject s1) { + + return this.subName.compareTo(s1.subName); + } + + + +} diff --git a/src/main/java/com/adminportal/content/SubjectClassMapping.java b/src/main/java/com/adminportal/content/SubjectClassMapping.java new file mode 100644 index 0000000..456792f --- /dev/null +++ b/src/main/java/com/adminportal/content/SubjectClassMapping.java @@ -0,0 +1,109 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This modal is representation of many-many relation among Class and subject. + */ + +package com.adminportal.content; + +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +/** + * This class Represent Entity which stores SubjecTClass data + * @author om prakash + * + */ +@Entity +@Table(name="subject_class_mapping") +public class SubjectClassMapping { + + + @Id + @Column(name="sub_class_id",nullable = false,updatable = false) + private int subClassId; + + @Column(name="status",nullable = false) + private boolean status=true; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="sub_id") + private Subject sub; + + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="class_id") + private Class standard; + + @OneToMany(mappedBy = "subjectClassMapping",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set topic=new HashSet(); + + + public SubjectClassMapping() { + + } + + public SubjectClassMapping(int subClassID,Class standard,Subject sub) { + this.subClassId=subClassID; + this.standard=standard; + this.sub=sub; + } + + + + public int getSubClassId() { + return subClassId; + } + + public void setSubClassId(int subClassId) { + this.subClassId = subClassId; + } + + public Subject getSub() { + return sub; + } + + public void setSub(Subject sub) { + this.sub = sub; + } + + public Class getStandard() { + return standard; + } + + public void setStandard(Class standard) { + this.standard = standard; + } + + public Set getTopic() { + return topic; + } + + public void setTopic(Set topic) { + this.topic = topic; + } + + public boolean isStatus() { + return status; + } + + public void setStatus(boolean status) { + this.status = status; + } + + + +} diff --git a/src/main/java/com/adminportal/content/Testimonial.java b/src/main/java/com/adminportal/content/Testimonial.java new file mode 100644 index 0000000..1943770 --- /dev/null +++ b/src/main/java/com/adminportal/content/Testimonial.java @@ -0,0 +1,126 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Testimonial Modal representating modal for saving testimonial data into database. + */ +package com.adminportal.content; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.hibernate.validator.constraints.Length; + +/** + * This class Represent Entity which stores Testimonial Data + * @author om Prakash + * + */ +@Entity +@Table(name = "Testimonial") +public class Testimonial { + + /** + * A unique ID of Testimonial + */ + @Id + @Column(nullable = false,updatable = false) + private int testimonialId; + + /** + * Name of person + */ + @Column(nullable = false) + private String name; + + /** + * Organization of Person + */ + @Column(nullable = false) + private String organization; + + /** + * A long Description + */ + @Column(nullable = false) + @Length(max = 10000) + private String description; + + /** + * Date on which testimonial added + */ + @Column(nullable = false,updatable = false) + private Timestamp dateAdded; + + /** + * Path of Video file + */ + @Column + private String videoPath; + + /** + * Path of file data + */ + @Column + private String filePath; + + public int getTestimonialId() { + return testimonialId; + } + + public void setTestimonialId(int testimonialId) { + this.testimonialId = testimonialId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public String getVideoPath() { + return videoPath; + } + + public void setVideoPath(String videoPath) { + this.videoPath = videoPath; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + +} diff --git a/src/main/java/com/adminportal/content/Topic.java b/src/main/java/com/adminportal/content/Topic.java new file mode 100644 index 0000000..5a3c0ff --- /dev/null +++ b/src/main/java/com/adminportal/content/Topic.java @@ -0,0 +1,247 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Topic Modal to persist same into database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Topic data + * @author om prakash + * + */ +@Entity +@Table(name="Topic") +public class Topic { + + /** + * A unique ID of Topic + */ + @Id + @Column(name="topic_id",updatable = false) + private int topicId; + + /** + * Name of Topic + */ + @Column(name="topic_name",nullable = false) + private String topicName; + + /** + * Path of poster + */ + @Column(name="poster",nullable = false) + private String poster; + + /** + * A long description + */ + @Column(name="description",nullable = false,length = 5000) + private String description; + + /** + * date on which topic is added. + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * date on which topic is modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + @Column(name="status",nullable = false) + private int status; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User userId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="subClassId") + private SubjectClassMapping subjectClassMapping; + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set quizQuestion=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set videoExternal=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set documentExternal=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set phets=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set lessonPlan=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set articleExternal=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set tutorial=new HashSet(); + + @OneToMany(mappedBy = "topic",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set conceptMap=new HashSet(); + + public int getTopicId() { + return topicId; + } + + public Set getConceptMap() { + return conceptMap; + } + + public void setConceptMap(Set conceptMap) { + this.conceptMap = conceptMap; + } + + public void setTopicId(int topicId) { + this.topicId = topicId; + } + + public String getTopicName() { + return topicName; + } + + public void setTopicName(String topicName) { + this.topicName = topicName; + } + + public String getPoster() { + return poster; + } + + public void setPoster(String poster) { + this.poster = poster; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public SubjectClassMapping getSubjectClassMapping() { + return subjectClassMapping; + } + + public void setSubjectClassMapping(SubjectClassMapping subjectClassMapping) { + this.subjectClassMapping = subjectClassMapping; + } + + public Set getQuizQuestion() { + return quizQuestion; + } + + public void setQuizQuestion(Set quizQuestion) { + this.quizQuestion = quizQuestion; + } + + public Set getVideoExternal() { + return videoExternal; + } + + public void setVideoExternal(Set videoExternal) { + this.videoExternal = videoExternal; + } + + public Set getDocumentExternal() { + return documentExternal; + } + + public void setDocumentExternal(Set documentExternal) { + this.documentExternal = documentExternal; + } + + public Set getPhets() { + return phets; + } + + public void setPhets(Set phets) { + this.phets = phets; + } + + public Set getLessonPlan() { + return lessonPlan; + } + + public void setLessonPlan(Set lessonPlan) { + this.lessonPlan = lessonPlan; + } + + public Set getArticleExternal() { + return articleExternal; + } + + public void setArticleExternal(Set articleExternal) { + this.articleExternal = articleExternal; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Set getTutorial() { + return tutorial; + } + + public void setTutorial(Set tutorial) { + this.tutorial = tutorial; + } + + public User getUserId() { + return userId; + } + + public void setUserId(User userId) { + this.userId = userId; + } + + + +} diff --git a/src/main/java/com/adminportal/content/Tutorial.java b/src/main/java/com/adminportal/content/Tutorial.java new file mode 100644 index 0000000..c3f35fe --- /dev/null +++ b/src/main/java/com/adminportal/content/Tutorial.java @@ -0,0 +1,156 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Representation of Tutorial from spoken tutorial website. + */ +package com.adminportal.content; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import com.adminportal.domain.User; + +/** + * This class Represent Entity which stores Tutorial data + * @author om prakash + * + */ +@Entity +@Table(name = "Tutorial") +public class Tutorial { + + /** + * A unique ID represent Tutorial + */ + @Id + @Column(updatable = false,nullable = false) + private int tutorialId; + + /** + * Spoken Foss ID + */ + @Column(nullable = false) + private int stfossId; + + /** + * spoken Langauge ID + */ + @Column(nullable = false) + private int stlanguageId; + + /** + * Spoken Video Id + */ + @Column(nullable = false) + private int stVideoId; + + @Column(nullable = false) + private int status; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + public Tutorial() {} + + public Tutorial(int tutorialId, int stfossId, int stlanguageId, int stVideoId, int status, Topic topic, User user) { + + this.tutorialId = tutorialId; + this.stfossId = stfossId; + this.stlanguageId = stlanguageId; + this.stVideoId = stVideoId; + this.status = status; + this.topic = topic; + this.user = user; + } + + public int getTutorialId() { + return tutorialId; + } + + public void setTutorialId(int tutorialId) { + this.tutorialId = tutorialId; + } + + public int getFossId() { + return stfossId; + } + + public void setFossId(int fossId) { + this.stfossId = fossId; + } + + public int getLanguageId() { + return stlanguageId; + } + + public void setLanguageId(int languageId) { + this.stlanguageId = languageId; + } + + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + + + + + public int getStfossId() { + return stfossId; + } + + public void setStfossId(int stfossId) { + this.stfossId = stfossId; + } + + public int getStlanguageId() { + return stlanguageId; + } + + public void setStlanguageId(int stlanguageId) { + this.stlanguageId = stlanguageId; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getStVideoId() { + return stVideoId; + } + + public void setStVideoId(int stVideoId) { + this.stVideoId = stVideoId; + } + + + + +} diff --git a/src/main/java/com/adminportal/content/VideoExternal.java b/src/main/java/com/adminportal/content/VideoExternal.java new file mode 100644 index 0000000..aa09a77 --- /dev/null +++ b/src/main/java/com/adminportal/content/VideoExternal.java @@ -0,0 +1,225 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Video related data will get saved into database. + */ + +package com.adminportal.content; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import com.adminportal.domain.User; +/** + * This class Represent Entity which stores Video Resource data + * @author om + * + */ +@Entity +@Table(name="content") +public class VideoExternal { + + /** + * A unique ID representing single Video Resource + */ + @Id + @Column(name="content_id",nullable = false,updatable = false) + private int videoId; + + /** + * Resource Type like article,Phet etc + */ + @Column(name="type",nullable = false) + private String type; + + /** + * Date on which resource added + */ + @Column(name="date_added",updatable = false,nullable = false) + private Timestamp dateAdded; + + /** + * Date on which resource Modified + */ + @Column(name="date_modified",nullable = false) + private Timestamp dateModified; + + /** + * A long description On Video + */ + @Column(name="description",length = 10000) + private String description; + + /** + * Name of Reference from where video is being used. + */ + @Column(name="source") + private String source; + + /** + * A proper Url of video + */ + @Column(name="url") + private String url; + + @Column(name="status",nullable = false) + private int status; + + @Column(name="acceptedByAdmin",nullable = false) + private int acceptedByAdmin; + + /** + * Date on which resource got approved from admin + */ + @Column(name="date_approved") + private Timestamp dateApproved; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="topic_id") + private Topic topic; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="user_id") + private User user; + + @OneToMany(mappedBy = "video",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private List comment=new ArrayList(); + + public VideoExternal() {} + + public VideoExternal(int videoId, String type, Timestamp dateAdded, Timestamp dateModified, String description, + String source, String url, int status, int acceptedByAdmin,Timestamp dateApproved, Topic topic, User user) { + + this.videoId = videoId; + this.type = type; + this.dateAdded = dateAdded; + this.dateModified = dateModified; + this.description = description; + this.source = source; + this.url = url; + this.status = status; + this.acceptedByAdmin=acceptedByAdmin; + this.dateApproved = dateApproved; + this.topic = topic; + this.user = user; + } + + public Topic getTopic() { + return topic; + } + + public void setTopic(Topic topic) { + this.topic = topic; + } + + public int getVideoId() { + return videoId; + } + + public void setVideoId(int videoId) { + this.videoId = videoId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getDateModified() { + return dateModified; + } + + public void setDateModified(Timestamp dateModified) { + this.dateModified = dateModified; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public int isStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Timestamp getDateApproved() { + return dateApproved; + } + + public void setDateApproved(Timestamp dateApproved) { + this.dateApproved = dateApproved; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public int getAcceptedByAdmin() { + return acceptedByAdmin; + } + + public void setAcceptedByAdmin(int acceptedByAdmin) { + this.acceptedByAdmin = acceptedByAdmin; + } + + public List getComment() { + return comment; + } + + public void setComment(List comment) { + this.comment = comment; + } + + + + +} diff --git a/src/main/java/com/adminportal/domain/RoleDetail.java b/src/main/java/com/adminportal/domain/RoleDetail.java new file mode 100644 index 0000000..2c653dd --- /dev/null +++ b/src/main/java/com/adminportal/domain/RoleDetail.java @@ -0,0 +1,72 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Representation of role details available into database. + */ + +package com.adminportal.domain; + +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +/** + * This class Stores different Role in system. + * @author om + * + */ +@Entity +@Table(name="role_details") +public class RoleDetail { + + /** + * A unique ID + */ + @Id + @Column(name = "role_id", nullable = false,updatable = false) + private int roleId; + + /** + * RoleNAme + */ + @Column(nullable = false) + private String roleName; + + @OneToMany(mappedBy = "role",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set userRoles=new HashSet(); + + public int getRoleId() { + return roleId; + } + + public void setRoleId(int roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public Set getUserRoles() { + return userRoles; + } + + public void setUserRoles(Set userRoles) { + this.userRoles = userRoles; + } + +} diff --git a/src/main/java/com/adminportal/domain/User.java b/src/main/java/com/adminportal/domain/User.java new file mode 100644 index 0000000..c219cbd --- /dev/null +++ b/src/main/java/com/adminportal/domain/User.java @@ -0,0 +1,520 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * description : User related information will get persist into database various user as such + * 1.Learner + * 2.Parent + * 3.Teacher + * 4.Admin + * + */ + +package com.adminportal.domain; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.security.Authority; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.adminportal.content.Class; +import com.adminportal.content.Subject; +import com.adminportal.content.Topic;; + +/** + * User Object to Store User information in Database + * @author om prakash + * + */ +@Entity +@Table(name="user_details") +public class User implements UserDetails{ + + /** + * A unique ID + */ + @Id + @Column(name = "user_id", nullable = false,updatable = false) + private int id; + + /** + * Email of User + */ + @Column(name = "email", nullable = false,updatable = false) + private String email; + + /** + * Password of User's Account + */ + @Column(name="password" ,nullable = false) + private String password; + + /** + * Gender of User + */ + @Column(nullable = false,updatable = false) + private String sex; + + /** + * First name of User + */ + @Column(name = "first_name", nullable = false) + private String fname; + + /** + * Last Name of User + */ + @Column(name = "last_name", nullable = false) + private String lname; + + /** + * Path to User'ID + */ + @Column(name="document_path") + private String document; + + /** + * User's School Name + */ + @Column(name="School_name") + private String schoolName; + + /** + * User's School Address + */ + @Column(name="School_address") + private String schoolAddress; + + /** + * User's School Pincode + */ + @Column(name="pincode") + private int pincode; + + /** + * Date user added to this application + */ + @Column(name="date_added",nullable = false,updatable = false) + private Timestamp dateAdded; + + /** + * User's Last activity + */ + @Column(name="last_login",nullable = false) + private Timestamp lastLogin; + + /** + * User's Date of Birth + */ + @Column(name="dob") + private Date dateOfBirth; + + /** + * Visibility on application + */ + @Column (name="isvalid",nullable = false ) + private int Registered; + + /** + * Used for password retrieval + */ + @Column(name="token") + private String token; + + /** + * Path of profile pciture of User + */ + @Column(name="profilePic") + private String profilePic; + + @Column(name = "approveTeacher" , columnDefinition = "integer default 0") + private int approveTeacherFlag; + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private List userRoles=new ArrayList(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set classDb=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set subjectDb=new HashSet(); + + @OneToMany(mappedBy = "userId",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set topic=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set articleExternal=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set documentExternal=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set lessonPlan=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set phet=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set quiz=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set videoExternal=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set tutorial=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set conceptMap=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set comment=new HashSet(); + + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private Set commentReply=new HashSet(); + + + public int getId() { + return id; + } + + public List getUserRoles() { + return userRoles; + } + + public void setUserRoles(List userRoles) { + this.userRoles = userRoles; + } + + public void setId(int id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getFname() { + return fname; + } + + public void setFname(String fname) { + this.fname = fname; + } + + public String getLname() { + return lname; + } + + public Set getConceptMap() { + return conceptMap; + } + + public void setConceptMap(Set conceptMap) { + this.conceptMap = conceptMap; + } + + public void setLname(String lname) { + this.lname = lname; + } + + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public String getSchoolAddress() { + return schoolAddress; + } + + public void setSchoolAddress(String schoolAddress) { + this.schoolAddress = schoolAddress; + } + + public int getPincode() { + return pincode; + } + + public void setPincode(int pincode) { + this.pincode = pincode; + } + + public Timestamp getDateAdded() { + return dateAdded; + } + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + public Timestamp getLastLogin() { + return lastLogin; + } + + public void setLastLogin(Timestamp lastLogin) { + this.lastLogin = lastLogin; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public Date getDateOfBirth() { + return dateOfBirth; + } + + public void setDateOfBirth(Date dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + public int getRegistered() { + return Registered; + } + + public void setRegistered(int registered) { + Registered = registered; + } + + public Set getArticleExternal() { + return articleExternal; + } + + public void setArticleExternal(Set articleExternal) { + this.articleExternal = articleExternal; + } + + public Set getDocumentExternal() { + return documentExternal; + } + + public void setDocumentExternal(Set documentExternal) { + this.documentExternal = documentExternal; + } + + public Set getLessonPlan() { + return lessonPlan; + } + + public void setLessonPlan(Set lessonPlan) { + this.lessonPlan = lessonPlan; + } + + public Set getPhet() { + return phet; + } + + public void setPhet(Set phet) { + this.phet = phet; + } + + public Set getQuiz() { + return quiz; + } + + public void setQuiz(Set quiz) { + this.quiz = quiz; + } + + public Set getVideoExternal() { + return videoExternal; + } + + public void setVideoExternal(Set videoExternal) { + this.videoExternal = videoExternal; + } + + public Set getComment() { + return comment; + } + + public void setComment(Set comment) { + this.comment = comment; + } + + public Set getCommentReply() { + return commentReply; + } + + public void setCommentReply(Set commentReply) { + this.commentReply = commentReply; + } + + public Set getTutorial() { + return tutorial; + } + + public void setTutorial(Set tutorial) { + this.tutorial = tutorial; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public Set getClassDb() { + return classDb; + } + + public void setClassDb(Set classDb) { + this.classDb = classDb; + } + + public Set getSubjectDb() { + return subjectDb; + } + + public void setSubjectDb(Set subjectDb) { + this.subjectDb = subjectDb; + } + + public Set getTopic() { + return topic; + } + + public void setTopic(Set topic) { + this.topic = topic; + } + + @Override + public Collection getAuthorities() { + + Set authorities=new HashSet(); + for(UserRole x:userRoles) { + authorities.add(new Authority(x.getRole().getRoleName())); + System.out.println(x.getRole().getRoleName()); + } + + return authorities; + } + + + + @Override + public String getUsername() { + // TODO Auto-generated method stub + return email; + } + + @Override + public boolean isAccountNonExpired() { + // TODO Auto-generated method stub + return true; + } + + @Override + public boolean isAccountNonLocked() { + // TODO Auto-generated method stub + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + // TODO Auto-generated method stub + return true; + } + + @Override + public boolean isEnabled() { + + if(Registered==1) { + return true; + }else { + return false; + } + } + + public String getProfilePic() { + return profilePic; + } + + public void setProfilePic(String profilePic) { + this.profilePic = profilePic; + } + + @Override + public String toString() { + return "User [id=" + id + ", email=" + email + ", password=" + password + ", sex=" + sex + ", fname=" + fname + + ", lname=" + lname + ", document=" + document + ", schoolName=" + schoolName + ", schoolAddress=" + + schoolAddress + ", pincode=" + pincode + ", dateAdded=" + dateAdded + ", lastLogin=" + lastLogin + + ", dateOfBirth=" + dateOfBirth + ", Registered=" + Registered + ", token=" + token + ", profilePic=" + + profilePic + ", userRoles=" + userRoles + ", classDb=" + classDb + ", subjectDb=" + subjectDb + + ", topic=" + topic + ", articleExternal=" + articleExternal + ", documentExternal=" + documentExternal + + ", lessonPlan=" + lessonPlan + ", phet=" + phet + ", quiz=" + quiz + ", videoExternal=" + + videoExternal + ", tutorial=" + tutorial + ", conceptMap=" + conceptMap + ", comment=" + comment + + ", commentReply=" + commentReply + "]"; + } + + public int getApproveTeacherFlag() { + return approveTeacherFlag; + } + + public void setApproveTeacherFlag(int approveTeacherFlag) { + this.approveTeacherFlag = approveTeacherFlag; + } + + + + + + + +} diff --git a/src/main/java/com/adminportal/domain/UserRole.java b/src/main/java/com/adminportal/domain/UserRole.java new file mode 100644 index 0000000..d6371c5 --- /dev/null +++ b/src/main/java/com/adminportal/domain/UserRole.java @@ -0,0 +1,82 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : this is a representation of many to many relationship among user and user role. + */ + +package com.adminportal.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +/** + * This class is to map User with different Role + * @author om Prakash + * + */ +@Entity +@Table(name="user_role") +public class UserRole { + + /** + * A unique ID + */ + @Id + @Column(nullable = false,updatable = false) + private int userRoleId; + + @ManyToOne(fetch=FetchType.EAGER) + @JoinColumn(name="user_id") + private User user; + + @ManyToOne(fetch=FetchType.EAGER) + @JoinColumn(name="role_id") + private RoleDetail role; + + public UserRole() { + + } + + public UserRole(int userRoleId,User user,RoleDetail role) { + this.userRoleId=userRoleId; + this.user=user; + this.role=role; + + } + + public int getUserRoleId() { + return userRoleId; + } + + public void setUserRoleId(int userRoleId) { + this.userRoleId = userRoleId; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public RoleDetail getRole() { + return role; + } + + public void setRole(RoleDetail role) { + this.role = role; + } + + + + +} diff --git a/src/main/java/com/adminportal/repository/ArticleExternalRepository.java b/src/main/java/com/adminportal/repository/ArticleExternalRepository.java new file mode 100644 index 0000000..1d254f1 --- /dev/null +++ b/src/main/java/com/adminportal/repository/ArticleExternalRepository.java @@ -0,0 +1,131 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.jboss.logging.Param; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +/** + * This Interface Extend CrudRepository to handle all database operation related to Article Resources + * @author om prakash + * + */ +public interface ArticleExternalRepository extends CrudRepository{ + + /** + * Find all the Article based on list of Topic + * @param temp ArrayList of topic + * @return List of Article resource + */ + ArrayList findAllBytopic(ArrayList temp); // fetching List of article based on Topic + + /** + * Find all the Article based on type like phet,concepMap etc + * @param type A String value like phet,lessonPlan etc + * @return List of Article resource + */ + List findAllBytype(String type); // fetching list of article based on Type + + /** + * Find list of Article resource where topic, status and type given as input argument + * @param topic topic object + * @param status status value like 0 or 1 + * @param type type of resource + * @return List of Article resource + */ + @Query("from ArticleExternal U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + + /** + * Find list of Article resource where topic,and type given as input argument + * @param topic topic object + * @param type type of resource + * @return List of Article resource + */ + @Query("from ArticleExternal U where U.topic=?1 and U.type=?2") + ArrayList findAllBytopicAndType(Topic topic,String type); // fetching list of article based on type and topic + + + /** + * Update the article resource where articleID given as one of the input argument + * @param desc Description of Article + * @param source Source of Article + * @param url Url path of article + * @param date current date + * @param id Article ID + * @return integer value equivalent to number of record updated. + */ + @Modifying + @Query("update ArticleExternal set description=?1,source=?2,url=?3,dateModified=?4 where articleId=?5") // updating Article Information + int updateArticle(String desc, String source,String url,Timestamp date,int id); + + /** + * Update the article resource where articleID given as one of the input argument + * @param status status vaue to be set + * @param id Article ID + * @return integer value equivalent to number of record updated. + */ + @Modifying + @Query("update ArticleExternal set status=?1 where articleId=?2") // Enabling or disabling status of Article based on primary key + int EnableArticleContent(int status,int id); + + + /** + * Find list of Article resource where user and type given as input argument + * @param usr USer object who added resource + * @param type type of resource (article) + * @return List of article resource + */ + @Query("from ArticleExternal U where U.user=?1 and U.type=?2") // listing Article based on user and type + List findAllByuser(User usr,String type); + + + /** + * Update the article resource where articleID given as one of the input argument + * @param status status vale to be set + * @param time current date object + * @param id Article ID + * @return total number of article resource updated. + */ + @Modifying + @Query("update ArticleExternal set acceptedByAdmin=?1,status=?1,dateApproved=?2 where articleId=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + @Modifying + @Query("delete from ArticleExternal U where U.articleId=?1") + @Transactional + void deleteArticle(int artcileID); + + + /** + * Count total number of resource given topic object + * @param temp Topic obeject + * @return number of resource + */ + @Query("select count(articleId) from ArticleExternal where topic=?1") + int countTotalResource(Topic temp); + + /** + * Count number of resource where list of topic given as input parameter + * @param temp list of topic + * @return number of resource + */ + @Query("select count(articleId) from ArticleExternal where topic IN (:TopicList)") + int countTotalResource(@org.springframework.data.repository.query.Param("TopicList")List temp); + +} diff --git a/src/main/java/com/adminportal/repository/ClassRepository.java b/src/main/java/com/adminportal/repository/ClassRepository.java new file mode 100644 index 0000000..9c086d5 --- /dev/null +++ b/src/main/java/com/adminportal/repository/ClassRepository.java @@ -0,0 +1,30 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; + + +import com.adminportal.content.Class; + +/** + * This Interface Extend JPARepository to handle all database operation related to Class + * @author om prakash + * + */ +public interface ClassRepository extends JpaRepository{ + + /** + * Find class object based on classNAme given as input parameter + * @param clas_name class name in integer + * @return class Object + */ + Class findByclassName(int clas_name); // fetching Class based on classNAme + + +} diff --git a/src/main/java/com/adminportal/repository/CommentReplyRepository.java b/src/main/java/com/adminportal/repository/CommentReplyRepository.java new file mode 100644 index 0000000..ccee1b7 --- /dev/null +++ b/src/main/java/com/adminportal/repository/CommentReplyRepository.java @@ -0,0 +1,27 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ +package com.adminportal.repository; + +import java.util.List; + +import org.springframework.data.repository.CrudRepository; + +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Comment Reply + * @author om prakash + * + */ +public interface CommentReplyRepository extends CrudRepository { + + /** + * FInd list of comment Reply based on single comment given as input parameter + * @param com A Comment object + * @return List of Comment Reply + */ + List findAllBycomment(Comment com); // fetching list of commentReply based on single comment +} diff --git a/src/main/java/com/adminportal/repository/CommentRepository.java b/src/main/java/com/adminportal/repository/CommentRepository.java new file mode 100644 index 0000000..40c34be --- /dev/null +++ b/src/main/java/com/adminportal/repository/CommentRepository.java @@ -0,0 +1,76 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ +package com.adminportal.repository; + +import java.util.List; + +import org.springframework.data.repository.CrudRepository; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Comment; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.VideoExternal; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Comment + * @author om prakash + * + */ +public interface CommentRepository extends CrudRepository{ + + /** + * Find list of comment made on Video Resource + * @param video Video resource Object + * @return List of Comment object + */ + List findAllByvideo(VideoExternal video); // listing list of comment based on Video type + + /** + * Find list of comment made on Article Resource + * @param article Article Object + * @return List of Comment object + */ + List findAllByarticle(ArticleExternal article); // listing list of comment based on article type + + /** + * Find list of comment made on Quiz Resource + * @param quiz Quiz Object + * @return List of Comment object + */ + List findAllByquiz(QuizQuestion quiz); // listing list of comment based on Quiz type + + /** + * Find list of comment made on LessonPlan Resource + * @param lesson Lessonplan Object + * @return List of Comment object + */ + List findAllBylesson(LessonPlan lesson); // listing list of comment based on lesson type + + /** + * Find list of comment made on Phet Resource + * @param phet phet Object + * @return List of Comment object + */ + List findAllByphet(Phets phet); // listing list of comment based on phet type + + /** + * Find list of comment made on Document Resource + * @param document Document Object + * @return List of Comment object + */ + List findAllBydocument(DocumentExternal document); // listing list of comment based on Document type + + /** + * Find list of comment made on ConceptMap Resource + * @param conceptMap Object + * @return List of Comment object + */ + List findALlByconceptMap(ConceptMap conceptMap); // listing list of comment based on Concept-map type + +} diff --git a/src/main/java/com/adminportal/repository/ConceptMapRepository.java b/src/main/java/com/adminportal/repository/ConceptMapRepository.java new file mode 100644 index 0000000..66c3b64 --- /dev/null +++ b/src/main/java/com/adminportal/repository/ConceptMapRepository.java @@ -0,0 +1,121 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; + +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This Interface Extend CrudRepository to handle all database operation related to ConceptMap resource + * @author om prakash + * + */ +public interface ConceptMapRepository extends CrudRepository { + + /** + * Find list of ConceptMap object based on list of topic given as input parameter + * @param temp list of topic + * @return list of ConceptMap object + */ + List findAllBytopic(List temp); // fetching List of Concept-map based on Topic + + /** + * Find list of ConceptMap object based on type given as input parameter + * @param type Sting value like(phet,Conceptmap etc) + * @return list of ConceptMap object + */ + List findAllBytype(String type); // fetching list of Concept-map based on Type + + /** + * Find list of ConceptMap object based on type and topic object given as input parameter + * @param topic topic object + * @param type type like(phet,Conceptmap etc) + * @return list of ConceptMap object + */ + @Query("from ConceptMap U where U.topic=?1 and U.type=?2") // fetching list of Concept-map based on type and topic + ArrayList findAllBytopicAndType(Topic topic,String type); + + /** + * Find list of ConceptMap object based on type ,topic and status value given as input parameter + * @param topic topic object + * @param status status value + * @param type type like(phet,Conceptmap etc) + * @return list of ConceptMap object + */ + @Query("from ConceptMap U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + /** + * update conceptmap attribute like description,url,remark and date modified based on conceptMap ID + * @param desc description to be updated + * @param url url path to be updated + * @param remark remark to be updated + * @param date current date + * @param id Concept ID + * @return number of updated record + */ + @Modifying + @Query("update ConceptMap set description=?1,url=?2,remark=?3,dateModified=?4 where concepMapid=?5") // updating Concept-map Information + int updateConceptMap(String desc, String url,String remark,Timestamp date,int id); + + /** + * update conceptmap attribute status value based on conceptMap ID + * @param status status value to be set + * @param id Concept ID + * @return number of updated record + */ + @Modifying + @Query("update ConceptMap set status=?1 where concepMapid=?2") // Enabling or disabling status of Concept-map based on primary key + int EnableConceptMapContent(int status,int id); + + /** + * Find list of ConceptMap object based on type and User object given as input parameter + * @param usr User object + * @param type Type value + * @return list of concept map object + */ + @Query("from ConceptMap U where U.user=?1 and U.type=?2") // listing Concept-map based on user and type + List findAllByuser(User usr,String type); + + /** + * update conceptmap attribute like acceptedByAdmin,status value,date approved based on conceptMap ID + * @param status acceptedByAdmin value to be set + * @param time current date + * @param id concept ID + * @return number of updated record + */ + @Modifying + @Query("update ConceptMap set acceptedByAdmin=?1,status=?1,dateApproved=?2 where concepMapid=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + /** + * update conceptmap attribute like description,remark,date modified based on conceptMap ID + * @param desc description to be updated + * @param remark remark to be updated + * @param date current date + * @param id concept ID + * @return number of updated record + */ + @Modifying + @Query("update ConceptMap set description=?1,remark=?2,dateModified=?3 where concepMapid=?4") // updating Concept-map Information + int updateConceptMapDesc(String desc,String remark,Timestamp date,int id); + + @Modifying + @Query("delete from ConceptMap U where U.concepMapid=?1") + @Transactional + void deleteConcep(int conceptID); +} diff --git a/src/main/java/com/adminportal/repository/ContactFormRepository.java b/src/main/java/com/adminportal/repository/ContactFormRepository.java new file mode 100644 index 0000000..24505b8 --- /dev/null +++ b/src/main/java/com/adminportal/repository/ContactFormRepository.java @@ -0,0 +1,19 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ +package com.adminportal.repository; + +import org.springframework.data.repository.CrudRepository; + +import com.adminportal.content.ContactForm; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Contact Form + * @author om prakash + * + */ +public interface ContactFormRepository extends CrudRepository{ + + +} diff --git a/src/main/java/com/adminportal/repository/DocumentExternalRepository.java b/src/main/java/com/adminportal/repository/DocumentExternalRepository.java new file mode 100644 index 0000000..7da4ee3 --- /dev/null +++ b/src/main/java/com/adminportal/repository/DocumentExternalRepository.java @@ -0,0 +1,127 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +/** + * This Interface Extend CrudRepository to handle all database operation related to Document resource + * @author om prakash + * + */ +public interface DocumentExternalRepository extends CrudRepository{ + + /** + * Find list of Document based on list of Topic given as input parameter + * @param topic list of topic object + * @return list of Document + */ + List findAllBytopic(List topic); //fetching List of document based on Topic + + /** + * Find list of Document based on type of resource given as input parameter + * @param type type of resource like (document,phet etc) + * @return list of Document + */ + List findAllBytype(String type); //fetching list of document based on Type + + /** + * Find list of Document based on topic object and type of resource given as input parameter + * @param topic topic object + * @param type type of resource + * @return List of Document + */ + @Query("from DocumentExternal U where U.topic=?1 and U.type=?2") //fetching list of document based on type and topic + ArrayList findAllBytopicAndType(Topic topic,String type); + + /** + * Find list of Document based on Topic object, type of resource and status value given as input parameter + * @param topic Topic object + * @param status status value + * @param type type of resource + * @return List of Document + */ + @Query("from DocumentExternal U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + /** + * update document attributes description, source ,url and datemodified given Document ID as one of input parameter + * @param desc A long description to be updated + * @param source A reference of Document + * @param url Path of document saved + * @param date current date + * @param Id Document ID + * @return number of updated record + */ + @Modifying + @Query("update DocumentExternal set description=?1 , source=?2, url=?3,dateModified=?4 where documentId=?5") //updating document Information + int updateDocument(String desc,String source,String url,Timestamp date,int Id); + + /** + * update document attributes status given Document ID as one of input parameter + * @param status status value to be set + * @param id Document ID + * @return number of updated record + */ + @Modifying + @Query("update DocumentExternal set status=?1 where documentId=?2") //Enabling or disabling status of document based on primary key + int EnableDocumentContent(int status,int id); + + + /** + * Find list of document object given user object and type of resource as a input argument + * @param usr User object + * @param type type of Resource (preferably document) + * @return + */ + @Query("from DocumentExternal U where U.user=?1 and U.type=?2") //listing document based on user and type + List findAllByuser(User usr,String type); + + /** + * update document attributes acceptedByadmin,status,date approved given Document ID as one of input parameter + * @param status status value to be set + * @param time current time + * @param id Document ID + * @return number of updated record + */ + @Modifying + @Query("update DocumentExternal set acceptedByAdmin=?1,status=?1,dateApproved=?2 where documentId=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + /** + * update document attributes description, source and date modified given Document ID as one of input parameter + * @param desc A long description to be set + * @param source A reference of document + * @param date current date + * @param Id Document ID + * @return number of updated record + */ + @Modifying + @Query("update DocumentExternal set description=?1 , source=?2, dateModified=?3 where documentId=?4") //updating document Information + int updateDocumentDesc(String desc,String source,Timestamp date,int Id); + + @Modifying + @Query("delete from DocumentExternal U where U.documentId=?1") + @Transactional + void deleteDocument(int documentID); +} + + + + + diff --git a/src/main/java/com/adminportal/repository/EventsRepository.java b/src/main/java/com/adminportal/repository/EventsRepository.java new file mode 100644 index 0000000..c14e459 --- /dev/null +++ b/src/main/java/com/adminportal/repository/EventsRepository.java @@ -0,0 +1,55 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ +package com.adminportal.repository; + +import java.sql.Date; +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Events; + +/** + * This Interface Extend JpaRepository to handle all database operation related to Event data + * @author om prakash + * + */ +public interface EventsRepository extends JpaRepository { + + /** + * Find all the event from database in descending order based on start date of event + * @return List of Event + */ + @Query("from Events e order by e.dateToHappenStart desc") // fetching list of event + List getAllEvent(); + + /** + * Update the event data given eventID as one of the input parameter + * @param head headline of event to be updated + * @param desc description to be updated + * @param startDate start date of event to be updated + * @param enddate end date of event to be updated + * @param regStart Start date of registration to be updated + * @param regEnd end date of registration to be updated + * @param coordName Coordinator name to be updated + * @param poster_Path Image of Event linked to be updated + * @param id Event ID + * @return number of record updated + */ + @Modifying + @Query("update Events set headline=?1,description=?2,dateToHappenStart=?3,dateToHappenEnd=?4,registStart=?5,registEnd=?6,coordName=?7,potser_path=?8 where eventId=?9") // updating event information. + int updateEvent(String head,String desc,Date startDate,Date enddate,Date regStart,Date regEnd,String coordName,String poster_Path,int id); + + + @Modifying + @Query("delete from Events U where U.eventId=?1") + @Transactional + void deleteEvent(int eventID); + +} diff --git a/src/main/java/com/adminportal/repository/LessonPlanRepository.java b/src/main/java/com/adminportal/repository/LessonPlanRepository.java new file mode 100644 index 0000000..e139a7c --- /dev/null +++ b/src/main/java/com/adminportal/repository/LessonPlanRepository.java @@ -0,0 +1,116 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Lesson resource + * @author om prakash + * + */ +public interface LessonPlanRepository extends CrudRepository{ + + /** + * Find list of Lesson Object based on list of Topic given as input parameter + * @param topic A topic object + * @return List of lesson Object + */ + List findAllBytopic(List topic); //fetching List of Lesson based on Topic + + /** + * Find list of Lesson Object based on type of resource given as input parameter + * @param type Resource Type preferably Lesson + * @return List of lesson Object + */ + List findAllBytype(String type); //fetching list of Lesson based on Type + + /** + * Find list of Lesson Object based on type of resource and topic object given as input parameter + * @param topic A topic object + * @param type type of resource(Lesson) + * @return List of lesson Object + */ + @Query("from LessonPlan U where U.topic=?1 and U.type=?2") + ArrayList findAllBytopicAndType(Topic topic,String type); //fetching list of Lesson based on type and topic + + /** + * update lesson attribute status based on lesson ID given as one of the input argument + * @param status status value to be set + * @param id Lesson ID + * @return number of updated record + */ + @Modifying + @Query("update LessonPlan set status=?1 where lessonPlanId=?2") //Enabling or disabling status of Lesson based on primary key + int EnableLessonPlanContent(int status,int id); + + /** + * Find list of lesson object based on topic object, status value and type of resource(lesson) given as input parameter + * @param topic Topic object + * @param status Status value + * @param type type of resource (lesson) + * @return List of lesson object + */ + @Query("from LessonPlan U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + /** + * Find list of lesson object based on USer object and type of resource(Document) given as input parameter + * @param usr User object + * @param type Type of resource (Document) + * @return List of lesson Object + */ + @Query("from LessonPlan U where U.user=?1 and U.type=?2") //listing Lesson based on user and type + List findAllByuser(User usr,String type); + + /** + * update lesson attribute Lesson resource path, date modified based on lesson ID given as one of the input argument + * @param dat current date + * @param lessonPath path of lesson resource saved + * @param id lesson ID + * @return number of updated record + */ + @Modifying + @Query("update LessonPlan set dateModified=?1 ,lessonPlan=?2 where lessonPlanId=?3") //updating Lesson Information + int updateLessonPlan(Timestamp dat,String lessonPath,int id); + + /** + * update lesson attribute acceptedByAdmin, status,date approved based on lesson ID given as one of the input argument + * @param status status value to be set + * @param time current time + * @param id Lesson ID + * @return number of updated record + */ + @Modifying + @Query("update LessonPlan set acceptedByAdmin=?1,status=?1,dateApproved=?2 where lessonPlanId=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + @Modifying + @Query("delete from LessonPlan U where U.lessonPlanId=?1") + @Transactional + void deleteLesson(int lessonID); + +} + + + + + + + diff --git a/src/main/java/com/adminportal/repository/PhetsRepository.java b/src/main/java/com/adminportal/repository/PhetsRepository.java new file mode 100644 index 0000000..d78e4e0 --- /dev/null +++ b/src/main/java/com/adminportal/repository/PhetsRepository.java @@ -0,0 +1,118 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Phet resource + * @author om prakash + * + */ +public interface PhetsRepository extends CrudRepository{ + + /** + * Find list of Phet Object based on list of Topic given as input parameter + * @param topic + * @return List of phet Object + */ + List findAllBytopic(List topic); //fetching List of Phet based on Topic + + /** + * Find list of Phet Object based on list of Topic given as input parameter + * @param type type of resource (Phet) + * @return List of phet Object + */ + List findAllBytype(String type); //fetching list of Phet based on Type + + /** + * Find list of Phet Object based on type of resource and topic object given as input parameter + * @param topic A topic object + * @param type type of resource(Phet) + * @return List of phet Object + */ + @Query("from Phets U where U.topic=?1 and U.type=?2") //fetching list of Phet based on type and topic + ArrayList findAllBytopicAndType(Topic topic,String type); + + /** + * update phet attributes source, url, date modified, description given Phet ID as one of input parameter + * @param source A reference to phet resource + * @param url Url of Phet + * @param date current date + * @param desc a long description to be set + * @param id Phet ID + * @return number of updated record + */ + @Modifying + @Query("update Phets set source=?1,url=?2,dateModified=?3,description=?4 where phetId=?5") //updating Phet Information + int updatePhet(String source,String url,Timestamp date,String desc,int id); + + /** + * Find list of phet object based on topic, status and type of resource(phet) given as input argument + * @param topic topic object + * @param status status value to be set + * @param type type of resource(Phet) + * @return List of phet Object + */ + @Query("from Phets U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + /** + * update phet attributes status given Phet ID as one of input parameter + * @param status status value to be set + * @param id Phet ID + * @return number of updated record + */ + @Modifying + @Query("update Phets set status=?1 where phetId=?2") //Enabling or disabling status of Phet based on primary key + int EnablePhetContent(int status,int id); + + /** + * Find list of phet object based on User and type of resource(phet) given as input argument + * @param usr A user object + * @param type resource type (Phet) + * @return List of phet Object + */ + @Query("from Phets U where U.user=?1 and U.type=?2") //listing Phet based on user and type + List findAllByuser(User usr,String type); + + /** + * update phet attributes acceptedByAdmin, status and date approved given Phet ID as one of input parameter + * @param status status value to be set + * @param time current time + * @param id Phet ID + * @return number of updated record + */ + @Modifying + @Query("update Phets set acceptedByAdmin=?1,status=?1,dateApproved=?2 where phetId=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + @Modifying + @Query("delete from Phets U where U.phetId=?1") + @Transactional + void deletePhet(int phetID); +} + + + + + + + + diff --git a/src/main/java/com/adminportal/repository/QuizQuestionRepository.java b/src/main/java/com/adminportal/repository/QuizQuestionRepository.java new file mode 100644 index 0000000..e4a3942 --- /dev/null +++ b/src/main/java/com/adminportal/repository/QuizQuestionRepository.java @@ -0,0 +1,136 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +/** + * This Interface Extend CrudRepository to handle all database operation related to Quiz resource + * @author om prakash + * + */ +public interface QuizQuestionRepository extends CrudRepository{ + + /** + * Find list of Quiz Object based on list of Topic given as input parameter + * @param topic list of topic object + * @return List of Quiz object + */ + List findAllBytopic(List topic); //fetching List of Quiz based on Topic + + /** + * Find list of Quiz Object based on type of resource(Quiz) given as input parameter + * @param type resource type(quiz) + * @return List of Quiz object + */ + List findAllBytype(String type); //fetching list of Quiz based on Type + + /** + * Find list of Quiz Object based on type of resource and topic object given as input parameter + * @param topic A topic object + * @param type type of resource(Quiz) + * @return List of Quiz object + */ + @Query("from QuizQuestion U where U.topic=?1 and U.type=?2") //fetching list of Quiz based on type and topic + ArrayList findAllBytopicAndType(Topic topic,String type); + + /** + * update quiz question path, answer path, date modified quiz ID as one of input parameter + * @param question question set path + * @param answer answer set path + * @param date current date + * @param quizId quiz ID + * @return number of updated record + */ + @Modifying + @Query("update QuizQuestion set question=?1, answer=?2, dateModified=?3 where quizQuestionId=?4") //updating Quiz Information + int updateQuiz(String question,String answer,Timestamp date,int quizId); + + /** + * Find list of Quiz object given topic, status and type of resource (Quiz) as input parameter + * @param topic topic object + * @param status status value + * @param type resource type (quiz) + * @return List of Quiz object + */ + @Query("from QuizQuestion U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + /** + * update quiz status given quiz ID as one of input parameter + * @param status status value to be set + * @param id quiz ID + * @return number of updated record + */ + @Modifying + @Query("update QuizQuestion set status=?1 where quizQuestionId=?2") //Enabling or disabling status of Quiz based on primary key + int EnableQuizContent(int status,int id); + + /** + * Find list of quiz object given user object and type of resource(quiz) + * @param usr A USer object + * @param type type of resource (Quiz) + * @return List of Quiz object + */ + @Query("from QuizQuestion U where U.user=?1 and U.type=?2") //listing Quiz based on user and type + List findAllByuser(User usr,String type); + + /** + * update quiz acceptedByAdmin, status and date approved given quiz ID as one of input parameter + * @param status status value to be set + * @param time current time + * @param id quiz ID + * @return number of updated record + */ + @Modifying + @Query("update QuizQuestion set acceptedByAdmin=?1,status=?1,dateApproved=?2 where quizQuestionId=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + /** + * update quiz question file and date modified given quiz ID as one of input parameter + * @param question question set file saved path + * @param date current date + * @param quizId Quiz ID + * @return number of updated record + */ + @Modifying + @Query("update QuizQuestion set question=?1, dateModified=?2 where quizQuestionId=?3") //updating Quiz Information + int updateQuizQuestion(String question,Timestamp date,int quizId); + + /** + * update quiz answer file and date modified given quiz ID as one of input parameter + * @param answer answer set file saved path + * @param date current date + * @param quizId Quiz ID + * @return number of updated record + */ + @Modifying + @Query("update QuizQuestion set answer=?1, dateModified=?2 where quizQuestionId=?3") //updating Quiz Information + int updateQuizAnswer(String answer,Timestamp date,int quizId); + + @Modifying + @Query("delete from QuizQuestion U where U.quizQuestionId=?1") + @Transactional + void deleteQuiz(int quizID); + +} + + + + + diff --git a/src/main/java/com/adminportal/repository/RoleRepository.java b/src/main/java/com/adminportal/repository/RoleRepository.java new file mode 100644 index 0000000..8bd50ed --- /dev/null +++ b/src/main/java/com/adminportal/repository/RoleRepository.java @@ -0,0 +1,26 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import org.springframework.data.repository.CrudRepository; + +import com.adminportal.domain.RoleDetail; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Role data + * @author om prakash + * + */ +public interface RoleRepository extends CrudRepository { + + /** + * Find role object given role name as input parameter + * @param name name of role like (Learner,Teacher etc) + * @return RoleDetail Object + */ + RoleDetail findByroleName(String name); // fetching role based on rolename + +} diff --git a/src/main/java/com/adminportal/repository/SubjectClassMappingRepository.java b/src/main/java/com/adminportal/repository/SubjectClassMappingRepository.java new file mode 100644 index 0000000..5b0cfc4 --- /dev/null +++ b/src/main/java/com/adminportal/repository/SubjectClassMappingRepository.java @@ -0,0 +1,78 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import com.adminportal.content.Class; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Subject data + * @author om prakash + * + */ +public interface SubjectClassMappingRepository extends CrudRepository{ + + /** + * Find list of SubjectClassMapping object based on class object given as input parameter + * @param tempClass class object + * @return List of SubjectClassMapping object + */ + List findBystandard(Class tempClass); // listing list of object based on class + + /** + * Find SubjectClassMapping object based on class object and subject object given as input parameter + * @param subject subject object + * @param clas class object + * @return SubjectClassMapping object + */ + @Query("from SubjectClassMapping U where U.sub=?1 and U.standard=?2") // list object based on class and subject + SubjectClassMapping findBysubAndstandard(Subject subject,Class clas); + + @Query("from SubjectClassMapping U where U.sub=?1") + void deleteBysub(Subject sub); + + /** + * Find list of SubjectClassMapping object based on subject object given as input parameter + * @param sub Subject object + * @return List of SubjectClassMapping object + */ + ArrayList findBysub(Subject sub); + + /** + * update SubjectClassMapping record based on subject object given as input parameter + * @param status status value to be set + * @param sub subject object + * @return number of updated record + */ + @Modifying + @Query("update SubjectClassMapping set status=?1 where sub=?2") + int updateAllSubject(boolean status,Subject sub); + + /** + * update SubjectClassMapping record based on class object given as input parameter + * @param status status value to be set + * @param clas class object + * @return number of updated record + */ + @Modifying + @Query("update SubjectClassMapping set status=?1 where standard=?2") + int updateAllClass(boolean status,Class clas); + + + +} diff --git a/src/main/java/com/adminportal/repository/SubjectRepository.java b/src/main/java/com/adminportal/repository/SubjectRepository.java new file mode 100644 index 0000000..1f32c12 --- /dev/null +++ b/src/main/java/com/adminportal/repository/SubjectRepository.java @@ -0,0 +1,40 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +import com.adminportal.content.Subject; + +/** + * This Interface Extend JpaRepository to handle all database operation related to Subject data + * @author om prakash + * + */ +public interface SubjectRepository extends JpaRepository{ + + /** + * Find Subject object given subject name as input parameter + * @param subName name of subject name + * @return Subject Object + */ + Subject findBysubName(String subName); // list subject based on subject name + + /** + * update name of subject name given subject Id as input argument + * @param subName new subject name to be updated + * @param subId A unique Subject Id + * @return number of record updated + */ + @Modifying + @Query("update Subject set subName=?1 where subId=?2") //updating Subject Information + int updateSubjectName(String subName,int subId); + +} diff --git a/src/main/java/com/adminportal/repository/TestimonialRepository.java b/src/main/java/com/adminportal/repository/TestimonialRepository.java new file mode 100644 index 0000000..c543ff6 --- /dev/null +++ b/src/main/java/com/adminportal/repository/TestimonialRepository.java @@ -0,0 +1,45 @@ +package com.adminportal.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Testimonial; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Testimonial data + * @author om prakash + * + */ +public interface TestimonialRepository extends CrudRepository{ + + /** + * Find all testimonial record from database in descending order based in date on which testimonial added + * @return A list of testimonial + */ + @Query("from Testimonial t order by t.dateAdded desc") // fetching list of testimonial + List getAllTestimonial(); + + + /** + * Update testimionial data given Testimonial ID as one of input parameter + * @param name name of person to be updated + * @param desc description to be updated + * @param org organization name to be updated + * @param id testimonial ID + * @return number of record updated + */ + @Modifying + @Query("update Testimonial set name=?1,description=?2,organization=?3 where testimonialId=?4") // updating testimonial + int updateTestimonial(String name,String desc,String org,int id); + + + @Modifying + @Query("delete from Testimonial U where U.testimonialId=?1") + @Transactional + void deleteTestimonial(int testiID); + +} diff --git a/src/main/java/com/adminportal/repository/TopicRepository.java b/src/main/java/com/adminportal/repository/TopicRepository.java new file mode 100644 index 0000000..d25bc6c --- /dev/null +++ b/src/main/java/com/adminportal/repository/TopicRepository.java @@ -0,0 +1,136 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Topic resource + * @author om prakash + * + */ +public interface TopicRepository extends CrudRepository { + + /** + * Find list of Topic object based on SubjectClassMapping Object given as input parameter + * @param temp SubjectClassMapping object + * @return list of Topic object + */ + List findBysubjectClassMapping(SubjectClassMapping temp); // listing list topic based on mapping of class and subject + + /** + * Find Topic object based on SubjectClassMapping object and topic name given as input parameter + * @param subjectClassMapping SubjectClassMapping object + * @param topicName name of topic + * @return Topic object + */ + @Query("from Topic T where T.subjectClassMapping=?1 and T.topicName=?2") //topic based on subjectClassAmpping AND TOPICNAME + Topic findBysubjectClassMappingAndtopicName(SubjectClassMapping subjectClassMapping,String topicName); + + /** + * Checks whether topic exist based on SubjectClassMapping given as input parameter + * @param sub SubjectClassMapping object + * @return boolean value + */ + boolean existsBysubjectClassMapping(SubjectClassMapping sub); + + /* not in use right now */ + ArrayList findAllBysubjectClassMapping(ArrayList temp); + + + /** + * Find list of Topic object based on array SubjectClassMapping object given as inout parameter + * @param temp list of SubjectClassMapping object + * @return list of Topic object + */ + @Query("from Topic T where T.subjectClassMapping IN (:SubjectClass)") + ArrayList findAllByClassStandard(@Param("SubjectClass")ArrayList temp); + + /** + * update Topic given TopicID as one of the input argument + * @param desc Description to be updated + * @param poster poster path to be updated + * @param topicName TopicName to be updated + * @param date current date + * @param topicID Topic ID + * @return number of updated record + */ + @Modifying + @Query("update Topic set description=?1, poster=?2 , topicName=?3,dateModified=?4 where topicId=?5") //UPDATING TOPIC + int updateTopicDescAndQuiz(String desc,String poster,String topicName,Timestamp date,int topicID); + + /** + * update Topic given TopicID as one of the input argument + * @param status status value to be updated + * @param topicId Topic ID + * @return number of updated record + */ + @Modifying + @Query("update Topic set status=?1 where topicId=?2") // DISABLE OR ENABLE TOPIC BASED ON TOPIC id + int disableTopic(int status,int topicId); + + /** + * update Topic given TopicID as one of the input argument + * @param desc Description to be updated + * @param topicName TopicName to be updated + * @param date current date + * @param topicId Topic ID + * @return number of updated record + */ + @Modifying + @Query("update Topic set description=?1,topicName=?2,dateModified=?3 where topicId=?4") + int updateTopicDesc(String desc,String topicName,Timestamp date,int topicId); + + /** + * update Topic given TopicID as one of the input argument + * @param path path where poster is saved + * @param topicId Topic ID + * @return number of updated record + */ + @Modifying + @Query("update Topic set poster=?1 where topicId=?2") + int updateTopicPoster(String path,int topicId); + + @Modifying + @Query("delete from Topic U where U.topicId=?1") + @Transactional + void deleteTopic(int topicID); + + /** + * update topic date modified date based on topic ID given as input argument + * @param date current date + * @param topicId Topic ID + * @return number of updated record + */ + @Modifying + @Transactional + @Query("update Topic set dateModified=?1 where topicId=?2") + int updateRecentmodificationDate(Timestamp date,int topicId); + + /** + * Update list of Topic object based on list of SubjectClassMapping object given as one of input parameter + * @param val status to be set + * @param temp list of SubjectClassMapping object + * @return number of updated record + */ + @Modifying + @Query("update Topic T set status=:valdisEna where T.subjectClassMapping IN (:SubjectClass)") + int disableEnableAllByClassStandard(@Param("valdisEna")int val,@Param("SubjectClass")List temp); + + + +} diff --git a/src/main/java/com/adminportal/repository/TutorialRepository.java b/src/main/java/com/adminportal/repository/TutorialRepository.java new file mode 100644 index 0000000..0a3a541 --- /dev/null +++ b/src/main/java/com/adminportal/repository/TutorialRepository.java @@ -0,0 +1,62 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ +package com.adminportal.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Tutorial resource + * @author om prakash + * + */ +public interface TutorialRepository extends CrudRepository{ + + /** + * Find list of tutorial based on topic given as input parameter + * @param topic Topic object + * @return List of tutorial object + */ + List findAllBytopic(Topic topic); // listing list of tutorial + + /** + * Find list of tutorial based on topic and status value given as input parameter + * @param topic Topic object + * @param status status value (like 0,1) + * @return List of tutorial object + */ + @Query("from Tutorial U where U.topic=?1 and U.status=?2") + List findAllByTopicAndStatus(Topic topic,int status); + + /** + * update tutorial status value based on tutorial Id given as one of input argument + * @param status value to set + * @param id Tutorial ID + * @return number of updated record + */ + @Modifying + @Query("update Tutorial set status=?1 where tutorialId=?2") // enable or disable tutorial to view + int enableDisableTutorial(int status,int id); + + /** + * Find Tutorial object based on tutorial ID + * @param tutorialId Tutorial ID + * @return Tutorial Object + */ + Tutorial findBytutorialId(int tutorialId); // tutorial Object based on tutorialId + + @Modifying + @Query("delete from Tutorial U where U.tutorialId=?1") + @Transactional + void deleteTutorial(int tutorialID); + +} diff --git a/src/main/java/com/adminportal/repository/UserRepository.java b/src/main/java/com/adminportal/repository/UserRepository.java new file mode 100644 index 0000000..177d4bc --- /dev/null +++ b/src/main/java/com/adminportal/repository/UserRepository.java @@ -0,0 +1,97 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; + +import com.adminportal.domain.User; + + +/** + * This Interface Extend CurdRepository to handle all database operation related to USER data + * @author om prakash + * + */ +public interface UserRepository extends CrudRepository { + + /** + * Find user object given email as input parameter + * @param username Email in String format + * @return User object + */ + User findByemail(String username); /// user by Email + + /** + * Find User object given email and password as input parameter + * @param email email of user + * @param password password used during registration + * @return User Object + */ + @Query("from User U where U.email=?1 and U.password=?2") //check for existing user + User existsByUser(String email,String password); + + /** + * update user registered value (visibility in application) + * @param registered value to be set + * @param id User ID + * @return number of updated record + */ + @Modifying + @Query("update User set Registered=?1 where id=?2") // enabling user + int disableuser(int registered,int id); + + /** + * update User's teacher flag given user ID + * @param approve value to be set + * @param id User's ID + * @return number of updated record + */ + @Modifying + @Query("update User set approveTeacherFlag=?1 where id=?2") + int updateApproveTeacher(int approve,int id); + + /** + * checks whether user exist using email given as input argument + * @param email email of user + * @return Boolean value + */ + boolean existsByemail(String email); + + /** + * Update password for user + * @param password new password to be updated + * @param id User ID + * @return number of updated record + */ + @Modifying + @Query("update User set password=?1 where id=?2") // update password + int updateUserPassword(String password,int id); + + /** + * Update user basic details + * @param fname First name of user to be updated + * @param lname Last name of user to be updated + * @param id USer's ID + * @return number of record updated + */ + @Modifying + @Query("update User set fname=?1,lname=?2 where id=?3") // update password + int updateUserDetails(String fname,String lname,int id); + + /** + * Find user based on Token used for retrieving password + * @param token String value + * @return User Object + */ + User findBytoken(String token); + + + +} diff --git a/src/main/java/com/adminportal/repository/UserRoleRepository.java b/src/main/java/com/adminportal/repository/UserRoleRepository.java new file mode 100644 index 0000000..ed98ef5 --- /dev/null +++ b/src/main/java/com/adminportal/repository/UserRoleRepository.java @@ -0,0 +1,23 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; + +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; + +/** + * This Interface Extend CrudRepository to handle all database operation related to USERROLE data + * @author om prakash + * + */ +public interface UserRoleRepository extends CrudRepository { + + @Query("from UserRole U where U.user=?1") + void deleteByuser(User usr); +} diff --git a/src/main/java/com/adminportal/repository/VideoExternalRepository.java b/src/main/java/com/adminportal/repository/VideoExternalRepository.java new file mode 100644 index 0000000..0a82d3d --- /dev/null +++ b/src/main/java/com/adminportal/repository/VideoExternalRepository.java @@ -0,0 +1,116 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; + +/** + * This Interface Extend CrudRepository to handle all database operation related to Video resource + * @author om prakash + * + */ +public interface VideoExternalRepository extends CrudRepository { + + /** + * Find list of Video Object based on list of Topic given as input parameter + * @param topic list of topic object + * @return list of video object + */ + List findAllBytopic(List topic); //fetching List of video based on Topic + + /** + * Find list of Video Object based on type of resource(Video) given as input parameter + * @param type type of resource (video) + * @return list of video object + */ + List findAllBytype(String type); //fetching list of video based on Type + + /** + * Find list of Video object based on topic and type od resource (video) given as input paramter + * @param topic topic object + * @param type type of resource (video) + * @return list of video object + */ + @Query("from VideoExternal U where U.topic=?1 and U.type=?2") //fetching list of video based on type and topic + ArrayList findAllBytopicAndType(Topic topic,String type); + + /** + * update video description, source, url, date modified given Video ID as one of input parameter + * @param desc A long description to be set + * @param source A reference to video + * @param url Path of video + * @param date current ID + * @param id Video ID + * @return number of updated record + */ + @Modifying + @Query("update VideoExternal set description=?1,source=?2,url=?3,dateModified=?4 where videoId=?5") //updating video Information + int updateVideo(String desc,String source,String url,Timestamp date,int id); + + /** + * update video status value given Video ID as one of input parameter + * @param status status value to be set + * @param id video ID + * @return number of updated record + */ + @Modifying + @Query("update VideoExternal set status=?1 where videoId=?2") //Enabling or disabling status of video based on primary key + int EnableVideoContent(int status,int id); + + /** + * Find list of video object based on topic , status and type of resource(video) given as input parameter + * @param topic topic object + * @param status status value + * @param type type of resource (video) + * @return list of video object + */ + @Query("from VideoExternal U where U.topic=?1 and U.status=?2 and U.type=?3") + List findAllByTopicAndStatus(Topic topic,int status,String type); + + /** + * Find list of video object based on user object and type of resource given as input parameter + * @param usr A USer object + * @param type type of Resource (Video) + * @return list of video object + */ + @Query("from VideoExternal U where U.user=?1 and U.type=?2") //listing video based on user and type + List findAllByuser(User usr,String type); + + /** + * update video acceptedByAdmin,status and date approved given Video ID as one of input parameter + * @param status status to be set + * @param time current time + * @param id Video ID + * @return number of updated record + */ + @Modifying + @Query("update VideoExternal set acceptedByAdmin=?1,status=?1,dateApproved=?2 where videoId=?3") + int EnableAcceptedByAdminContent(int status,Timestamp time,int id); + + @Modifying + @Query("delete from VideoExternal U where U.videoId=?1") + @Transactional + void deleteVideo(int videoID); +} + + + + + + diff --git a/src/main/java/com/adminportal/security/Authority.java b/src/main/java/com/adminportal/security/Authority.java new file mode 100644 index 0000000..d870029 --- /dev/null +++ b/src/main/java/com/adminportal/security/Authority.java @@ -0,0 +1,25 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + */ + +package com.adminportal.security; + +import org.springframework.security.core.GrantedAuthority; + +public class Authority implements GrantedAuthority{ + + private final String authority; + + public Authority(String authority) { + this.authority=authority; + } + + + @Override + public String getAuthority() { + + return authority; + } + +} diff --git a/src/main/java/com/adminportal/service/ArticleExternalService.java b/src/main/java/com/adminportal/service/ArticleExternalService.java new file mode 100644 index 0000000..04afc89 --- /dev/null +++ b/src/main/java/com/adminportal/service/ArticleExternalService.java @@ -0,0 +1,116 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Article interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +/** + * This interface has all the method declaration related to Article Resource's database operation + * @author om prakash + * + */ +public interface ArticleExternalService { + + /** + * Finds all the Article Resource record from database + * @return List of Article resource + */ + List findAll(); + + /** + * Delete article resource from database given Article ID as input parameter + * @param id Article ID + */ + void deleteArticleById(int id) ; + + /** + * Find Article record from database given Article ID as input parameter + * @param id Article ID + * @return Article object + */ + ArticleExternal findByid(int id); + + /** + * update Article attributes like description, source, url and modified date given Article ID + * @param desc A long description to be set + * @param source A reference related to Article + * @param url A proper url + * @param date Current date + * @param id Article ID + * @return boolean value on success or failure + */ + boolean updateArticle(String desc, String source,String url,Timestamp date,int id); + + /** + * Count total number of Article resource from database + * @return number of article resource + */ + int countRow(); + + /** + * update status value in article resource record given Article ID as input argument + * @param status status value to be set + * @param id Article ID + * @return boolean value on success or failure + */ + boolean EnableArticleContent(int status,int id); + + /** + * Lists out all the article resource object based on Topic given as input argument + * @param topic Topic object + * @return List of article object + */ + List findAllByTopic(Topic topic); + + /** + * Lists out all the article resource object based on User given as input argument + * @param usr User Object + * @return List of article object + */ + List findALlByUser(User usr); + + /** + * update Article's status attribute given Article Id as input parameter + * @param status status value + * @param id Article ID + * @return boolean value on success or failure + */ + boolean EnableAcceptedByAdminArticleContent(int status,int id); + + /** + * Lists out all the article resource object based on Topic and status value given as input argument + * @param topic Topic object + * @return List of article object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * Delete article resource from database given Article object as input parameter + * @param article article object + * @return integer value + */ + int deleteArticle(ArticleExternal article); + + /** + * COunt total resource given Topic Object as input parameter + * @param temp Topic object + * @return total number of resource + */ + int countTotalResource(Topic temp); + + /** + * COunt total resource given list of Topic Object as input parameter + * @param temp list of Topic object + * @return total number of resource + */ + int countTotalResource(List temp); + +} diff --git a/src/main/java/com/adminportal/service/ClassService.java b/src/main/java/com/adminportal/service/ClassService.java new file mode 100644 index 0000000..9308683 --- /dev/null +++ b/src/main/java/com/adminportal/service/ClassService.java @@ -0,0 +1,49 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Class interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.util.List; + +import com.adminportal.content.Class; + +/** + * This interface has all the method declaration related to Class's database operation + * @author om prakash + * + */ +public interface ClassService { + + /** + * Find class object given class name as input parameter + * @param className name of class + * @return class object + * @throws Exception + */ + Class findByClassName(int className) throws Exception; + + /** + * Finds all the class object present in database + * @return list of class object + */ + List findAll(); + + /** + * Persist class object in database + * @param temp class object + * @return class object + */ + Class save(Class temp); + + /** + * count total number of class object present in database + * @return integer value + */ + int countRow(); + + + +} diff --git a/src/main/java/com/adminportal/service/CommentReplyService.java b/src/main/java/com/adminportal/service/CommentReplyService.java new file mode 100644 index 0000000..c8b9954 --- /dev/null +++ b/src/main/java/com/adminportal/service/CommentReplyService.java @@ -0,0 +1,33 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Comment-Reply interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.util.List; + +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; + +/** + * This interface has all the method declaration related to Comment Reply's database operation + * @author om prakash + * + */ +public interface CommentReplyService { + + /** + * Find all the comment Reply object given main comment as input parameter + * @param com A comment object + * @return List of commentReply object + */ + List getReplyOnComment(Comment com); + + /** + * count total number of commentReply object + * @return integer value + */ + int countRow(); + +} diff --git a/src/main/java/com/adminportal/service/CommentService.java b/src/main/java/com/adminportal/service/CommentService.java new file mode 100644 index 0000000..8ba8b96 --- /dev/null +++ b/src/main/java/com/adminportal/service/CommentService.java @@ -0,0 +1,100 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Comment interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.util.List; +import java.util.Set; + +import javax.swing.text.Document; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to Comment database operation + * @author om prakash + * + */ +public interface CommentService { + /** + * Count total number comment record from database + * @return integer + */ + int countRow(); + + /** + * Find list of Comment object from database based on Video object given as input parameter + * @param video video Object + * @return List of Comment object + */ + List getCommentByVideoId(VideoExternal video); + + /** + * Find list of Comment object from database based on Article object given as input parameter + * @param article A article object + * @return List of Comment object + */ + List getCommentByArticleId(ArticleExternal article); + + /** + * Find list of Comment object from database based on Quiz object given as input parameter + * @param quiz A quiz object + * @return List of Comment object + */ + List getCommentByQuizId(QuizQuestion quiz); + + /** + * Find list of Comment object from database based on document object given as input parameter + * @param document document object + * @return List of Comment object + */ + List getCommentByDocumentId(DocumentExternal document); + + /** + * Find list of Comment object from database based on Phet object given as input parameter + * @param phet Phet object + * @return List of Comment object + */ + List getCommentByPhetId(Phets phet); + + /** + * Find list of Comment object from database based on Lesson object given as input parameter + * @param lesson Lesson Object + * @return List of Comment object + */ + List getCommentByLessonId(LessonPlan lesson); + + /** + * Find list of Comment object from database based on ConcepMap object given as input parameter + * @param conceptMap ConcepMap object + * @return List of Comment object + */ + List getCommentByConceptMap(ConceptMap conceptMap); + + /** + * Persist Comment reply to database using comment object + * @param comment + * @param commentReply + * @return Comment object + */ + Comment addReplyComment(Comment comment,Set commentReply); + + /** + * Find comment object from database based on comment ID + * @param id Comment ID + * @return Comment Object + */ + Comment findById(int id); + +} diff --git a/src/main/java/com/adminportal/service/ConceptMapService.java b/src/main/java/com/adminportal/service/ConceptMapService.java new file mode 100644 index 0000000..7ce9ab3 --- /dev/null +++ b/src/main/java/com/adminportal/service/ConceptMapService.java @@ -0,0 +1,113 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Concept-map interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to ConceptMap database operation + * @author om prakash + * + */ +public interface ConceptMapService { + + /** + * lists out all the conceptMap object from database + * @return list of ConceptMap object + */ + List findAll(); + + /** + * Find conceptMap object given ConceptMap ID + * @param id ConceptMap ID + * @return ConceptMap object + */ + ConceptMap findByid(int id); + + /** + * Update conceptMap's description, Url, remark, date modified value given ConceptMap ID + * @param desc Description to be set + * @param url path to be set + * @param remark remark heading + * @param date current date + * @param id ConceptMap ID + * @return boolean value based on successful operation or not ? + */ + boolean updateConcept(String desc, String url,String remark,Timestamp date,int id); + + /** + * Update conceptMap's description,remark, date modified value given ConceptMap ID + * @param desc description to be set + * @param remark remark to be set + * @param date current date + * @param id ConceptMap ID + * @return boolean value based on successful operation or not ? + */ + boolean updateConceptDesc(String desc,String remark,Timestamp date,int id); + + /** + * Count total number of conceptMap record in database + * @return integer + */ + int countRow(); + + /** + * Update conceptMap's status value given ConceptMap ID + * @param status status value to be set + * @param id ConceptMap ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableConceptContent(int status,int id); + + /** + * Find list of ConceptMap object given topic object as input parameter + * @param topic Topic object + * @return list of ConceptMap object + */ + List findAllByTopic(Topic topic); + + /** + * Find list of ConceptMap object given User object as input parameter + * @param usr User object + * @return list of ConceptMap object + */ + List findALlByUser(User usr); + + /** + * Update conceptMap's acceptedByAdmin value given ConceptMap ID + * @param status status value to be set + * @param id ConceptMap ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableAcceptedByAdminConceptContent(int status,int id); + + /** + * Find list of Conceptmap object based on Topic Object given as input parameter + * @param topic Topic object + * @return list of ConceptMap object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * Persist concepMap object into database + * @param temp ConceptMap object + * @return 0 + */ + int save(ConceptMap temp); + + /** + * Delete ConceptMap record from database + * @param concept ConceptMap object + */ + void deleteConceptMap(ConceptMap concept); + +} diff --git a/src/main/java/com/adminportal/service/ContactFormService.java b/src/main/java/com/adminportal/service/ContactFormService.java new file mode 100644 index 0000000..3d73b59 --- /dev/null +++ b/src/main/java/com/adminportal/service/ContactFormService.java @@ -0,0 +1,25 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Contact form interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.util.List; + +import com.adminportal.content.ContactForm; + +/** + * This interface has all the method declaration related to ContactForm database operation + * @author om prakash + * + */ +public interface ContactFormService { + + /** + * List out All the received query from database + * @return List of ContactForm object + */ + List getAllMessages(); // fetching list of message (entire) + +} diff --git a/src/main/java/com/adminportal/service/DocumentExternalService.java b/src/main/java/com/adminportal/service/DocumentExternalService.java new file mode 100644 index 0000000..e8f7cbf --- /dev/null +++ b/src/main/java/com/adminportal/service/DocumentExternalService.java @@ -0,0 +1,121 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Document interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to Document database operation + * @author om prakash + * + */ +public interface DocumentExternalService { + /** + * Lists out all the document object from database + * @return List of Document object + */ + List findAll(); + + /** + * Delete Document object from database given Document ID + * @param id Document ID + */ + void deleteDocumentById(int id) ; + + /** + * Find Document object given Document ID as input parameter + * @param id Document ID + * @return Document Object + */ + DocumentExternal findByid(int id) ; + + /** + * update Document's Description, source, path, date modified value given document ID + * @param desc Description to be set + * @param source source to be set + * @param url file path to be set + * @param date current date + * @param Id Document ID + * @return boolean value based on successful operation or not ? + */ + boolean updateDocument(String desc,String source,String url,Timestamp date,int Id) ; + + /** + * update Document's Description, source,date modified value given document ID + * @param desc Description to be set + * @param source source to be set + * @param date current date + * @param Id Document ID + * @return boolean value based on successful operation or not ? + */ + boolean updateDocumentDesc(String desc,String source,Timestamp date,int Id) ; + + /** + * Count total number of Document object in database + * @return integer + */ + int countRow(); + + /** + * update Document's status value given document ID + * @param status status value to be set + * @param id Document ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableDocumentContent(int status,int id) ; + + /** + * Find out document objects given Topic object as input parameter + * @param topic Topic object + * @return List of Document object + */ + List findAllByTopic(Topic topic); + + /** + * Find out document objects given User object as input parameter + * @param usr User object + * @return List of Document object + */ + List findALlByUser(User usr); + + /** + * update Document's acceptedByAdmin value given document ID + * @param status status value to be set + * @param id Document ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableAcceptedByAdminDocumentContent(int status,int id); + + /** + * Find out list of Document object based on status and topic + * @param topic Topic object + * @return List of Document object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * Persist Document Object into database + * @param temp Document object + * @return interger value + */ + int save(DocumentExternal temp); + + /** + * Delete Document record from database + * @param document Document Object + */ + void deleteDocuemnt(DocumentExternal document); + +} diff --git a/src/main/java/com/adminportal/service/EventService.java b/src/main/java/com/adminportal/service/EventService.java new file mode 100644 index 0000000..e3fa174 --- /dev/null +++ b/src/main/java/com/adminportal/service/EventService.java @@ -0,0 +1,74 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Event interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.sql.Date; +import java.util.List; + +import com.adminportal.content.ConceptMap; +import com.adminportal.content.Events; + +import antlr.debug.Event; +/** + * This interface has all the method declaration related to Event database operation + * @author om prakash + * + */ +public interface EventService { + /** + * Count total number of event record from database + * @return integer value + */ + int getCount(); + + /** + * Persist event object into database + * @param temp Event object + * @return Event object + */ + Events save(Events temp); + + /** + * List all the event object from database + * @return list of event object + */ + List findAll(); + + /** + * Find all the event from database in descending order based on start date of event + * @return list of event object + */ + List getAllEventdata(); + + /** + * Find event object using event ID + * @param id Event ID + * @return Event object + */ + Events getbyid(int id); + + /** + * update Event attributes in database given Event ID as one of the input parameter + * @param head Headline + * @param desc Description + * @param startDate Start date of event + * @param enddate End date of event + * @param regStart Start date of registration + * @param regEnd End date of registration + * @param coordName Coordinator name + * @param poster_Path path of file saved + * @param id Event ID + * @return boolean value based on successful operation or not ? + * @throws Exception + */ + boolean updateEvent(String head,String desc,Date startDate,Date enddate,Date regStart,Date regEnd,String coordName,String poster_Path,int id) throws Exception; + + /** + * Delete event object from database + * @param event event object + */ + void deleteEvent(Events event); +} diff --git a/src/main/java/com/adminportal/service/LessonPlanService.java b/src/main/java/com/adminportal/service/LessonPlanService.java new file mode 100644 index 0000000..b6a2ef1 --- /dev/null +++ b/src/main/java/com/adminportal/service/LessonPlanService.java @@ -0,0 +1,109 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Lesson interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to LessonPlan database operation + * @author om prakash + * + */ +public interface LessonPlanService { + + /** + * Lists out all the LessonPlan object from database + * @return List of LessonPlan object + */ + List findAll(); + + /** + * Delete lessonPlan object from database + * @param id LessonPlan ID + */ + void deleteLessonById(int id); + + /** + * Count total number lessonPlan object in database + * @return integer + */ + int countRow(); + + /** + * update lessonPlan visibility flag given lessonplan ID + * @param status status value to be set + * @param id LessonPlan ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableLessonPlanContent(int status,int id); + + /** + * Find LessonPlan object given lessonPlan ID + * @param id LessonPlan ID + * @return LessonPlan object + */ + LessonPlan findById(int id); + + /** + * Find list of LessonPlan object given Topic object + * @param topic Topic Object + * @return List of LessonPlan object + */ + List findAllByTopic(Topic topic) ; + + /** + * Find list of LessonPlan object given user object + * @param usr A USer object + * @return List of LessonPlan object + */ + List findALlByUser(User usr) ; + + /** + * Update LesonPlan's file path, modified date value given LessonPlan ID + * @param dat current timestamp + * @param lessonPath file path + * @param id LessonPlan ID + * @return boolean value based on successful operation or not ? + */ + boolean updateLessonPlan(Timestamp dat,String lessonPath,int id); + + /** + * Update LesonPlan's acceptedByAdmin value given LessonPlan ID + * @param status status value to be set + * @param id LessonPlan ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableAcceptedByAdminLessonPlanContent(int status,int id) ; + + /** + * Find list of LessonPlan object given Topic object and status value + * @param topic Topic object + * @return List of LessonPlan object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * persist lessonplan object into database + * @param temp LessonPlan Object + * @return + */ + int save(LessonPlan temp); + + /** + * Delete lessonPlan object from database + * @param lesson lessonPlan object + */ + void deleteLessonPlan(LessonPlan lesson); +} diff --git a/src/main/java/com/adminportal/service/PhetsService.java b/src/main/java/com/adminportal/service/PhetsService.java new file mode 100644 index 0000000..5a74255 --- /dev/null +++ b/src/main/java/com/adminportal/service/PhetsService.java @@ -0,0 +1,106 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Phets interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to Phet database operation + * @author om prakash + * + */ +public interface PhetsService { + + /** + * Lists out all the Phet object from database + * @return list of phet Object + */ + List findAll(); + + /** + * Delete Phet from database + * @param id Phet ID + */ + void deletePhetById(int id) ; + + /** + * Find Phet object given Phet ID + * @param id Phet ID + * @return Phet object + */ + Phets findByid(int id) ; + + /** + * Update Phet's Source, url, date modified and description given Phet ID + * @param source reference value to be set + * @param url url to be set + * @param date current date + * @param desc description to be set + * @param id Phet ID + * @return boolean value based on successful operation or not ? + */ + boolean updatePhet(String source,String url,Timestamp date,String desc,int id) ; + + /** + * Count total number of Phet record in database + * @return integer + */ + int countRow(); + + /** + * Update Phet's status value given Phet ID + * @param status status value to be set + * @param id Phet ID + * @return boolean value based on successful operation or not ? + */ + boolean EnablePhetContent(int status,int id) ; + + /** + * Finds all the Phet object from database given Topic Object + * @param topic topic Object + * @return list of phet Object + */ + List findAllByTopic(Topic topic); + + /** + * Finds all the Phet object from database given User Object + * @param usr User object + * @return list of phet Object + */ + List findALlByUser(User usr); + + /** + * Update Phet's acceptedByAdmin value given Phet ID + * @param status status value to be set + * @param id Phet ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableAcceptedByAdminPhetContent(int status,int id); + + /** + * Finds all the Phet object from database given Topic Object and status value + * @param topic Topic object + * @return list of phet Object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * Delete Phets object from database + * @param phet Phets object + */ + void deletePhet(Phets phet); + + +} diff --git a/src/main/java/com/adminportal/service/QuizQuestionService.java b/src/main/java/com/adminportal/service/QuizQuestionService.java new file mode 100644 index 0000000..de4dc4e --- /dev/null +++ b/src/main/java/com/adminportal/service/QuizQuestionService.java @@ -0,0 +1,129 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Quiz interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to QuizQuestion database operation + * @author om prakash + * + */ +public interface QuizQuestionService { + + /** + * Lists out all the QuizQuestion object from database + * @return list of QuizQuestion object + */ + List findAll(); + + /** + * delete QuizQuestion object from database + * @param id QuizQuestion ID + */ + void deleteQuizById(int id) ; + + /** + * Find QuizQuestion object given QuizQuestion ID + * @param id QuizQuestion ID + * @return QuizQuestion object + */ + QuizQuestion findById(int id); + + /** + * Update QuizQuestion's answer file path,question file path, modified date value given QuizQuestion ID + * @param question question path to be set + * @param answer answer path to be set + * @param date current date + * @param quizId QuizQuestion ID + * @return boolean value based on successful operation or not ? + */ + boolean updateQuiz(String question,String answer,Timestamp date,int quizId) ; + + /** + * Update QuizQuestion's question file path, modified date value given QuizQuestion ID + * @param question question path to be set + * @param date current date + * @param quizId QuizQuestion ID + * @return boolean value based on successful operation or not ? + */ + boolean updateQuizQuestion(String question,Timestamp date,int quizId) ; + + /** + * Update QuizQuestion's answer file path, modified date value given QuizQuestion ID + * @param answer answer path to be set + * @param date current date + * @param quizId QuizQuestion ID + * @return boolean value based on successful operation or not ? + */ + boolean updateQuizAnswer(String answer,Timestamp date,int quizId) ; + + /** + * Count total number of QuizQuestion record from the database + * @return integer + */ + int countRow(); + + /** + * Update QuizQuestion's visibility value given QuizQuestion ID + * @param status status value to be set + * @param id QuizQuestion ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableQuizContent(int status,int id); + + /** + * Find list of QuizQuestion object given Topic object + * @param topic Topic Object + * @return list of QuizQuestion object + */ + List findAllByTopic(Topic topic); + + /** + * Find list of QuizQuestion object given User object + * @param usr User Object + * @return list of QuizQuestion object + */ + List findALlByUser(User usr); + + /** + * Update QuizQuestion's acceptedByAdmin value given QuizQuestion ID + * @param status status to be set + * @param id QuizQuestion ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableAcceptedByAdminQuizContent(int status,int id); + + /** + * Find list of QuizQuestion object given Topic and status value + * @param topic Topic Object + * @return list of QuizQuestion object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * Persist QuizQuestion object into database + * @param temp QuizQuestion object + * @return integer + */ + int save(QuizQuestion temp); + + /** + * delete QuizQuestion object from database + * @param quiz QuizQuestion object + */ + void deleteQuiz(QuizQuestion quiz); + +} diff --git a/src/main/java/com/adminportal/service/RoleDetailService.java b/src/main/java/com/adminportal/service/RoleDetailService.java new file mode 100644 index 0000000..c1f1d42 --- /dev/null +++ b/src/main/java/com/adminportal/service/RoleDetailService.java @@ -0,0 +1,39 @@ + /* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Role interacting with its repository for database operation + */ + +package com.adminportal.service; + +import com.adminportal.domain.RoleDetail; + +/** + * This interface has all the method declaration related to RoleDetail database operation + * @author om prakash + * + */ +public interface RoleDetailService { + + /** + * Find RoleDetail object using role name + * @param sub Role name + * @return RoleDetail object + * @throws Exception + */ + RoleDetail findByRoleName(String sub) throws Exception; + + /** + * Count total number of roleDetail object from database + * @return integer + */ + int countRow(); + + /** + * Persist roleDetail object into database + * @param role roleDetail object + * @return RoleDeatil object + */ + RoleDetail save(RoleDetail role); + +} diff --git a/src/main/java/com/adminportal/service/SubjectClassService.java b/src/main/java/com/adminportal/service/SubjectClassService.java new file mode 100644 index 0000000..d5ea01d --- /dev/null +++ b/src/main/java/com/adminportal/service/SubjectClassService.java @@ -0,0 +1,101 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for SubjectClassMapping interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import com.adminportal.content.Class; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; + +/** + * This interface has all the method declaration related to SubjectClass database operation + * @author om prakash + * + */ +public interface SubjectClassService { + + /** + * Persist SubjectClass object with proper relationship among subject and class object + * @param sub Subject Object + * @param subClass Set of class object + * @return Subject object + * @throws Exception + */ + Subject createSubjectClass(Subject sub,Set subClass) throws Exception; + + /** + * Persist SubjectClass object with proper relationship among Topic + * @param topic Topic object + * @param subjectClassmapping SubjectClassMapping object + * @return Subject object + * @throws Exception + */ + Subject createTopic(Topic topic,SubjectClassMapping subjectClassmapping) throws Exception; + + /** + * Find list of SubjectClassMapping object based on class object + * @param classTemp class object + * @return list of SubjectClassMapping object + * @throws Exception + */ + List getSubjectFromClass(Class classTemp) throws Exception; + + /** + * Find SubjectClassMapping object based on class object and subject object + * @param tempClass class object + * @param subject subject object + * @return SubjectClassMapping object + * @throws Exception + */ + SubjectClassMapping findBysubAndstandard(Class tempClass,Subject subject) throws Exception; + + /** + * Find list of SubjectClassMapping object based on class object + * @param classTemp class object + * @return list of SubjectClassMapping object + * @throws Exception + */ + List getClassFromMapping(Class classTemp) throws Exception; + + /** + * count total number SubjectClassMapping object from database + * @return integer + */ + int countRow(); + + /** + * Find list of SubjectClassMapping object based on subject object + * @param subTemp subject object + * @return list of SubjectClassMapping object + * @throws Exception + */ + List getClassFromSubject(Subject subTemp) throws Exception; + + /** + * update visibility in SubjectClassMapping's status value in record given subject object + * @param status status value to be set + * @param sub subject object + * @return number of updated record + */ + int updateSubjectinAllField(boolean status,Subject sub); + + /** + * update visibility in SubjectClassMapping's status value in record given Class object + * @param status status value to be set + * @param clas class object + * @return number of updated record + */ + int updateClassinAllField(boolean status,Class clas); + + +} diff --git a/src/main/java/com/adminportal/service/SubjectService.java b/src/main/java/com/adminportal/service/SubjectService.java new file mode 100644 index 0000000..4671756 --- /dev/null +++ b/src/main/java/com/adminportal/service/SubjectService.java @@ -0,0 +1,81 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0. + * Description : Service class for Subject interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.util.ArrayList; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +/** + * This interface has all the method declaration related to Subject database operation + * @author om prakash + * + */ +public interface SubjectService { + + /** + * Find Subject object given subject's subject name as input parameter from database + * @param subjectName subject name + * @return Subject object + * @throws Exception + */ + Subject findBySubjectName(String subjectName) throws Exception; + + /** + * List out all the subject object from database + * @return list of subject object + */ + List findAll(); + + /** + * Find Subject object given subject's subject name as input parameter from database + * @param sub Subject name + * @return Subject object + * @throws Exception + */ + Subject findBysubName(String sub) throws Exception; + + /** + * Find Subject object given subject ID from database + * @param id subject ID + * @return Subject Object + * @throws Exception + */ + Subject findById(int id) throws Exception; + + /** + * Count total number of subject record from the database + * @return integer + */ + int countRow(); + + /** + * Persist Subject object into database + * @param sub subject object + * @return subject object + */ + Subject save(Subject sub); + + /** + * Update Subject's subject name given Subject ID + * @param subName subject name to be set + * @param subId Subject ID + * @return boolean value based on successful operation or not ? + */ + boolean updateSubjectName(String subName,int subId); + +} + \ No newline at end of file diff --git a/src/main/java/com/adminportal/service/TestimonialService.java b/src/main/java/com/adminportal/service/TestimonialService.java new file mode 100644 index 0000000..33ce04d --- /dev/null +++ b/src/main/java/com/adminportal/service/TestimonialService.java @@ -0,0 +1,67 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for testimonial interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.util.List; + +import com.adminportal.content.ConceptMap; +import com.adminportal.content.Testimonial; + +/** + * This interface has all the method declaration related to Testimonial database operation + * @author om prakash + * + */ +public interface TestimonialService { + + /** + * Count total number of testimonial record in database + * @return integer + */ + int getCount(); + + /** + * persist Testimonial object in database + * @param temp testimonial object + */ + void save(Testimonial temp); + + /** + * Find all testimonial record from database + * @return list of testimonial object + */ + List findAll(); + + /** + * Find all testimonial record from database in descending order based in date on which testimonial added + * @return list of testimonial object + */ + List getAlltestimonial(); + + /** + * Find testimonial record from database using testimonial ID + * @param id testimonial ID + * @return Testimonial object + */ + Testimonial getbyId(int id); + + /** + * Update testimonial attributes given testimonial ID as input argument + * @param name Name of person + * @param desc Description + * @param org Organization + * @param id Testimonial ID + * @return boolean value denoting successful or failure of database operation + */ + boolean updateTestimonial(String name,String desc,String org,int id); + + /** + * Delete testimonial record from database + * @param testi Testimonial object + */ + void deleteTestimonail(Testimonial testi); + +} diff --git a/src/main/java/com/adminportal/service/TopicService.java b/src/main/java/com/adminportal/service/TopicService.java new file mode 100644 index 0000000..d6b6a21 --- /dev/null +++ b/src/main/java/com/adminportal/service/TopicService.java @@ -0,0 +1,128 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Topic interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.repository.query.Param; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; + +/** + * This interface has all the method declaration related to Topic database operation + * @author om prakash + * + */ +public interface TopicService { + + + /** + * Find list of Topic based on SubjectCLassMapping object given as input parameter + * @param local SubjectClassMapping object + * @return List of topic Object + */ + List findBysubjectclassMapping(SubjectClassMapping local); + + /** + * Find topic object based on SubjectClassMapping object and topic name given as input parameter + * @param sub SubjectClassMapping object + * @param topicName topic Name + * @return Topic Object + */ + Topic findBysubjectClassMappingAndtopicName(SubjectClassMapping sub, String topicName); + + /** + * Lists out all topic record from the database + * @return list of topic object + */ + List findAll(); + + /** + * update topic attribute status value based on topic ID given as one of input parameter + * @param status status value to be set + * @param id Topic ID + * @return boolean value based on successful operation or not ? + */ + boolean disableEnableTopicById(int status,int id); + + /** + * Find topic object given Topic Id as input parameter + * @param id Topic ID + * @return Topic object + */ + Topic findById(int id); + + /** + * Update Topic's description, poster path, topicName, Date modified given Topic ID as one of input parameter + * @param desc Description to be set + * @param poster file path to be ser + * @param topicName Topic Name to be set + * @param date Current date + * @param topicID Topic ID + * @return boolean value based on successful operation or not ? + */ + boolean updateTopic(String desc,String poster,String topicName,Timestamp date,int topicID); + + /** + * Count total number of topic record from database + * @return integer + */ + int countRow(); + + /** + * Update Topic's description,topicName, Date modified given Topic ID as one of input parameter + * @param desc Description to be set + * @param topicName Topic Name to be set + * @param date current date + * @param topicId Topic ID + * @return boolean value based on successful operation or not ? + */ + boolean updateTopicDesc(String desc,String topicName,Timestamp date,int topicId); + + /** + * List out topic object given list of subjectClassMapping object as input parameter + * @param tempSubjectClass list of SubjectClassMapping object + * @return list of topic + */ + List findBySubjectClassMppaing(List tempSubjectClass); + + /** + * update Topic's Poster path given Topic ID as input parameter + * @param path File path to be set + * @param topicId Topic ID + * @return boolean value based on successful operation or not ? + */ + boolean updateTopicPoster(String path,int topicId); + + /** + * delete Topic object from database + * @param topic Topic object + */ + void deleteTopic(Topic topic); + + /** + * Update Topic visibility given list of SubjectClassMapping object. + * @param status status value to be set + * @param temp list of SubjectClassMapping object + * @return integer value + */ + int disableEnableAllByClassStandard(int status,List temp); + + + +} diff --git a/src/main/java/com/adminportal/service/TutorialService.java b/src/main/java/com/adminportal/service/TutorialService.java new file mode 100644 index 0000000..aff53c2 --- /dev/null +++ b/src/main/java/com/adminportal/service/TutorialService.java @@ -0,0 +1,66 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Tutorial interacting with its repository for database operation + */ +package com.adminportal.service; + +import java.util.List; + +import com.adminportal.content.ConceptMap; +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; +/** + * This interface has all the method declaration related to Tutorial database operation + * @author om prakash + * + */ +public interface TutorialService { + + /** + * Count total number Tutorial resource in database + * @return integer + */ + int countRow(); + + /** + * Lists out all the tutorial stored in database + * @return list of tutorial object + */ + List getAllTutorial(); + + /** + * Lists out all the tutorial stored in database given Topic object as input parameter + * @param topic Topic object + * @return list of tutorial object + */ + List getAllTutorialByTopic(Topic topic); + + /** + * update topic visibility flag value given tutorial ID as one of input parameter + * @param status status value to be set + * @param id Tutorial ID + * @return boolean value based on successful operation or not ? + */ + boolean enableDisableTutorial(int status,int id); + + /** + * FInd Tutorial object given tutorial Id + * @param tutorialID Tutorial ID + * @return tutorial object + */ + Tutorial getById(int tutorialID); + + /** + * Find list of tutorial based on topic object and status value(Implicit) given as input parameter + * @param topic Topic object + * @return list of tutorial object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * Delete tutorial record from database + * @param tutorial Tutorial Object + */ + void deleteTutorial(Tutorial tutorial); +} diff --git a/src/main/java/com/adminportal/service/UserRoleService.java b/src/main/java/com/adminportal/service/UserRoleService.java new file mode 100644 index 0000000..d5075a1 --- /dev/null +++ b/src/main/java/com/adminportal/service/UserRoleService.java @@ -0,0 +1,15 @@ +package com.adminportal.service; + +/** + * This interface has all the method declaration related to USerRole database operation + * @author om prakash + * + */ +public interface UserRoleService { + /** + * Count total number of record in database + * @return integer + */ + int countRow(); + +} diff --git a/src/main/java/com/adminportal/service/UserService.java b/src/main/java/com/adminportal/service/UserService.java new file mode 100644 index 0000000..a08e260 --- /dev/null +++ b/src/main/java/com/adminportal/service/UserService.java @@ -0,0 +1,236 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for USer interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.util.List; +import java.util.Set; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; + +/** + * This interface has all the method declaration related to User database operation + * @author om prakash + * + */ + +public interface UserService { + + /** + * Find User object given user email address + * @param username email address + * @return User object + */ + User findByUsername(String username); + + /** + * Find User object given user's token + * @param token random token + * @return User object + */ + User findByToken(String token); + + /** + * Persist user object in database + * @param user A user object + * @return user object + */ + User save(User user); + + /** + * Find User object given user email and password + * @param username email of user + * @param password password of user + * @return user object + * @throws Exception + */ + User existsByUser(String username,String password) throws Exception; + + /** + * Persist User object with relationship given in list of userRole object + * @param user User object + * @param userRoles list of UserRole object + * @return User object + * @throws Exception + */ + User createUser(User user, Set userRoles) throws Exception; + + /** + * Find all the user record from database + * @return list of user object + */ + List findAll(); + + /** + * Find USer object using User ID + * @param id User ID + * @return User object + */ + User findById(int id); + + /** + * Delete User object from database given user ID + * @param id User ID + */ + void deleteById(int id); + + /** + * Update User's visibility in database + * @param isvalid value to be set + * @param id User ID + * @return boolean value based on successful operation or not ? + */ + boolean disableEnableUser(int isvalid,int id); + + /** + * Update User's TeacherApprove field in database + * @param isvalid value to be set + * @param id User ID + * @return boolean value based on successful operation or not ? + */ + boolean enableApproveTeacher(int isvalid,int id); + + /** + * Checks if User exist given email address + * @param Email Email address + * @return boolean value based on successful operation or not ? + */ + boolean existByEmail(String Email); + + /** + * Add user data in Article's user field and persist Article object into database + * @param usr User object + * @param article Set of Article resource object + * @return User object + */ + User addUserToArticle(User usr,Set article); + + /** + * Add user data in DocumentExternal's user field and persist DocumentExternal object into database + * @param usr User object + * @param document Set of DocumentExternal resource object + * @return User object + */ + User addUserToDocument(User usr,Set document); + + /** + * Add user data in LessonPlan's user field and persist LessonPlan object into database + * @param usr User object + * @param lesson Set of LessonPlan resource object + * @return User object + */ + User addUserToLessonplan(User usr,Set lesson); + + /** + * Add user data in Phets's user field and persist Phets object into database + * @param usr User object + * @param phet Set of Phets resource object + * @return User object + */ + User addUserToPhets(User usr,Set phet); + + /** + * Add user data in QuizQuestion's user field and persist QuizQuestion object into database + * @param usr User object + * @param quiz Set of QuizQuestion resource object + * @return User object + */ + User addUserToQuizQuestion(User usr,Set quiz); + + /** + * Add user data in ConceptMap's user field and persist ConceptMap object into database + * @param usr User object + * @param concept Set of ConceptMap resource object + * @return User object + */ + User addUserToConceptMap(User usr,Set concept); + + /** + * Add user data in VideoExternal's user field and persist VideoExternal object into database + * @param usr User object + * @param video Set of VideoExternal resource object + * @return User object + */ + User addUserToVideo(User usr,Set video); + + /** + * Add user data in Tutorial's user field and persist Tutorial object into database + * @param usr User object + * @param tutorial Set of Tutorial resource object + * @return User object + */ + User addUserToTutorial(User usr,Set tutorial); + + /** + * Add user data in Comment's user field and persist Comment object into database + * @param usr User object + * @param comment Set of Comment object + * @return User object + */ + User addUserToComment(User usr,Set comment); + + /** + * Add user data in commentReply's user field and persist CommentReply object into database + * @param usr User Object + * @param comReply Set of CommentReply object + * @return + */ + User addUserToCommentReply(User usr,Set comReply); + + /** + * Add user data in class's user field and persist class object into database + * @param usr User object + * @param clas class object + * @return User object + */ + User addUserToClass(User usr,Class clas); + + /** + * Add user data in Subject's user field and persist subject object into database + * @param usr User object + * @param sub subject object + * @return User object + */ + User adduserToSubject(User usr, Subject sub); + + /** + * update User's Password given USer Id + * @param password + * @param id User ID + * @return boolean value based on successful operation or not ? + */ + boolean updateUserPassword(String password,int id); + + /** + * Update user's fname,lname given User ID + * @param fname first name of user + * @param lname last name of user + * @param id user ID + * @return boolean value based on successful operation or not ? + */ + boolean updateUserDetails(String fname,String lname,int id); + + /** + * COunt total number of user record in database + * @return integer + */ + int countRow(); + + +} diff --git a/src/main/java/com/adminportal/service/VideoExternalService.java b/src/main/java/com/adminportal/service/VideoExternalService.java new file mode 100644 index 0000000..b0699c2 --- /dev/null +++ b/src/main/java/com/adminportal/service/VideoExternalService.java @@ -0,0 +1,110 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Service class for Video interacting with its repository for database operation + */ + +package com.adminportal.service; + +import java.sql.Timestamp; +import java.util.List; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; + +/** + * This interface has all the method declaration related to Video database operation + * @author om prakash + * + */ +public interface VideoExternalService { + /** + * lists out list of all video object from database + * @return list of video object + */ + List findAll(); + /** + * Delete Video record from database given Video ID + * @param id Video ID + */ + void deleteVideoById(int id); + + /** + * Find out video record from database given Video ID + * @param id Video ID + * @return video object + */ + VideoExternal findById(int id); + + /** + * update Video's description, source, video path, date modified given video ID + * @param desc description to be set + * @param source A reference to be set + * @param url video path to be set + * @param date current date + * @param id Video ID + * @return boolean value based on successful operation or not ? + */ + boolean updateVideo(String desc,String source,String url,Timestamp date,int id); + + /** + * Count total number of video object from database + * @return integer + */ + int countRow(); + + /** + * update Video's visibility flag given video ID + * @param status status value to be set + * @param id Video ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableVideoContent(int status,int id); + + /** + * Find all the video object based on topic object + * @param topic topic object + * @return list of video object + */ + List findAllByTopic(Topic topic); + + /** + * Find all the video object based on USER OBJECT + * @param usr user object + * @return list of video object + */ + List findALlByUser(User usr); + + /** + * update Video's acceptedByAdmin value given video ID + * @param status status value to be set + * @param id Video ID + * @return boolean value based on successful operation or not ? + */ + boolean EnableAcceptedByAdminVideoContent(int status,int id); + + /** + * Find all the video object based on topic and status value + * @param topic topic object + * @return list of video object + */ + List findAllByTopicAndStatus(Topic topic); + + /** + * persist video object into database + * @param temp video object + * @return integer + */ + int save(VideoExternal temp); + + /** + * Delete Video record from database + * @param video video object + */ + void deleteVideo(VideoExternal video); + +} diff --git a/src/main/java/com/adminportal/service/impl/ArticleExternalServiceImpl.java b/src/main/java/com/adminportal/service/impl/ArticleExternalServiceImpl.java new file mode 100644 index 0000000..297c47f --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/ArticleExternalServiceImpl.java @@ -0,0 +1,185 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Article Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.repository.ArticleExternalRepository; +import com.adminportal.service.ArticleExternalService; +import com.spoken.Utility.ServiceUtility; + +/** + * Default implementation of the {@link com.adminportal.service.ArticleExternalService} interface. + * @author om prakash + * + */ +@Service +public class ArticleExternalServiceImpl implements ArticleExternalService{ + + @Autowired + private ArticleExternalRepository articleRepo; + + /** + * + * @see com.adminportal.service.ArticleExternalService#findAll() + */ + @Override + public List findAll() { + + return articleRepo.findAllBytype("Article"); + } + + /** + * @see com.adminportal.service.ArticleExternalService#deleteArticleById(int id) + */ + @Override + @Transactional + public void deleteArticleById(int id){ + + Optional local=articleRepo.findById(id); + ArticleExternal temp=local.get(); + articleRepo.deleteById(temp.getArticleId()); + + } + + /** + * @see com.adminportal.service.ArticleExternalService#findByid(int id) + */ + @Override + public ArticleExternal findByid(int id) { + Optional local=articleRepo.findById(id); + return local.get(); + } + + /** + * @see com.adminportal.service.ArticleExternalService#updateArticle(String desc, String source, String url, Timestamp date, int id) + */ + @Override + @Transactional + public boolean updateArticle(String desc, String source, String url, Timestamp date, int id) { + int status=articleRepo.updateArticle(desc, source, url, date, id); + + if(status>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.ArticleExternalService#countRow() + */ + @Override + public int countRow() { + + return (int) articleRepo.count(); + } + + /** + * @see com.adminportal.service.ArticleExternalService#EnableArticleContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableArticleContent(int status, int id) { + int status1=articleRepo.EnableArticleContent(status, id); + + if(status1>0) { + return true; + }else { + return false; + } + + + } + + /** + * @see com.adminportal.service.ArticleExternalService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + + List localArticle=articleRepo.findAllBytopicAndType(topic, "Article"); + + return localArticle; + } + + /** + * @see com.adminportal.service.ArticleExternalService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + + + return articleRepo.findAllByuser(usr,"Article"); + } + + /** + * @see com.adminportal.service.ArticleExternalService#EnableAcceptedByAdminArticleContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminArticleContent(int status, int id) { + + int status1=articleRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.ArticleExternalService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + + return articleRepo.findAllByTopicAndStatus(topic, 1,"Article"); + } + + /** + * @see com.adminportal.service.ArticleExternalService#deleteArticle(ArticleExternal article) + */ + @Override + public int deleteArticle(ArticleExternal article) { + + articleRepo.deleteArticle(article.getArticleId()); + + return 0; + } + + /** + * @see com.adminportal.service.ArticleExternalService#countTotalResource(Topic temp) + */ + @Override + public int countTotalResource(Topic temp) { + // TODO Auto-generated method stub + return articleRepo.countTotalResource(temp); + } + + /** + * @see com.adminportal.service.ArticleExternalService#countTotalResource(List temp) + */ + @Override + public int countTotalResource(List temp) { + // TODO Auto-generated method stub + return articleRepo.countTotalResource(temp); + } + +} diff --git a/src/main/java/com/adminportal/service/impl/ClassServiceImpl.java b/src/main/java/com/adminportal/service/impl/ClassServiceImpl.java new file mode 100644 index 0000000..18732a2 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/ClassServiceImpl.java @@ -0,0 +1,76 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Class Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.content.Class; +import com.adminportal.repository.ClassRepository; +import com.adminportal.service.ClassService; + +/** + * Default implementation of the {@link com.adminportal.service.ClassService} interface. + * @author om prakash + * + */ +@Service +public class ClassServiceImpl implements ClassService{ + + @Autowired + private ClassRepository classRepo; + + /** + * @see com.adminportal.service.ClassService#findByClassName(int className) + */ + @Override + public Class findByClassName(int className) { + + Class localClass=classRepo.findByclassName(className); + + return localClass; + } + + + /** + * @see com.adminportal.service.ClassService#findAll() + */ + @Override + public List findAll() { + + List local=(List) classRepo.findAll(org.springframework.data.domain.Sort.by(org.springframework.data.domain.Sort.Direction.ASC, "className")); + + return local; + } + + /** + * @see com.adminportal.service.ClassService#save(Class temp) + */ + @Override + public Class save(Class temp) { + + + Class local=classRepo.save(temp); + return local; + } + + /** + * @see com.adminportal.service.ClassService#countRow() + */ + @Override + public int countRow() { + + + return (int) classRepo.count(); + } + + + + +} diff --git a/src/main/java/com/adminportal/service/impl/CommentReplyServiceImpl.java b/src/main/java/com/adminportal/service/impl/CommentReplyServiceImpl.java new file mode 100644 index 0000000..e620b49 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/CommentReplyServiceImpl.java @@ -0,0 +1,48 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of comment reply Service Interface to define method for database operation. + */ +package com.adminportal.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.repository.CommentReplyRepository; +import com.adminportal.service.CommentReplyService; + +/** + * Default implementation of the {@link com.adminportal.service.CommentReplyService} interface. + * @author om prakash + * + */ +@Service +public class CommentReplyServiceImpl implements CommentReplyService{ + + @Autowired + private CommentReplyRepository comRepRepo; + + /** + * @see com.adminportal.service.CommentReplyService#getReplyOnComment(Comment com) + */ + @Override + public List getReplyOnComment(Comment com) { + + + return comRepRepo.findAllBycomment(com); + } + + /** + * @see com.adminportal.service.CommentReplyService#countRow() + */ + @Override + public int countRow() { + + return (int) comRepRepo.count(); + } + +} diff --git a/src/main/java/com/adminportal/service/impl/CommentServiceImpl.java b/src/main/java/com/adminportal/service/impl/CommentServiceImpl.java new file mode 100644 index 0000000..d65da5d --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/CommentServiceImpl.java @@ -0,0 +1,142 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Comment Service Interface to define method for database operation. + */ +package com.adminportal.service.impl; + +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.repository.CommentRepository; +import com.adminportal.service.CommentService; + +/** + * Default implementation of the {@link com.adminportal.service.CommentService} interface. + * @author om prakash + * + */ +@Service +public class CommentServiceImpl implements CommentService { + + @Autowired + private CommentRepository comRepo; + + /** + * @see com.adminportal.service.CommentService#countRow() + */ + @Override + public int countRow() { + + return (int) comRepo.count(); + } + + /** + * @see com.adminportal.service.CommentService#getCommentByVideoId(VideoExternal video) + */ + @Override + public List getCommentByVideoId(VideoExternal video) { + + List com=comRepo.findAllByvideo(video); + + return com; + } + + /** + * @see com.adminportal.service.CommentService#addReplyComment(Comment comment, Set commentReply) + */ + @Override + public Comment addReplyComment(Comment comment, Set commentReply) { + + comment.getCommentreply().addAll(commentReply); + comRepo.save(comment); + + return null; + } + + /** + * @see com.adminportal.service.CommentService#findById(int id) + */ + @Override + public Comment findById(int id) { + Optional local=comRepo.findById(id); + return local.get(); + } + + /** + * @see com.adminportal.service.CommentService#getCommentByArticleId(ArticleExternal article) + */ + @Override + public List getCommentByArticleId(ArticleExternal article) { + + List com=comRepo.findAllByarticle(article); + return com; + } + + /** + * @see com.adminportal.service.CommentService#getCommentByQuizId(QuizQuestion quiz) + */ + @Override + public List getCommentByQuizId(QuizQuestion quiz) { + + List com=comRepo.findAllByquiz(quiz); + return com; + } + + /** + * @see com.adminportal.service.CommentService#getCommentByDocumentId(DocumentExternal document) + */ + @Override + public List getCommentByDocumentId(DocumentExternal document) { + + List com=comRepo.findAllBydocument(document); + return com; + } + + /** + * @see com.adminportal.service.CommentService#getCommentByPhetId(Phets phet) + */ + @Override + public List getCommentByPhetId(Phets phet) { + + List com=comRepo.findAllByphet(phet); + return com; + } + + /** + * @see com.adminportal.service.CommentService#getCommentByLessonId(LessonPlan lesson) + */ + @Override + public List getCommentByLessonId(LessonPlan lesson) { + + List com=comRepo.findAllBylesson(lesson); + return com; + } + + /** + * @see com.adminportal.service.CommentService#getCommentByConceptMap(ConceptMap conceptMap) + */ + @Override + public List getCommentByConceptMap(ConceptMap conceptMap) { + + List com=comRepo.findALlByconceptMap(conceptMap); + return com; + + } + + +} diff --git a/src/main/java/com/adminportal/service/impl/ConceptMapServiceImpl.java b/src/main/java/com/adminportal/service/impl/ConceptMapServiceImpl.java new file mode 100644 index 0000000..dd655a7 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/ConceptMapServiceImpl.java @@ -0,0 +1,178 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of concept-map Service Interface to define method for database operation. + */ +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ConceptMap; + +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.repository.ConceptMapRepository; +import com.adminportal.service.ConceptMapService; +import com.spoken.Utility.ServiceUtility; +/** + * Default implementation of the {@link com.adminportal.service.ConceptMapService} interface. + * @author om prakash + * + */ +@Service +public class ConceptMapServiceImpl implements ConceptMapService{ + + @Autowired + ConceptMapRepository conceptRepo; + + /** + * @see com.adminportal.service.ConceptMapService#findAll() + */ + @Override + public List findAll() { + + + return conceptRepo.findAllBytype("ConceptMap"); + } + + /** + * @see com.adminportal.service.ConceptMapService#findByid(int id) + */ + @Override + public ConceptMap findByid(int id) { + + Optional temp=conceptRepo.findById(id); + return temp.get(); + } + + /** + * @see com.adminportal.service.ConceptMapService#updateConcept(String desc, String url, String remark, Timestamp date, int id) + */ + @Override + @Transactional + public boolean updateConcept(String desc, String url, String remark, Timestamp date, int id) { + int status=conceptRepo.updateConceptMap(desc, url, remark, date, id); + if(status>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.ConceptMapService#countRow() + */ + @Override + public int countRow() { + + return (int) conceptRepo.count(); + } + + /** + * @see com.adminportal.service.ConceptMapService#EnableConceptContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableConceptContent(int status, int id) { + + int status1=conceptRepo.EnableConceptMapContent(status, id); + + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.ConceptMapService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + + List localConcept=conceptRepo.findAllBytopicAndType(topic, "ConceptMap"); + + return localConcept; + } + + /** + * @see com.adminportal.service.ConceptMapService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + List localConcept=conceptRepo.findAllByuser(usr, "ConceptMap"); + return localConcept; + } + + + /** + * @see com.adminportal.service.ConceptMapService#EnableAcceptedByAdminConceptContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminConceptContent(int status, int id) { + + int status1=conceptRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + + if(status1>0) { + return true; + }else { + return false; + } + + } + + + /** + * @see com.adminportal.service.ConceptMapService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + return conceptRepo.findAllByTopicAndStatus(topic, 1,"ConceptMap"); + } + + + /** + * @see com.adminportal.service.ConceptMapService#updateConceptDesc(String desc, String remark, Timestamp date, int id) + */ + @Override + @Transactional + public boolean updateConceptDesc(String desc, String remark, Timestamp date, int id) { + int status=conceptRepo.updateConceptMapDesc(desc, remark, date, id); + if(status>0) { + return true; + }else { + return false; + } + } + + + /** + * @see com.adminportal.service.ConceptMapService#save(ConceptMap temp) + */ + @Override + public int save(ConceptMap temp) { + + conceptRepo.save(temp); + return 0; + } + + + /** + * @see com.adminportal.service.ConceptMapService#deleteConceptMap(ConceptMap concept) + */ + @Override + public void deleteConceptMap(ConceptMap concept) { + + conceptRepo.deleteConcep(concept.getConcepMapid()); + + } + +} diff --git a/src/main/java/com/adminportal/service/impl/ContactFormServiceImpl.java b/src/main/java/com/adminportal/service/impl/ContactFormServiceImpl.java new file mode 100644 index 0000000..6fe586c --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/ContactFormServiceImpl.java @@ -0,0 +1,33 @@ +package com.adminportal.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.content.ContactForm; +import com.adminportal.repository.ContactFormRepository; +import com.adminportal.service.ContactFormService; +/** + * Default implementation of the {@link com.adminportal.service.ContactFormService} interface. + * @author om prakash + * + */ +@Service +public class ContactFormServiceImpl implements ContactFormService{ + + @Autowired + private ContactFormRepository contactFormRepo; + + /** + * @see com.adminportal.service.ContactFormService#getAllMessages() + */ + @Override + public List getAllMessages() { + + return (List) contactFormRepo.findAll(); + + } + + +} diff --git a/src/main/java/com/adminportal/service/impl/DocumentExternalServiceImpl.java b/src/main/java/com/adminportal/service/impl/DocumentExternalServiceImpl.java new file mode 100644 index 0000000..402c4bf --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/DocumentExternalServiceImpl.java @@ -0,0 +1,186 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Document Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.repository.DocumentExternalRepository; +import com.adminportal.service.DocumentExternalService; +import com.spoken.Utility.ServiceUtility; + +/** + * Default implementation of the {@link com.adminportal.service.DocumentExternalService} interface. + * @author om prakash + * + */ +@Service +public class DocumentExternalServiceImpl implements DocumentExternalService{ + + @Autowired + private DocumentExternalRepository documentRepo; + + /** + * @see com.adminportal.service.DocumentExternalService#findAll() + */ + @Override + public List findAll() { + + return documentRepo.findAllBytype("Document"); + } + + /** + * @see com.adminportal.service.DocumentExternalService#deleteDocumentById(int id) + */ + @Override + public void deleteDocumentById(int id) { + Optional local=documentRepo.findById(id); + DocumentExternal temp=local.get(); + documentRepo.deleteById(temp.getDocumentId()); + + } + + /** + * @see com.adminportal.service.DocumentExternalService#findByid(int id) + */ + @Override + public DocumentExternal findByid(int id) { + Optional local=documentRepo.findById(id); + return local.get(); + } + + /** + * @see com.adminportal.service.DocumentExternalService#updateDocument(String desc, String source, String url, Timestamp date, int Id) + */ + @Override + @Transactional + public boolean updateDocument(String desc, String source, String url, Timestamp date, int Id) { + int temp=documentRepo.updateDocument(desc, source, url, date, Id); + + if(temp>0) { + return true; + }else { + return false; + } + + + + } + + /** + * @see com.adminportal.service.DocumentExternalService#countRow() + */ + @Override + public int countRow() { + + return (int) documentRepo.count(); + } + + /** + * @see com.adminportal.service.DocumentExternalService#EnableDocumentContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableDocumentContent(int status, int id) { + + int status1=documentRepo.EnableDocumentContent(status, id); + if(status1>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.DocumentExternalService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + + List localDocument=documentRepo.findAllBytopicAndType(topic, "Document"); + + return localDocument; + } + + /** + * @see com.adminportal.service.DocumentExternalService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + + return documentRepo.findAllByuser(usr,"Document"); + } + + /** + * @see com.adminportal.service.DocumentExternalService#EnableAcceptedByAdminDocumentContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminDocumentContent(int status, int id) { + int status1=documentRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.DocumentExternalService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + return documentRepo.findAllByTopicAndStatus(topic, 1,"Document"); + } + + /** + * @see com.adminportal.service.DocumentExternalService#updateDocumentDesc(String desc, String source, Timestamp date, int Id) + */ + @Override + @Transactional + public boolean updateDocumentDesc(String desc, String source, Timestamp date, int Id) { + int temp=documentRepo.updateDocumentDesc(desc, source, date, Id); + + if(temp>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.DocumentExternalService#save(DocumentExternal temp) + */ + @Override + public int save(DocumentExternal temp) { + documentRepo.save(temp); + + return 0; + } + + /** + * @see com.adminportal.service.DocumentExternalService#deleteDocuemnt(DocumentExternal document) + */ + @Override + public void deleteDocuemnt(DocumentExternal document) { + // TODO Auto-generated method stub + documentRepo.deleteDocument(document.getDocumentId()); + + } + +} diff --git a/src/main/java/com/adminportal/service/impl/EventServiceImpl.java b/src/main/java/com/adminportal/service/impl/EventServiceImpl.java new file mode 100644 index 0000000..3f19ef2 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/EventServiceImpl.java @@ -0,0 +1,101 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Event Service Interface to define method for database operation. + */ +package com.adminportal.service.impl; + +import java.sql.Date; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Events; +import com.adminportal.repository.EventsRepository; +import com.adminportal.service.EventService; + +/** + * Default implementation of the {@link com.adminportal.service.EventService} interface. + * @author om prakash + * + */ +@Service +public class EventServiceImpl implements EventService{ + + @Autowired + EventsRepository eventRepo; + + /** + * @see com.adminportal.service.EventService#getCount() + */ + @Override + public int getCount() { + + return (int) eventRepo.count(); + } + + /** + * @see com.adminportal.service.EventService#save(Events temp) + */ + @Override + public Events save(Events temp) { + + return eventRepo.save(temp); + + } + + /** + * @see com.adminportal.service.EventService#findAll() + */ + @Override + public List findAll() { + + return (List) eventRepo.findAll(); + } + + /** + * @see com.adminportal.service.EventService#getAllEventdata() + */ + @Override + public List getAllEventdata() { + + return eventRepo.getAllEvent(); + } + + /** + * @see com.adminportal.service.EventService#getbyid(int id) + */ + @Override + public Events getbyid(int id) { + Optional local=eventRepo.findById(id); + return local.get(); + } + + /** + * @see com.adminportal.service.EventService#updateEvent(String head,String desc,Date startDate,Date enddate,Date regStart,Date regEnd,String coordName,String poster_Path,int id) + */ + @Override + @Transactional + public boolean updateEvent(String head,String desc,Date startDate,Date enddate,Date regStart,Date regEnd,String coordName,String poster_Path,int id) { + int status=eventRepo.updateEvent(head, desc,startDate,enddate,regStart,regEnd,coordName,poster_Path,id ); + if(status>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.EventService#deleteEvent(Events event) + */ + @Override + public void deleteEvent(Events event) { + + eventRepo.deleteEvent(event.getEventId()); + + } + +} diff --git a/src/main/java/com/adminportal/service/impl/LessonPlanServiceImpl.java b/src/main/java/com/adminportal/service/impl/LessonPlanServiceImpl.java new file mode 100644 index 0000000..c4ee2f7 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/LessonPlanServiceImpl.java @@ -0,0 +1,169 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Lesson Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.repository.LessonPlanRepository; +import com.adminportal.service.LessonPlanService; +import com.spoken.Utility.ServiceUtility; +/** + * Default implementation of the {@link com.adminportal.service.LessonPlanService} interface. + * @author om prakash + * + */ +@Service +public class LessonPlanServiceImpl implements LessonPlanService{ + + @Autowired + private LessonPlanRepository lessonRepo; + + /** + * @see com.adminportal.service.LessonPlanService#findAll() + */ + @Override + public List findAll() { + + return lessonRepo.findAllBytype("Lesson"); + } + + /** + * @see com.adminportal.service.LessonPlanService#deleteLessonById(int id) + */ + @Override + public void deleteLessonById(int id) { + Optional local=lessonRepo.findById(id); + LessonPlan temp=local.get(); + lessonRepo.deleteById(temp.getLessonPlanId()); + + } + + /** + * @see com.adminportal.service.LessonPlanService#countRow() + */ + @Override + public int countRow() { + + return (int) lessonRepo.count(); + } + + /** + * @see com.adminportal.service.LessonPlanService#EnableLessonPlanContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableLessonPlanContent(int status, int id) { + + int status1=lessonRepo.EnableLessonPlanContent(status, id); + if(status1>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.LessonPlanService#findById(int id) + */ + @Override + public LessonPlan findById(int id) { + + Optional lesson=lessonRepo.findById(id); + + return lesson.get(); + } + + /** + * @see com.adminportal.service.LessonPlanService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + + List localLesson=lessonRepo.findAllBytopicAndType(topic, "Lesson"); + + return localLesson; + } + + /** + * @see com.adminportal.service.LessonPlanService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + + return lessonRepo.findAllByuser(usr,"Lesson"); + } + + /** + * @see com.adminportal.service.LessonPlanService#updateLessonPlan(Timestamp dat, String lessonPath, int id) + */ + @Override + @Transactional + public boolean updateLessonPlan(Timestamp dat, String lessonPath, int id) { + int Status=lessonRepo.updateLessonPlan(dat, lessonPath, id); + if(Status>0) { + return true; + }else { + return false; + } + + + } + + /** + * @see com.adminportal.service.LessonPlanService#EnableAcceptedByAdminLessonPlanContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminLessonPlanContent(int status, int id) { + int status1=lessonRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.LessonPlanService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + return lessonRepo.findAllByTopicAndStatus(topic, 1,"Lesson"); + } + + /** + * @see com.adminportal.service.LessonPlanService#save(LessonPlan temp) + */ + @Override + public int save(LessonPlan temp) { + lessonRepo.save(temp); + return 0; + } + + /** + * @see com.adminportal.service.LessonPlanService#deleteLessonPlan(LessonPlan lesson) + */ + @Override + public void deleteLessonPlan(LessonPlan lesson) { + // TODO Auto-generated method stub + + lessonRepo.deleteLesson(lesson.getLessonPlanId()); + } + +} diff --git a/src/main/java/com/adminportal/service/impl/PhetsServiceImpl.java b/src/main/java/com/adminportal/service/impl/PhetsServiceImpl.java new file mode 100644 index 0000000..e00f26c --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/PhetsServiceImpl.java @@ -0,0 +1,162 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Phets Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.repository.PhetsRepository; +import com.adminportal.service.PhetsService; +import com.spoken.Utility.ServiceUtility; + +/** + * Default implementation of the {@link com.adminportal.service.PhetsService} interface. + * @author om prakash + * + */ +@Service +public class PhetsServiceImpl implements PhetsService{ + + + @Autowired + private PhetsRepository phetRepo; + + /** + * @see com.adminportal.service.PhetsService#findAll() + */ + @Override + public List findAll() { + + return phetRepo.findAllBytype("Phets"); + } + + /** + * @see com.adminportal.service.PhetsService#deletePhetById(int id) + */ + @Override + public void deletePhetById(int id) { + Optional local=phetRepo.findById(id); + Phets temp=local.get(); + phetRepo.deleteById(temp.getPhetId()); + + } + + /** + * @see com.adminportal.service.PhetsService#findByid(int id) + */ + @Override + public Phets findByid(int id) { + Optional local=phetRepo.findById(id); + return local.get(); + } + + + /** + * @see com.adminportal.service.PhetsService#updatePhet(String source, String url, Timestamp date, String desc, int id) + */ + @Override + @Transactional + public boolean updatePhet(String source, String url, Timestamp date, String desc, int id) { + + int status=phetRepo.updatePhet(source, url, date, desc, id); + if(status>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.PhetsService#countRow() + */ + @Override + public int countRow() { + + return (int) phetRepo.count(); + } + + /** + * @see com.adminportal.service.PhetsService#EnablePhetContent(int status, int id) + */ + @Override + @Transactional + public boolean EnablePhetContent(int status, int id) { + int status1=phetRepo.EnablePhetContent(status, id); + + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.PhetsService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + + List localPhets=phetRepo.findAllBytopicAndType(topic, "Phets"); + + return localPhets; + } + + /** + * @see com.adminportal.service.PhetsService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + + return phetRepo.findAllByuser(usr,"Phets"); + } + + /** + * @see com.adminportal.service.PhetsService#EnableAcceptedByAdminPhetContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminPhetContent(int status, int id) { + int status1=phetRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.PhetsService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + return phetRepo.findAllByTopicAndStatus(topic, 1,"Phets"); + } + + /** + * @see com.adminportal.service.PhetsService#deletePhet(Phets phet) + */ + @Override + public void deletePhet(Phets phet) { + // TODO Auto-generated method stub + + phetRepo.deletePhet(phet.getPhetId()); + + } + +} diff --git a/src/main/java/com/adminportal/service/impl/QuizQuestionServiceImpl.java b/src/main/java/com/adminportal/service/impl/QuizQuestionServiceImpl.java new file mode 100644 index 0000000..4b0bb7c --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/QuizQuestionServiceImpl.java @@ -0,0 +1,199 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Quiz Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Topic; +import com.adminportal.domain.User; +import com.adminportal.repository.QuizQuestionRepository; +import com.adminportal.service.QuizQuestionService; +import com.spoken.Utility.ServiceUtility; + +/** + * Default implementation of the {@link com.adminportal.service.QuizQuestionService} interface. + * @author om prakash + * + */ +@Service +public class QuizQuestionServiceImpl implements QuizQuestionService{ + + @Autowired + private QuizQuestionRepository quizRepo; + + /** + * @see com.adminportal.service.QuizQuestionService#findAll() + */ + @Override + public List findAll() { + + return (List) quizRepo.findAllBytype("Quiz"); + } + + /** + * @see com.adminportal.service.QuizQuestionService#deleteQuizById(int id) + */ + @Override + public void deleteQuizById(int id) { + Optional local=quizRepo.findById(id); + QuizQuestion temp=local.get(); + quizRepo.deleteById(temp.getQuizQuestionId()); + + } + + /** + * @see com.adminportal.service.QuizQuestionService#findById(int id) + */ + @Override + public QuizQuestion findById(int id) { + + Optional local=quizRepo.findById(id); + + return local.get(); + } + + /** + * @see com.adminportal.service.QuizQuestionService#updateQuiz(String question, String answer, Timestamp date, int quizId) + */ + @Override + @Transactional + public boolean updateQuiz(String question, String answer, Timestamp date, int quizId) { + + int status=quizRepo.updateQuiz(question, answer, date, quizId); + if(status>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.QuizQuestionService#countRow() + */ + @Override + public int countRow() { + return (int) quizRepo.count(); + + } + + /** + * @see com.adminportal.service.QuizQuestionService#EnableQuizContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableQuizContent(int status, int id) { + int status1=quizRepo.EnableQuizContent(status, id); + + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.QuizQuestionService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + List localQuiz=quizRepo.findAllBytopicAndType(topic, "Quiz"); + + return localQuiz; + } + + /** + * @see com.adminportal.service.QuizQuestionService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + + return quizRepo.findAllByuser(usr,"Quiz"); + } + + /** + * @see com.adminportal.service.QuizQuestionService#EnableAcceptedByAdminQuizContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminQuizContent(int status, int id) { + int status1=quizRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.QuizQuestionService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + return quizRepo.findAllByTopicAndStatus(topic, 1,"Quiz"); + } + + /** + * @see com.adminportal.service.QuizQuestionService#updateQuizQuestion(String question, Timestamp date, int quizId) + */ + @Override + @Transactional + public boolean updateQuizQuestion(String question, Timestamp date, int quizId) { + int status=quizRepo.updateQuizQuestion(question, date, quizId); + if(status>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.QuizQuestionService#updateQuizAnswer(String answer, Timestamp date, int quizId) + */ + @Override + @Transactional + public boolean updateQuizAnswer(String answer, Timestamp date, int quizId) { + int status=quizRepo.updateQuizAnswer(answer,date, quizId); + if(status>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.QuizQuestionService#save(QuizQuestion temp) + */ + @Override + public int save(QuizQuestion temp) { + quizRepo.save(temp); + return 0; + } + + /** + * @see com.adminportal.service.QuizQuestionService#deleteQuiz(QuizQuestion quiz) + */ + @Override + public void deleteQuiz(QuizQuestion quiz) { + // TODO Auto-generated method stub + quizRepo.deleteQuiz(quiz.getQuizQuestionId()); + + } + +} diff --git a/src/main/java/com/adminportal/service/impl/RoleDetailServiceImpl.java b/src/main/java/com/adminportal/service/impl/RoleDetailServiceImpl.java new file mode 100644 index 0000000..b187b54 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/RoleDetailServiceImpl.java @@ -0,0 +1,58 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Role Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.domain.RoleDetail; +import com.adminportal.repository.RoleRepository; +import com.adminportal.service.RoleDetailService; +/** + * Default implementation of the {@link com.adminportal.service.RoleDetailService} interface. + * @author om prakash + * + */ +@Service +public class RoleDetailServiceImpl implements RoleDetailService { + + + @Autowired + RoleRepository roleRepo; + + /** + * @see com.adminportal.service.RoleDetailService#findByRoleName(String sub) + */ + @Override + public RoleDetail findByRoleName(String sub) { + + RoleDetail local=roleRepo.findByroleName(sub); + + return local; + } + + /** + * @see com.adminportal.service.RoleDetailService#countRow() + */ + @Override + public int countRow() { + + return (int) roleRepo.count(); + } + + + /** + * @see com.adminportal.service.RoleDetailService#save(RoleDetail role) + */ + @Override + public RoleDetail save(RoleDetail role) { + return roleRepo.save(role); + + } + +} diff --git a/src/main/java/com/adminportal/service/impl/SubjectClassServiceimpl.java b/src/main/java/com/adminportal/service/impl/SubjectClassServiceimpl.java new file mode 100644 index 0000000..824821c --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/SubjectClassServiceimpl.java @@ -0,0 +1,130 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of SubjectClass Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.util.List; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Class; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.repository.SubjectClassMappingRepository; +import com.adminportal.repository.SubjectRepository; +import com.adminportal.service.SubjectClassService; + +/** + * Default implementation of the {@link com.adminportal.service.SubjectClassService} interface. + * @author om prakash + * + */ +@Service +public class SubjectClassServiceimpl implements SubjectClassService{ + + @Autowired + private SubjectRepository subjectrepo; + + @Autowired + private SubjectClassMappingRepository subjectClassRepo; + + /** + * @see com.adminportal.service.SubjectClassService#createSubjectClass(Subject sub, Set subClass) + */ + @Override + public Subject createSubjectClass(Subject sub, Set subClass) throws Exception{ + + sub.getSubClasMapp().addAll(subClass); + Subject sub1=subjectrepo.save(sub); + + return sub1; + } + + /** + * @see com.adminportal.service.SubjectClassService#createTopic(Topic topic, SubjectClassMapping subjectClassmapping) + */ + @Override + public Subject createTopic(Topic topic, SubjectClassMapping subjectClassmapping) throws Exception { + + subjectClassmapping.getTopic().add(topic); + subjectClassRepo.save(subjectClassmapping); + + return null; + } + + /** + * @see com.adminportal.service.SubjectClassService#getSubjectFromClass(Class classTemp) + */ + @Override + public List getSubjectFromClass(Class classTemp) { + + List localSubjectClass=subjectClassRepo.findBystandard(classTemp); + + return localSubjectClass; + } + + /** + * @see com.adminportal.service.SubjectClassService#findBysubAndstandard(Class tempClass, Subject subject) + */ + @Override + public SubjectClassMapping findBysubAndstandard(Class tempClass, Subject subject) { + + SubjectClassMapping localSubjectClass=subjectClassRepo.findBysubAndstandard(subject, tempClass); + return localSubjectClass; + } + + /** + * @see com.adminportal.service.SubjectClassService#countRow() + */ + @Override + public int countRow() { + + return (int) subjectClassRepo.count(); + } + + /** + * @see com.adminportal.service.SubjectClassService#getClassFromMapping(Class classTemp) + */ + @Override + public List getClassFromMapping(Class classTemp) { + + return subjectClassRepo.findBystandard(classTemp); + } + + /** + * @see com.adminportal.service.SubjectClassService#getClassFromSubject(Subject subTemp) + */ + @Override + public List getClassFromSubject(Subject subTemp) { + + return subjectClassRepo.findBysub(subTemp); + } + + /** + * @see com.adminportal.service.SubjectClassService#updateSubjectinAllField(boolean status, Subject sub) + */ + @Override + @Transactional + public int updateSubjectinAllField(boolean status, Subject sub) { + + return subjectClassRepo.updateAllSubject(status, sub); + } + + /** + * @see com.adminportal.service.SubjectClassService#updateClassinAllField(boolean status, Class clas) + */ + @Override + @Transactional + public int updateClassinAllField(boolean status, Class clas) { + // TODO Auto-generated method stub + return subjectClassRepo.updateAllClass(status, clas); + } + +} diff --git a/src/main/java/com/adminportal/service/impl/SubjectServiceImpl.java b/src/main/java/com/adminportal/service/impl/SubjectServiceImpl.java new file mode 100644 index 0000000..0bf4451 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/SubjectServiceImpl.java @@ -0,0 +1,154 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Subject Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import javax.transaction.Transactional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +import com.adminportal.repository.ArticleExternalRepository; +import com.adminportal.repository.DocumentExternalRepository; +import com.adminportal.repository.LessonPlanRepository; +import com.adminportal.repository.PhetsRepository; +import com.adminportal.repository.QuizQuestionRepository; +import com.adminportal.repository.SubjectClassMappingRepository; +import com.adminportal.repository.SubjectRepository; +import com.adminportal.repository.TopicRepository; +import com.adminportal.repository.VideoExternalRepository; +import com.adminportal.service.SubjectService; + +/** + * Default implementation of the {@link com.adminportal.service.SubjectService} interface. + * @author om prakash + * + */ +@Service +public class SubjectServiceImpl implements SubjectService{ + + + @Autowired + private SubjectRepository subjectRepo; + + @Autowired + private SubjectClassMappingRepository subjectClassRepo; + + @Autowired + private TopicRepository topicRepo; + + @Autowired + private ArticleExternalRepository articleRepo; + + @Autowired + private DocumentExternalRepository documentRepo; + + @Autowired + private LessonPlanRepository lessonRepo; + + @Autowired + private PhetsRepository phetRepo; + + @Autowired + private QuizQuestionRepository quizRepo; + + @Autowired + private VideoExternalRepository videoRepo; + + /** + * @see com.adminportal.service.SubjectService#findBySubjectName(String subjectName) + */ + @Override + public Subject findBySubjectName(String subjectName) { + + Subject localSubject=subjectRepo.findBysubName(subjectName); + + return localSubject; + } + + /** + * @see com.adminportal.service.SubjectService#findAll() + */ + @Override + public List findAll() { + + List local=(List)subjectRepo.findAll(org.springframework.data.domain.Sort.by(org.springframework.data.domain.Sort.Direction.ASC, "subName")); + return local; + } + + /** + * @see com.adminportal.service.SubjectService#findBysubName(String sub) + */ + @Override + public Subject findBysubName(String sub) { + + Subject localSubject=subjectRepo.findBysubName(sub); + return localSubject; + } + + + /** + * @see com.adminportal.service.SubjectService#findById(int id) + */ + @Override + public Subject findById(int id) { + + Optional sub=subjectRepo.findById(id); + + Subject localSub=sub.get(); + + + return localSub; + } + + /** + * @see com.adminportal.service.SubjectService#countRow() + */ + @Override + public int countRow() { + + return (int) subjectRepo.count(); + } + + /** + * @see com.adminportal.service.SubjectService#save(Subject sub) + */ + @Override + public Subject save(Subject sub) { + + Subject subj=subjectRepo.save(sub); + return subj; + } + + /** + * @see com.adminportal.service.SubjectService#updateSubjectName(String subName, int subId) + */ + @Override + @Transactional + public boolean updateSubjectName(String subName, int subId) { + int status=subjectRepo.updateSubjectName(subName, subId); + if(status>0) { + return true; + }else { + return false; + } + } + +} diff --git a/src/main/java/com/adminportal/service/impl/TestimonialServiceImpl.java b/src/main/java/com/adminportal/service/impl/TestimonialServiceImpl.java new file mode 100644 index 0000000..4a62ef9 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/TestimonialServiceImpl.java @@ -0,0 +1,103 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Testimonial Service Interface to define method for database operation. + */ +package com.adminportal.service.impl; + +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Testimonial; +import com.adminportal.repository.TestimonialRepository; +import com.adminportal.service.TestimonialService; + +/** + * Default implementation of the {@link com.adminportal.service.TestimonialService} interface. + * @author om prakash + * + */ +@Service +public class TestimonialServiceImpl implements TestimonialService{ + + @Autowired + TestimonialRepository testRepo; + + /** + * @see com.adminportal.service.TestimonialService#getCount() + */ + @Override + public int getCount() { + + return (int) testRepo.count(); + } + + /** + * @see com.adminportal.service.TestimonialService#save(Testimonial temp) + */ + @Override + public void save(Testimonial temp) { + testRepo.save(temp); + + } + + /** + * @see com.adminportal.service.TestimonialService#findAll() + */ + @Override + public List findAll() { + + return (List) testRepo.findAll(); + } + + /** + * @see com.adminportal.service.TestimonialService#getAlltestimonial() + */ + @Override + public List getAlltestimonial() { + + return testRepo.getAllTestimonial(); + } + + /** + * @see com.adminportal.service.TestimonialService#getbyId(int id) + */ + @Override + public Testimonial getbyId(int id) { + + Optional local=testRepo.findById(id); + + return local.get(); + + } + + /** + * @see com.adminportal.service.TestimonialService#updateTestimonial(String name, String desc, String org, int id) + */ + @Override + @Transactional + public boolean updateTestimonial(String name, String desc, String org, int id) { + int status=testRepo.updateTestimonial(name, desc, org, id); + if(status>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.TestimonialService#deleteTestimonail(Testimonial testi) + */ + @Override + public void deleteTestimonail(Testimonial testi) { + // TODO Auto-generated method stub + testRepo.deleteTestimonial(testi.getTestimonialId()); + + } + + +} diff --git a/src/main/java/com/adminportal/service/impl/TopicServiceimpl.java b/src/main/java/com/adminportal/service/impl/TopicServiceimpl.java new file mode 100644 index 0000000..092487e --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/TopicServiceimpl.java @@ -0,0 +1,192 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Topic Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.SubjectClassMapping; +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +import com.adminportal.repository.ArticleExternalRepository; +import com.adminportal.repository.DocumentExternalRepository; +import com.adminportal.repository.LessonPlanRepository; +import com.adminportal.repository.PhetsRepository; +import com.adminportal.repository.QuizQuestionRepository; +import com.adminportal.repository.TopicRepository; +import com.adminportal.repository.VideoExternalRepository; +import com.adminportal.service.TopicService; + +/** + * Default implementation of the {@link com.adminportal.service.TopicService} interface. + * @author om prakash + * + */ +@Service +public class TopicServiceimpl implements TopicService { + + @Autowired + private TopicRepository topicRepo; + + /** + * @see com.adminportal.service.TopicService#findBysubjectclassMapping(SubjectClassMapping local) + */ + @Override + public List findBysubjectclassMapping(SubjectClassMapping local) { + System.out.println("vikash"); + + List tempTopic= topicRepo.findBysubjectClassMapping(local); + return tempTopic; + } + + /** + * @see com.adminportal.service.TopicService#findBysubjectClassMappingAndtopicName(SubjectClassMapping sub, String topicName) + */ + @Override + public Topic findBysubjectClassMappingAndtopicName(SubjectClassMapping sub, String topicName) { + Topic localTopic=topicRepo.findBysubjectClassMappingAndtopicName(sub, topicName); + return localTopic; + } + + /** + * @see com.adminportal.service.TopicService#findAll() + */ + @Override + public List findAll() { + + return (List) topicRepo.findAll(); + } + + /** + * @see com.adminportal.service.TopicService#disableEnableTopicById(int status,int id) + */ + @Override + @Transactional + public boolean disableEnableTopicById(int status,int id) { + + int status1=topicRepo.disableTopic(status, id); + + if(status1>0) { + return true; + }else { + return false; + } + + + + } + + /** + * @see com.adminportal.service.TopicService#findById(int id) + */ + @Override + public Topic findById(int id) { + Optional local=topicRepo.findById(id); + + return local.get(); + + } + + /** + * @see com.adminportal.service.TopicService#updateTopic( String desc, String poster,String topicName, Timestamp date, int topicID) + */ + @Override + @Transactional + public boolean updateTopic( String desc, String poster,String topicName, Timestamp date, int topicID) { + + int status=topicRepo.updateTopicDescAndQuiz( desc, poster,topicName, date, topicID); + if(status>0) { + return true; + }else { + return false; + } + + + } + + /** + * @see com.adminportal.service.TopicService#countRow() + */ + @Override + public int countRow() { + + return (int) topicRepo.count(); + } + + /** + * @see com.adminportal.service.TopicService#updateTopicDesc(String desc,String topicName, Timestamp date, int topicId) + */ + @Override + @Transactional + public boolean updateTopicDesc(String desc,String topicName, Timestamp date, int topicId) { + + int status=topicRepo.updateTopicDesc( desc, topicName,date, topicId); + if(status>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.TopicService#findBySubjectClassMppaing(List tempSubjectClass) + */ + @Override + public List findBySubjectClassMppaing(List tempSubjectClass) { + + return topicRepo.findAllByClassStandard((ArrayList) tempSubjectClass); + } + + /** + * @see com.adminportal.service.TopicService#updateTopicPoster(String path, int topicId) + */ + @Override + @Transactional + public boolean updateTopicPoster(String path, int topicId) { + + int status=topicRepo.updateTopicPoster(path, topicId); + if(status>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.TopicService#deleteTopic(Topic topic) + */ + @Override + public void deleteTopic(Topic topic) { + // TODO Auto-generated method stub + topicRepo.deleteTopic(topic.getTopicId()); + } + + /** + * @see com.adminportal.service.TopicService#disableEnableAllByClassStandard(int status, List temp) + */ + @Override + @Transactional + public int disableEnableAllByClassStandard(int status, List temp) { + // TODO Auto-generated method stub + return topicRepo.disableEnableAllByClassStandard(status, temp); + } + + + +} diff --git a/src/main/java/com/adminportal/service/impl/TutorialServiceImpl.java b/src/main/java/com/adminportal/service/impl/TutorialServiceImpl.java new file mode 100644 index 0000000..4af842c --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/TutorialServiceImpl.java @@ -0,0 +1,108 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of Tutorial Service Interface to define method for database operation. + */ +package com.adminportal.service.impl; + +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Topic; +import com.adminportal.content.Tutorial; +import com.adminportal.repository.TutorialRepository; +import com.adminportal.service.TutorialService; + +/** + * Default implementation of the {@link com.adminportal.service.TutorialService} interface. + * @author om prakash + * + */ +@Service +public class TutorialServiceImpl implements TutorialService{ + + @Autowired + TutorialRepository tutorialRepo; + + /** + * @see com.adminportal.service.TutorialService#countRow() + */ + @Override + public int countRow() { + + return (int) tutorialRepo.count(); + + + } + + /** + * @see com.adminportal.service.TutorialService#getAllTutorial() + */ + @Override + public List getAllTutorial() { + + List temp=(List) tutorialRepo.findAll(); + return temp; + } + + /** + * @see com.adminportal.service.TutorialService#getAllTutorialByTopic(Topic topic) + */ + @Override + public List getAllTutorialByTopic(Topic topic) { + + List temp=tutorialRepo.findAllBytopic(topic); + + return temp; + } + + /** + * @see com.adminportal.service.TutorialService#enableDisableTutorial(int status, int id) + */ + @Override + @Transactional + public boolean enableDisableTutorial(int status, int id) { + + int stat=tutorialRepo.enableDisableTutorial(status, id); + if(stat>0) { + return true; + } + + return false; + } + + /** + * @see com.adminportal.service.TutorialService#getById(int tutorialID) + */ + @Override + public Tutorial getById(int tutorialID) { + + Optional local=tutorialRepo.findById(tutorialID); + return local.get(); + } + + /** + * @see com.adminportal.service.TutorialService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + List temp=tutorialRepo.findAllByTopicAndStatus(topic,1); + return temp; + } + + /** + * @see com.adminportal.service.TutorialService#deleteTutorial(Tutorial tutorial) + */ + @Override + public void deleteTutorial(Tutorial tutorial) { + // TODO Auto-generated method stub + tutorialRepo.deleteTutorial(tutorial.getTutorialId()); + } + +} diff --git a/src/main/java/com/adminportal/service/impl/UserRoleServiceImpl.java b/src/main/java/com/adminportal/service/impl/UserRoleServiceImpl.java new file mode 100644 index 0000000..d2cc2a1 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,29 @@ +package com.adminportal.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.adminportal.repository.UserRoleRepository; +import com.adminportal.service.UserRoleService; + +/** + * Default implementation of the {@link com.adminportal.service.UserRoleService} interface. + * @author om prakash + * + */ +@Service +public class UserRoleServiceImpl implements UserRoleService{ + + @Autowired + private UserRoleRepository userRoleRepo; + + /** + * @see com.adminportal.service.UserRoleService#countRow() + */ + @Override + public int countRow() { + + return (int) userRoleRepo.count(); + } + +} diff --git a/src/main/java/com/adminportal/service/impl/UserSecurityService.java b/src/main/java/com/adminportal/service/impl/UserSecurityService.java new file mode 100644 index 0000000..93cce40 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/UserSecurityService.java @@ -0,0 +1,40 @@ +package com.adminportal.service.impl; + + +import org.springframework.beans.factory.annotation.Autowired; +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 com.adminportal.domain.User; +import com.adminportal.repository.UserRepository; + +/** + * Default implementation of the {@link com.adminportal.service.org.springframework.security.core.userdetails.UserDetailsService} interface. + * @author om prakash + * + */ +@Service +public class UserSecurityService implements UserDetailsService { + + @Autowired + private UserRepository userRepo; + + /** + * @see com.adminportal.service.org.springframework.security.core.userdetails.UserDetailsService# loadUserByUsername(String username) + */ + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + + User user=userRepo.findByemail(username); + + + if(user==null) { + throw new UsernameNotFoundException("E-mail Doesn't Exist"); + } + + return user; + } + +} diff --git a/src/main/java/com/adminportal/service/impl/UserServiceimpl.java b/src/main/java/com/adminportal/service/impl/UserServiceimpl.java new file mode 100644 index 0000000..c80bcb3 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/UserServiceimpl.java @@ -0,0 +1,401 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of User Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.ArticleExternal; +import com.adminportal.content.Class; +import com.adminportal.content.Comment; +import com.adminportal.content.CommentReply; +import com.adminportal.content.ConceptMap; +import com.adminportal.content.DocumentExternal; +import com.adminportal.content.LessonPlan; +import com.adminportal.content.Phets; +import com.adminportal.content.QuizQuestion; +import com.adminportal.content.Subject; +import com.adminportal.content.Tutorial; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.domain.UserRole; +import com.adminportal.repository.TopicRepository; +import com.adminportal.repository.UserRepository; +import com.adminportal.repository.UserRoleRepository; +import com.adminportal.service.UserService; +import com.spoken.Utility.ServiceUtility; + +/** + * Default implementation of the {@link com.adminportal.service.UserService} interface. + * @author om prakash + * + */ +@Service +public class UserServiceimpl implements UserService { + + @Autowired + private UserRepository userRepository; + + @Autowired + private UserRoleRepository userRoleRepository; + + @Autowired + private TopicRepository topicRepo; + + /** + * @see com.adminportal.service.UserService#save(User) + */ + @Override + public User save(User user) { + + return userRepository.save(user); + } + + /** + * @see com.adminportal.service.UserService#createUser(User, Set) + */ + @Override + public User createUser(User user, Set userRoles) throws Exception { + + user.getUserRoles().addAll(userRoles); + User localuser=userRepository.save(user); + + return localuser; + } + + + /** + * @see com.adminportal.service.UserService#existsByUser(String, String) + */ + @Override + public User existsByUser(String username, String password) { + + User local=userRepository.existsByUser(username, password); + + return local; + } + + + /** + * @see com.adminportal.service.UserService#findAll() + */ + @Override + public List findAll() { + + List localusr=(List) userRepository.findAll(); + return localusr; + + } + + + /** + * @see com.adminportal.service.UserService#findById(int) + */ + @Override + public User findById(int id) { + + Optional local=userRepository.findById(id); + + User localUsr=local.get(); + + return localUsr; + } + + + /** + * @see com.adminportal.service.UserService#deleteById(int id) + */ + @Override + public void deleteById(int id) { + + Optional temp=userRepository.findById(id); + + User localUsr=temp.get(); + System.out.println(localUsr); + + userRoleRepository.deleteByuser(localUsr); + + userRepository.deleteById(id); + + } + + + /** + * @see com.adminportal.service.UserService#disableEnableUser(int isvalid, int id) + */ + @Override + @Transactional + public boolean disableEnableUser(int isvalid, int id) { + + int status=userRepository.disableuser(isvalid, id); + + if(status>0) { + return true; + }else { + return false; + } + + } + + + /** + * @see com.adminportal.service.UserService#existByEmail(String Email) + */ + @Override + public boolean existByEmail(String Email) { + + return userRepository.existsByemail(Email); + } + + + /** + * @see com.adminportal.service.UserService#addUserToArticle(User usr, Set article) + */ + @Override + public User addUserToArticle(User usr, Set article) { + usr.getArticleExternal().addAll(article); + userRepository.save(usr); + + for(ArticleExternal temp:article) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + + return null; + } + + + /** + * @see com.adminportal.service.UserService#addUserToDocument(User usr, Set document) + */ + @Override + public User addUserToDocument(User usr, Set document) { + + usr.getDocumentExternal().addAll(document); + userRepository.save(usr); + + for(DocumentExternal temp:document) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + return null; + } + + + /** + * @see com.adminportal.service.UserService# addUserToLessonplan(User usr, Set lesson) + */ + @Override + public User addUserToLessonplan(User usr, Set lesson) { + + usr.getLessonPlan().addAll(lesson); + userRepository.save(usr); + + for(LessonPlan temp:lesson) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + return null; + } + + + /** + * @see com.adminportal.service.UserService#addUserToPhets(User usr, Set phet) + */ + @Override + public User addUserToPhets(User usr, Set phet) { + + usr.getPhet().addAll(phet); + userRepository.save(usr); + + for(Phets temp:phet) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + return null; + } + + + /** + * @see com.adminportal.service.UserService#addUserToQuizQuestion(User usr, Set quiz) + */ + @Override + public User addUserToQuizQuestion(User usr, Set quiz) { + + usr.getQuiz().addAll(quiz); + userRepository.save(usr); + + for(QuizQuestion temp:quiz) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + return null; + } + + /** + * @see com.adminportal.service.UserService#addUserToVideo(User usr, Set video) + */ + @Override + public User addUserToVideo(User usr, Set video) { + + usr.getVideoExternal().addAll(video); + userRepository.save(usr); + + for(VideoExternal temp:video) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + return null; + } + + /** + * @see com.adminportal.service.UserService#findByUsername(String username) + */ + @Override + public User findByUsername(String username) { + + + return userRepository.findByemail(username); + } + + /** + * @see com.adminportal.service.UserService#addUserToComment(User usr, Set comment) + */ + @Override + public User addUserToComment(User usr, Set comment) { + + usr.getComment().addAll(comment); + userRepository.save(usr); + + return null; + } + + /** + * @see com.adminportal.service.UserService#addUserToCommentReply(User usr, Set comReply) + */ + @Override + public User addUserToCommentReply(User usr, Set comReply) { + usr.getCommentReply().addAll(comReply); + userRepository.save(usr); + return null; + } + + /** + * @see com.adminportal.service.UserService#updateUserPassword(String password, int id) + */ + @Override + @Transactional + public boolean updateUserPassword(String password, int id) { + int status=userRepository.updateUserPassword(password, id); + if(status>0) + return true; + else + return false; + + } + + /** + * @see com.adminportal.service.UserService#addUserToConceptMap(User usr, Set concept) + */ + @Override + public User addUserToConceptMap(User usr, Set concept) { + usr.getConceptMap().addAll(concept); + userRepository.save(usr); + return null; + } + + /** + * @see com.adminportal.service.UserService#addUserToTutorial(User usr, Set tutorial) + */ + @Override + public User addUserToTutorial(User usr, Set tutorial) { + usr.getTutorial().addAll(tutorial); + userRepository.save(usr); + + for(Tutorial temp:tutorial) { + topicRepo.updateRecentmodificationDate(ServiceUtility.getCurrentTime(),temp.getTopic().getTopicId()); + } + return null; + } + + /** + * @see com.adminportal.service.UserService#findByToken(String token) + */ + @Override + public User findByToken(String token) { + + User temp=userRepository.findBytoken(token); + return temp; + } + + /** + * @see com.adminportal.service.UserService#countRow() + */ + @Override + public int countRow() { + + return (int) userRepository.count(); + } + + /** + * @see com.adminportal.service.UserService#addUserToClass(User usr, Class clas) + */ + @Override + public User addUserToClass(User usr, Class clas) { + + usr.getClassDb().add(clas); + userRepository.save(usr); + return null; + } + + /** + * @see com.adminportal.service.UserService#adduserToSubject(User usr, Subject sub) + */ + @Override + public User adduserToSubject(User usr, Subject sub) { + + usr.getSubjectDb().add(sub); + userRepository.save(usr); + return null; + } + + /** + * @see com.adminportal.service.UserService#enableApproveTeacher(int isvalid, int id) + */ + @Override + @Transactional + public boolean enableApproveTeacher(int isvalid, int id) { + + int status=userRepository.updateApproveTeacher(isvalid, id); + + if(status>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.UserService#updateUserDetails(String fname, String lname, int id) + */ + @Override + @Transactional + public boolean updateUserDetails(String fname, String lname, int id) { + int status=userRepository.updateUserDetails(fname, lname, id); + + if(status>0) { + return true; + }else { + return false; + } + + } + + + + + +} diff --git a/src/main/java/com/adminportal/service/impl/VideoExternalServiceImpl.java b/src/main/java/com/adminportal/service/impl/VideoExternalServiceImpl.java new file mode 100644 index 0000000..ff0d826 --- /dev/null +++ b/src/main/java/com/adminportal/service/impl/VideoExternalServiceImpl.java @@ -0,0 +1,167 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : Implementation of video Service Interface to define method for database operation. + */ + +package com.adminportal.service.impl; + +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.adminportal.content.Topic; +import com.adminportal.content.VideoExternal; +import com.adminportal.domain.User; +import com.adminportal.repository.VideoExternalRepository; +import com.adminportal.service.VideoExternalService; +import com.spoken.Utility.ServiceUtility; + +/** + * Default implementation of the {@link com.adminportal.service.VideoExternalService} interface. + * @author om prakash + * + */ +@Service +public class VideoExternalServiceImpl implements VideoExternalService{ + + @Autowired + private VideoExternalRepository videoRepo; + + /** + * @see com.adminportal.service.VideoExternalService#findAll() + */ + @Override + public List findAll() { + + return videoRepo.findAllBytype("Video"); + } + + /** + * @see com.adminportal.service.VideoExternalService#deleteVideoById(int id) + */ + @Override + public void deleteVideoById(int id) { + Optional local=videoRepo.findById(id); + VideoExternal temp=local.get(); + videoRepo.deleteById(temp.getVideoId()); + + } + + + /** + * @see com.adminportal.service.VideoExternalService#findById(int id) + */ + @Override + public VideoExternal findById(int id) { + Optional video=videoRepo.findById(id); + return video.get(); + } + + /** + * @see com.adminportal.service.VideoExternalService#updateVideo(String desc, String source, String url, Timestamp date, int id) + */ + @Override + @Transactional + public boolean updateVideo(String desc, String source, String url, Timestamp date, int id) { + int status= videoRepo.updateVideo(desc, source, url, date, id); + if(status>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.VideoExternalService#countRow() + */ + @Override + public int countRow() { + + return (int) videoRepo.count(); + } + + + /** + * @see com.adminportal.service.VideoExternalService#EnableVideoContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableVideoContent(int status, int id) { + int status1=videoRepo.EnableVideoContent(status, id); + if(status1>0) { + return true; + }else { + return false; + } + + } + + /** + * @see com.adminportal.service.VideoExternalService#findAllByTopic(Topic topic) + */ + @Override + public List findAllByTopic(Topic topic) { + + List localVideo=videoRepo.findAllBytopicAndType(topic, "Video"); + + return localVideo; + } + + /** + * @see com.adminportal.service.VideoExternalService#findALlByUser(User usr) + */ + @Override + public List findALlByUser(User usr) { + + return videoRepo.findAllByuser(usr,"Video"); + } + + /** + * @see com.adminportal.service.VideoExternalService#EnableAcceptedByAdminVideoContent(int status, int id) + */ + @Override + @Transactional + public boolean EnableAcceptedByAdminVideoContent(int status, int id) { + int status1=videoRepo.EnableAcceptedByAdminContent(status,ServiceUtility.getCurrentTime(), id); + if(status1>0) { + return true; + }else { + return false; + } + } + + /** + * @see com.adminportal.service.VideoExternalService#findAllByTopicAndStatus(Topic topic) + */ + @Override + public List findAllByTopicAndStatus(Topic topic) { + + return videoRepo.findAllByTopicAndStatus(topic, 1,"Video"); + } + + /** + * @see com.adminportal.service.VideoExternalService#save(VideoExternal temp) + */ + @Override + public int save(VideoExternal temp) { + videoRepo.save(temp); + return 0; + } + + /** + * @see com.adminportal.service.VideoExternalService#deleteVideo(VideoExternal video) + */ + @Override + public void deleteVideo(VideoExternal video) { + // TODO Auto-generated method stub + + videoRepo.deleteVideo(video.getVideoId()); + } + +} diff --git a/src/main/java/com/spoken/Utility/CommentAjaxQueryResolver.java b/src/main/java/com/spoken/Utility/CommentAjaxQueryResolver.java new file mode 100644 index 0000000..0a8c128 --- /dev/null +++ b/src/main/java/com/spoken/Utility/CommentAjaxQueryResolver.java @@ -0,0 +1,114 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is a Helper Class to fetch Comment Related data from UI on ajax Call. + */ + +package com.spoken.Utility; +/** + * A Utility Class to Store comment data made in application. + * @author om prakash + * + */ +public class CommentAjaxQueryResolver { + + /** + * Comment ID representing unique comment stored + */ + int comId; + /** + * Actual comment + */ + String comment; + /** + * Name of person who made this comment + */ + String userName; + /** + * Date on which comment is made. + */ + String dateReceived; + + /** + * Default Constructor + */ + public CommentAjaxQueryResolver() {} + + + /** + * Parameterized Constructor + * @param comId integer value representing unique comment ID + * @param comment Actual comment in String format + * @param userName User name who made comment in String. + * @param dateReceived Date on which comment is made in string format + */ + public CommentAjaxQueryResolver(int comId, String comment, String userName, String dateReceived) { + + this.comId = comId; + this.comment = comment; + this.userName = userName; + this.dateReceived = dateReceived; + } + + + /** + * Getter method for Comment ID + * @return int + */ + public int getComId() { + return comId; + } + /** + * Setter method for Comment ID + * @param comId + */ + public void setComId(int comId) { + this.comId = comId; + } + /** + * Getter method for Actual comment + * @return String + */ + public String getComment() { + return comment; + } + /** + * Setter method for Actual Comment + * @param comment + */ + + public void setComment(String comment) { + this.comment = comment; + } + /** + * Getter method for Getting name of user who made Comment + * @return String + */ + public String getUserName() { + return userName; + } + /** + * Setter method for username + * @param userName + */ + public void setUserName(String userName) { + this.userName = userName; + } + /** + * Getter method for date to which comment made + * @return String + */ + public String getDateReceived() { + return dateReceived; + } + /** + * Setter method for date + * @param dateReceived + */ + public void setDateReceived(String dateReceived) { + this.dateReceived = dateReceived; + } + + + +} diff --git a/src/main/java/com/spoken/Utility/CommentReplyAjaxQueryResolver.java b/src/main/java/com/spoken/Utility/CommentReplyAjaxQueryResolver.java new file mode 100644 index 0000000..e98e87f --- /dev/null +++ b/src/main/java/com/spoken/Utility/CommentReplyAjaxQueryResolver.java @@ -0,0 +1,92 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is a Helper Class to fetch CommentReply Related data from UI on ajax Call. + */ + +package com.spoken.Utility; + +/** + * This is utility Class to resolve data in ajax call + * @author om prakash + * + */ +public class CommentReplyAjaxQueryResolver { + /** + * Comment ID + */ + int id; + /** + * Actual Comment + */ + String comment; + + boolean reply; + boolean admin; + + /** + * Getter method for Comment ID + * @return int + */ + public int getId() { + return id; + } + /** + * Setter method for Comment ID + * @param id + */ + public void setId(int id) { + this.id = id; + } + + /** + * Getter method for Comment + * @return + */ + public String getComment() { + return comment; + } + + /** + * Setter method for Comment + * @param comment + */ + public void setComment(String comment) { + this.comment = comment; + } + + /** + * to check whether comment is being replied or not? + * @return boolean + */ + public boolean isReply() { + return reply; + } + /** + * setting reply + * @param reply + */ + public void setReply(boolean reply) { + this.reply = reply; + } + + /** + * to check whether admin or not? + * @return + */ + public boolean isAdmin() { + return admin; + } + + /** + * setting admin + * @param admin + */ + public void setAdmin(boolean admin) { + this.admin = admin; + } + + + + +} diff --git a/src/main/java/com/spoken/Utility/LoadUserLearner.java b/src/main/java/com/spoken/Utility/LoadUserLearner.java new file mode 100644 index 0000000..e4c5954 --- /dev/null +++ b/src/main/java/com/spoken/Utility/LoadUserLearner.java @@ -0,0 +1,196 @@ +package com.spoken.Utility; + +import java.sql.Date; +import java.sql.Timestamp; + + +/** + * Utility class to Display user detail on dashboard + * @author om Prakash + * + */ +public class LoadUserLearner { + /** + * User Id + */ + private int id; + + /** + * Email of User + */ + private String email; + + /** + * Gender of user + */ + private String sex; + + /** + * First name of user + */ + private String fname; + + /** + * Last name of User + */ + private String lname; + + /** + * Path to resource attached with User + */ + private String document; + + /** + * Schoolname to which user enrolled + */ + private String schoolName; + + /** + * School Address to which user enrolled + */ + private String schoolAddress; + + /** + * Pincode of User's School + */ + private int pincode; + + /** + * Date on which user Registered + */ + private Timestamp dateAdded; + + /** + * date and time of User's last activity + */ + private Timestamp lastLogin; + + /** + * date of user's date of Birth + */ + private Date dateOfBirth; + + + public int getId() { + return id; + } + + + public void setId(int id) { + this.id = id; + } + + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public String getSex() { + return sex; + } + + + public void setSex(String sex) { + this.sex = sex; + } + + + public String getFname() { + return fname; + } + + + public void setFname(String fname) { + this.fname = fname; + } + + + public String getLname() { + return lname; + } + + + public void setLname(String lname) { + this.lname = lname; + } + + + public String getDocument() { + return document; + } + + + public void setDocument(String document) { + this.document = document; + } + + + public String getSchoolName() { + return schoolName; + } + + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + + public String getSchoolAddress() { + return schoolAddress; + } + + + public void setSchoolAddress(String schoolAddress) { + this.schoolAddress = schoolAddress; + } + + + public int getPincode() { + return pincode; + } + + + public void setPincode(int pincode) { + this.pincode = pincode; + } + + + public Timestamp getDateAdded() { + return dateAdded; + } + + + public void setDateAdded(Timestamp dateAdded) { + this.dateAdded = dateAdded; + } + + + public Timestamp getLastLogin() { + return lastLogin; + } + + + public void setLastLogin(Timestamp lastLogin) { + this.lastLogin = lastLogin; + } + + + public Date getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(Date dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + + +} diff --git a/src/main/java/com/spoken/Utility/ServiceUtility.java b/src/main/java/com/spoken/Utility/ServiceUtility.java new file mode 100644 index 0000000..a952042 --- /dev/null +++ b/src/main/java/com/spoken/Utility/ServiceUtility.java @@ -0,0 +1,366 @@ +/* Company Name : Spoken Tutorial IIT bombay + * Author Name : Om Prakash + * Version : 1.0 + * Description : This is Utility class where various task is being carried out like + * 1. Password Encoding using fixed set of letter + * 2. operation to get Current date + * 3. operation find out days between 2 date + * 4. creating folder for Storing resources. + * 5. uploading file + * 6. checking Session + * + */ + +package com.spoken.Utility; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.SecureRandom; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpSession; + +import org.apache.tomcat.util.http.fileupload.FileUtils; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.web.multipart.MultipartFile; + +//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + + +import com.adminportal.HomeController; + +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.util.Zip4jUtil; +/** + * This class contains various utility function like creating password using Encoding scheme, getting current time, Checking extension for various format + * Supported in application, Create various folder in application, Uploading file etc. + * @author om prakash + * + */ + +public class ServiceUtility { + + /** + * This is External path where all the resources related to application resides. + */ + static String mediaPath="/var/school_data/"; + + /** + * This is used to create encoded password using text hashing. + */ + private static final String SALT="salt"; + + /** + * This is starting path for all the resources adding with external path. + */ + private static String uploadDirectory="Media/content/"; + + + /** + * This method create random password. + * @return object to BCryptPasswordEncoder class. + */ + public static BCryptPasswordEncoder passwordEncoder() { // password encoding + + return new BCryptPasswordEncoder(12,new SecureRandom(SALT.getBytes())); + } + + + /** + * This method is used to get current time. + * @return object to TimeStamp class + */ + public static Timestamp getCurrentTime() { // Current Date + + Date date=new Date(); + long t=date.getTime(); + Timestamp st=new Timestamp(t); + + return st; + } + + /** + * This method return number of days which is difference of current date and given date as a parameter. + * @param date Timestamp object + * @return String object containing number of days as value. + */ + public static String daysDifference(Timestamp date) { // days Difference Between 2 date(current - given) + + Timestamp presentdate=getCurrentTime(); + long difference =Math.abs(date.getTime()-presentdate.getTime()); + long differenceDate=difference/(24*60*60*1000); + + + return Long.toString(differenceDate); + } + + + /** + * This method creates folder related to topic created in application based on given input in string format of various classes like Classname, Subject and Topic. + * @param className String value containing ClassName + * @param subject String value containing Subject ID + * @param topicName String value containing TopicName ID + * @return boolean value denoting true for Successful and false for failure. + * @throws Exception + */ + public static boolean createclassSubjectFolder(String className,String subject,String topicName) throws Exception{ // creating folder for topic + + boolean status=true; + if(!new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/").exists()) { + if(new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/").mkdirs()) { + + new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/"+"Document/").mkdirs(); + new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/"+"Lessonplan/").mkdirs(); + new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/"+"Quiz/").mkdirs(); + new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/"+"ConceptMap/").mkdirs(); + new File(mediaPath+uploadDirectory+className+"_"+subject+"/"+topicName+"/"+"Video/").mkdirs(); + } + } + return status; + } + + /** + * This method is used to create folder using the path given as input parameter + * @param path path to upload file + * @return boolean value denoting true for Successful and false for failure. + */ + public static boolean createFolder(String path) { // check for existence of path + boolean status=false; + if(!new File(path).exists()) { + status=new File(path).mkdirs(); + } + return status; + + } + + /** + * This method is used to upload file in specified path given as input. + * @param uploadFile Array of MultipartFile Object to upload multiple file + * @param pathToUpload A String formatted path where file to be uploaded. + * @return relative path where file is uploaded or null if failed. + * @throws Exception + */ + public static String uploadFile(MultipartFile[] uploadFile,String pathToUpload) throws Exception{ // uploading file + String path=null; + for(MultipartFile file:uploadFile) { + Path fileNameAndPath =Paths.get(pathToUpload, file.getOriginalFilename()); + + Files.write(fileNameAndPath, file.getBytes()); + System.out.println(fileNameAndPath.toString()); + path=fileNameAndPath.toString(); + + } + + return path; + } + + /** + * Upload Zip formatted file in specified path given as input + * @param uploadFile Array of MultipartFile Object to upload multiple file + * @param pathToUpload A String formatted path where file to be uploaded. + * @return relative path where file is uploaded or null if failed. + * @throws Exception + */ + public static String uploadZipFile(MultipartFile[] uploadFile,String pathToUpload) throws Exception{ // uploading file + String path=null; + for(MultipartFile file:uploadFile) { + Path fileNameAndPath =Paths.get(pathToUpload, file.getOriginalFilename()); + + Files.write(fileNameAndPath, file.getBytes()); + System.out.println(fileNameAndPath.toString()); + path=fileNameAndPath.toString(); + + + File[] files1 = new File(pathToUpload).listFiles(); + for(File fileTemp:files1) { + if(fileTemp.isFile() && !(fileTemp.getName().endsWith("zip") || fileTemp.getName().endsWith("ZIP"))) { + fileTemp.delete(); + }else if(fileTemp.isDirectory()) { + FileUtils.deleteDirectory(fileTemp); + } + } + new ZipFile(fileNameAndPath.toString()).extractAll(pathToUpload); + + File[] files2 = new File(pathToUpload).listFiles(); + for(File filetemp:files2) { + if(filetemp.isFile()) { + if(filetemp.getName().endsWith(".html") || filetemp.getName().endsWith(".xhtml")) { + path=pathToUpload+filetemp.getName(); + Files.delete(fileNameAndPath); + } + } + } + + } + + return path; + } + + /** + * Upload video file formatted in specified path given as argument. + * @param file MultipartFile Object to upload file + * @param pathToUpload A String formatted path where file to be uploaded. + * @return relative path where file is uploaded or null if failed. + * @throws Exception + */ + public static String uploadVideoFile(MultipartFile file,String pathToUpload) throws Exception{ // uploading file + String path=null; + + Path fileNameAndPath =Paths.get(pathToUpload, file.getOriginalFilename()); + + Files.write(fileNameAndPath, file.getBytes()); + System.out.println(fileNameAndPath.toString()); + path=fileNameAndPath.toString(); + + + + return path; + } + + /** + * Checks whether file extension is pdf irrespective of case or not? + * @param pdfFile Array of MutipartFile object with source file. + * @return validity against pdf file extension. + */ + public static boolean checkFileExtensionPDF(MultipartFile[] pdfFile) { // validate file against PDF extension + + for(MultipartFile temp:pdfFile) { + if(!temp.getOriginalFilename().endsWith(".pdf") && !temp.getOriginalFilename().endsWith(".PDF")) { + return false; + } + } + return true; + } + + /** + * Checks whether file extension is pdf irrespective of case or not? + * @param pdfFile MutipartFile object with source file. + * @return validity against pdf file extension. + */ + public static boolean checkFileExtensiononeFilePDF(MultipartFile pdfFile) { // validate file against PDF extension + + + if(!pdfFile.getOriginalFilename().endsWith(".pdf") && !pdfFile.getOriginalFilename().endsWith(".PDF")) { + return false; + } + + return true; + } + + /** + * Checks whether file extension is jpg/jpeg/png irrespective of case or not? + * @param imageFile Array of MutipartFile object with source file. + * @return validity against image file extension. + */ + public static boolean checkFileExtensionImage(MultipartFile[] imageFile) { // validate file against Image Extension + + for(MultipartFile temp:imageFile) { + if(!temp.getOriginalFilename().endsWith(".jpg") && !temp.getOriginalFilename().endsWith(".jpeg") && !temp.getOriginalFilename().endsWith(".png") + && !temp.getOriginalFilename().endsWith(".JPG") && !temp.getOriginalFilename().endsWith(".JPEG") && !temp.getOriginalFilename().endsWith(".PNG")) { + + return false; + } + } + return true; + } + + + /** + * checks whether file extension is mp4/mov irrespective of case or not ? + * @param videoFile MutipartFile object with source file. + * @return validity against video file extension. + */ + public static boolean checkFileExtensionVideo(MultipartFile videoFile) { // validate file against Image Extension + + + if(!videoFile.getOriginalFilename().endsWith(".mp4") && !videoFile.getOriginalFilename().endsWith(".mov") + && !videoFile.getOriginalFilename().endsWith(".MP4") && !videoFile.getOriginalFilename().endsWith(".MOV")) { + return false; + } + + return true; + } + + /** + * checks whether file extension is zip irrespective of case or not ? + * @param zipFile Array of MutipartFile object with source file. + * @return validity against Zip file extension. + */ + public static boolean checkFileExtensionZip(MultipartFile[] zipFile) { // validate file against HTML Extension + + for(MultipartFile temp:zipFile) { + if(!temp.getOriginalFilename().endsWith(".zip") && !temp.getOriginalFilename().endsWith(".ZIP")) { + + return false; + } + } + return true; + } + + + /** + * Returns current directory + * @return String value of currentpath. + */ + public static String presentDirectory() { + Path currentRelativePath = Paths.get(""); + String currentpath = currentRelativePath.toAbsolutePath().toString(); + return currentpath; + + } + + /** + * Checks whether email is in proper format or not? + * @param email String value of email + * @return boolean value representing validity against Email Checks. + */ + public static boolean checkEmailValidity(String email) { + + String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+ + "[a-zA-Z0-9_+&*-]+)*@" + + "(?:[a-zA-Z0-9-]+\\.)+[a-z" + + "A-Z]{2,7}$"; + + Pattern pat = Pattern.compile(emailRegex); + if (email == null) + return false; + + return pat.matcher(email).matches(); + } + + /** + * Checks whether number exist in string or not? + * @param input String value + * @return boolean value true for no Number in String else false. + */ + public static boolean checkContainNumeralInString(String input) { + for(int i=0 ; i tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 30px; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + position: relative; +} +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + position: absolute; + bottom: 8px; + right: 8px; + display: block; + font-family: 'Glyphicons Halflings'; + opacity: 0.5; +} +table.dataTable thead .sorting:after { + opacity: 0.2; + content: "\e150"; + /* sort */ +} +table.dataTable thead .sorting_asc:after { + content: "\e155"; + /* sort-by-attributes */ +} +table.dataTable thead .sorting_desc:after { + content: "\e156"; + /* sort-by-attributes-alt */ +} +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + color: #eee; +} + +div.dataTables_scrollHead table.dataTable { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody > table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody > table > thead .sorting:after, +div.dataTables_scrollBody > table > thead .sorting_asc:after, +div.dataTables_scrollBody > table > thead .sorting_desc:after { + display: none; +} +div.dataTables_scrollBody > table > tbody > tr:first-child > th, +div.dataTables_scrollBody > table > tbody > tr:first-child > td { + border-top: none; +} + +div.dataTables_scrollFoot > .dataTables_scrollFootInner { + box-sizing: content-box; +} +div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { + margin-top: 0 !important; + border-top: none; +} + +@media screen and (max-width: 767px) { + div.dataTables_wrapper div.dataTables_length, + div.dataTables_wrapper div.dataTables_filter, + div.dataTables_wrapper div.dataTables_info, + div.dataTables_wrapper div.dataTables_paginate { + text-align: center; + } +} +table.dataTable.table-condensed > thead > tr > th { + padding-right: 20px; +} +table.dataTable.table-condensed .sorting:after, +table.dataTable.table-condensed .sorting_asc:after, +table.dataTable.table-condensed .sorting_desc:after { + top: 6px; + right: 6px; +} + +table.table-bordered.dataTable th, +table.table-bordered.dataTable td { + border-left-width: 0; +} +table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, +table.table-bordered.dataTable td:last-child, +table.table-bordered.dataTable td:last-child { + border-right-width: 0; +} +table.table-bordered.dataTable tbody th, +table.table-bordered.dataTable tbody td { + border-bottom-width: 0; +} + +div.dataTables_scrollHead table.table-bordered { + border-bottom-width: 0; +} + +div.table-responsive > div.dataTables_wrapper > div.row { + margin: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { + padding-left: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { + padding-right: 0; +} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap.min.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap.min.css new file mode 100644 index 0000000..af6ecfe --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap.min.css @@ -0,0 +1 @@ +table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody>table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody>table>thead .sorting:after,div.dataTables_scrollBody>table>thead .sorting_asc:after,div.dataTables_scrollBody>table>thead .sorting_desc:after{display:none}div.dataTables_scrollBody>table>tbody>tr:first-child>th,div.dataTables_scrollBody>table>tbody>tr:first-child>td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.css new file mode 100644 index 0000000..84ec203 --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.css @@ -0,0 +1,206 @@ +table.dataTable { + clear: both; + margin-top: 6px !important; + margin-bottom: 6px !important; + max-width: none !important; + border-collapse: separate !important; + border-spacing: 0; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, +table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length label { + font-weight: normal; + text-align: left; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_length select { + width: auto; + display: inline-block; +} +div.dataTables_wrapper div.dataTables_filter { + text-align: right; +} +div.dataTables_wrapper div.dataTables_filter label { + font-weight: normal; + white-space: nowrap; + text-align: left; +} +div.dataTables_wrapper div.dataTables_filter input { + margin-left: 0.5em; + display: inline-block; + width: auto; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 0.85em; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_paginate { + margin: 0; + white-space: nowrap; + text-align: right; +} +div.dataTables_wrapper div.dataTables_paginate ul.pagination { + margin: 2px 0; + white-space: nowrap; + justify-content: flex-end; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1em 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 30px; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + position: relative; +} +table.dataTable thead .sorting:before, table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:before, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:before, +table.dataTable thead .sorting_desc_disabled:after { + position: absolute; + bottom: 0.9em; + display: block; + opacity: 0.3; +} +table.dataTable thead .sorting:before, +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_desc:before, +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_desc_disabled:before { + right: 1em; + content: "\2191"; +} +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + right: 0.5em; + content: "\2193"; +} +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_desc:after { + opacity: 1; +} +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_desc_disabled:after { + opacity: 0; +} + +div.dataTables_scrollHead table.dataTable { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody table thead .sorting:before, +div.dataTables_scrollBody table thead .sorting_asc:before, +div.dataTables_scrollBody table thead .sorting_desc:before, +div.dataTables_scrollBody table thead .sorting:after, +div.dataTables_scrollBody table thead .sorting_asc:after, +div.dataTables_scrollBody table thead .sorting_desc:after { + display: none; +} +div.dataTables_scrollBody table tbody tr:first-child th, +div.dataTables_scrollBody table tbody tr:first-child td { + border-top: none; +} + +div.dataTables_scrollFoot > .dataTables_scrollFootInner { + box-sizing: content-box; +} +div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { + margin-top: 0 !important; + border-top: none; +} + +@media screen and (max-width: 767px) { + div.dataTables_wrapper div.dataTables_length, + div.dataTables_wrapper div.dataTables_filter, + div.dataTables_wrapper div.dataTables_info, + div.dataTables_wrapper div.dataTables_paginate { + text-align: center; + } +} +table.dataTable.table-sm > thead > tr > th { + padding-right: 20px; +} +table.dataTable.table-sm .sorting:before, +table.dataTable.table-sm .sorting_asc:before, +table.dataTable.table-sm .sorting_desc:before { + top: 5px; + right: 0.85em; +} +table.dataTable.table-sm .sorting:after, +table.dataTable.table-sm .sorting_asc:after, +table.dataTable.table-sm .sorting_desc:after { + top: 5px; +} + +table.table-bordered.dataTable th, +table.table-bordered.dataTable td { + border-left-width: 0; +} +table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, +table.table-bordered.dataTable td:last-child, +table.table-bordered.dataTable td:last-child { + border-right-width: 0; +} +table.table-bordered.dataTable tbody th, +table.table-bordered.dataTable tbody td { + border-bottom-width: 0; +} + +div.dataTables_scrollHead table.table-bordered { + border-bottom-width: 0; +} + +div.table-responsive > div.dataTables_wrapper > div.row { + margin: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { + padding-left: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { + padding-right: 0; +} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.min.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.min.css new file mode 100644 index 0000000..f1930be --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.bootstrap4.min.css @@ -0,0 +1 @@ +table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important;border-spacing:0}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:auto;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:0.85em;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap;justify-content:flex-end}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:before,table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:0.9em;display:block;opacity:0.3}table.dataTable thead .sorting:before,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:before{right:1em;content:"\2191"}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{right:0.5em;content:"\2193"}table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:after{opacity:1}table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{opacity:0}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:before,div.dataTables_scrollBody table thead .sorting_asc:before,div.dataTables_scrollBody table thead .sorting_desc:before,div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-sm>thead>tr>th{padding-right:20px}table.dataTable.table-sm .sorting:before,table.dataTable.table-sm .sorting_asc:before,table.dataTable.table-sm .sorting_desc:before{top:5px;right:0.85em}table.dataTable.table-sm .sorting:after,table.dataTable.table-sm .sorting_asc:after,table.dataTable.table-sm .sorting_desc:after{top:5px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.css new file mode 100644 index 0000000..79848c9 --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.css @@ -0,0 +1,118 @@ +table.dataTable { + clear: both; + margin: 0.5em 0 !important; + max-width: none !important; + width: 100%; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper { + position: relative; +} +div.dataTables_wrapper div.dataTables_length label { + float: left; + text-align: left; + margin-bottom: 0; +} +div.dataTables_wrapper div.dataTables_length select { + width: 75px; + margin-bottom: 0; +} +div.dataTables_wrapper div.dataTables_filter label { + float: right; + margin-bottom: 0; +} +div.dataTables_wrapper div.dataTables_filter input { + display: inline-block !important; + width: auto !important; + margin-bottom: 0; + margin-left: 0.5em; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 2px; +} +div.dataTables_wrapper div.dataTables_paginate { + float: right; + margin: 0; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1rem 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 1.5rem; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + background-repeat: no-repeat; + background-position: center right; +} +table.dataTable thead .sorting { + background-image: url("../images/sort_both.png"); +} +table.dataTable thead .sorting_asc { + background-image: url("../images/sort_asc.png"); +} +table.dataTable thead .sorting_desc { + background-image: url("../images/sort_desc.png"); +} +table.dataTable thead .sorting_asc_disabled { + background-image: url("../images/sort_asc_disabled.png"); +} +table.dataTable thead .sorting_desc_disabled { + background-image: url("../images/sort_desc_disabled.png"); +} + +div.dataTables_scrollHead table { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody table tbody tr:first-child th, +div.dataTables_scrollBody table tbody tr:first-child td { + border-top: none; +} + +div.dataTables_scrollFoot table { + margin-top: 0 !important; + border-top: none; +} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.min.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.min.css new file mode 100644 index 0000000..73af41e --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.foundation.min.css @@ -0,0 +1 @@ +table.dataTable{clear:both;margin:0.5em 0 !important;max-width:none !important;width:100%}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper{position:relative}div.dataTables_wrapper div.dataTables_length label{float:left;text-align:left;margin-bottom:0}div.dataTables_wrapper div.dataTables_length select{width:75px;margin-bottom:0}div.dataTables_wrapper div.dataTables_filter label{float:right;margin-bottom:0}div.dataTables_wrapper div.dataTables_filter input{display:inline-block !important;width:auto !important;margin-bottom:0;margin-left:0.5em}div.dataTables_wrapper div.dataTables_info{padding-top:2px}div.dataTables_wrapper div.dataTables_paginate{float:right;margin:0}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1rem 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:1.5rem}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("../images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("../images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("../images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("../images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("../images/sort_desc_disabled.png")}div.dataTables_scrollHead table{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.css new file mode 100644 index 0000000..5070b04 --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.css @@ -0,0 +1,481 @@ +/* + * Table styles + */ +table.dataTable { + width: 100%; + margin: 0 auto; + clear: both; + border-collapse: separate; + border-spacing: 0; + /* + * Header and footer styles + */ + /* + * Body styles + */ +} +table.dataTable thead th, +table.dataTable tfoot th { + font-weight: bold; +} +table.dataTable thead th, +table.dataTable thead td { + padding: 10px 18px; +} +table.dataTable thead th:active, +table.dataTable thead td:active { + outline: none; +} +table.dataTable tfoot th, +table.dataTable tfoot td { + padding: 10px 18px 6px 18px; +} +table.dataTable tbody tr { + background-color: #ffffff; +} +table.dataTable tbody tr.selected { + background-color: #B0BED9; +} +table.dataTable tbody th, +table.dataTable tbody td { + padding: 8px 10px; +} +table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { + border-top: 1px solid #ddd; +} +table.dataTable.row-border tbody tr:first-child th, +table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th, +table.dataTable.display tbody tr:first-child td { + border-top: none; +} +table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { + border-top: 1px solid #ddd; + border-right: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr th:first-child, +table.dataTable.cell-border tbody tr td:first-child { + border-left: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr:first-child th, +table.dataTable.cell-border tbody tr:first-child td { + border-top: none; +} +table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd { + background-color: #f9f9f9; +} +table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected { + background-color: #acbad4; +} +table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover { + background-color: #f6f6f6; +} +table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected { + background-color: #aab7d1; +} +table.dataTable.order-column tbody tr > .sorting_1, +table.dataTable.order-column tbody tr > .sorting_2, +table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1, +table.dataTable.display tbody tr > .sorting_2, +table.dataTable.display tbody tr > .sorting_3 { + background-color: #fafafa; +} +table.dataTable.order-column tbody tr.selected > .sorting_1, +table.dataTable.order-column tbody tr.selected > .sorting_2, +table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1, +table.dataTable.display tbody tr.selected > .sorting_2, +table.dataTable.display tbody tr.selected > .sorting_3 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 { + background-color: #f1f1f1; +} +table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 { + background-color: #f3f3f3; +} +table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 { + background-color: whitesmoke; +} +table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 { + background-color: #a6b4cd; +} +table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 { + background-color: #a8b5cf; +} +table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 { + background-color: #a9b7d1; +} +table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 { + background-color: #fafafa; +} +table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 { + background-color: #fcfcfc; +} +table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 { + background-color: #fefefe; +} +table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 { + background-color: #aebcd6; +} +table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 { + background-color: #afbdd8; +} +table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 { + background-color: #eaeaea; +} +table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 { + background-color: #ececec; +} +table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 { + background-color: #efefef; +} +table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 { + background-color: #a2aec7; +} +table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 { + background-color: #a3b0c9; +} +table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 { + background-color: #a5b2cb; +} +table.dataTable.no-footer { + border-bottom: 1px solid #111; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} +table.dataTable.compact thead th, +table.dataTable.compact thead td { + padding: 4px 17px 4px 4px; +} +table.dataTable.compact tfoot th, +table.dataTable.compact tfoot td { + padding: 4px; +} +table.dataTable.compact tbody th, +table.dataTable.compact tbody td { + padding: 4px; +} +table.dataTable th.dt-left, +table.dataTable td.dt-left { + text-align: left; +} +table.dataTable th.dt-center, +table.dataTable td.dt-center, +table.dataTable td.dataTables_empty { + text-align: center; +} +table.dataTable th.dt-right, +table.dataTable td.dt-right { + text-align: right; +} +table.dataTable th.dt-justify, +table.dataTable td.dt-justify { + text-align: justify; +} +table.dataTable th.dt-nowrap, +table.dataTable td.dt-nowrap { + white-space: nowrap; +} +table.dataTable thead th.dt-head-left, +table.dataTable thead td.dt-head-left, +table.dataTable tfoot th.dt-head-left, +table.dataTable tfoot td.dt-head-left { + text-align: left; +} +table.dataTable thead th.dt-head-center, +table.dataTable thead td.dt-head-center, +table.dataTable tfoot th.dt-head-center, +table.dataTable tfoot td.dt-head-center { + text-align: center; +} +table.dataTable thead th.dt-head-right, +table.dataTable thead td.dt-head-right, +table.dataTable tfoot th.dt-head-right, +table.dataTable tfoot td.dt-head-right { + text-align: right; +} +table.dataTable thead th.dt-head-justify, +table.dataTable thead td.dt-head-justify, +table.dataTable tfoot th.dt-head-justify, +table.dataTable tfoot td.dt-head-justify { + text-align: justify; +} +table.dataTable thead th.dt-head-nowrap, +table.dataTable thead td.dt-head-nowrap, +table.dataTable tfoot th.dt-head-nowrap, +table.dataTable tfoot td.dt-head-nowrap { + white-space: nowrap; +} +table.dataTable tbody th.dt-body-left, +table.dataTable tbody td.dt-body-left { + text-align: left; +} +table.dataTable tbody th.dt-body-center, +table.dataTable tbody td.dt-body-center { + text-align: center; +} +table.dataTable tbody th.dt-body-right, +table.dataTable tbody td.dt-body-right { + text-align: right; +} +table.dataTable tbody th.dt-body-justify, +table.dataTable tbody td.dt-body-justify { + text-align: justify; +} +table.dataTable tbody th.dt-body-nowrap, +table.dataTable tbody td.dt-body-nowrap { + white-space: nowrap; +} + +table.dataTable, +table.dataTable th, +table.dataTable td { + box-sizing: content-box; +} + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; + *zoom: 1; + zoom: 1; +} +.dataTables_wrapper .dataTables_length { + float: left; +} +.dataTables_wrapper .dataTables_filter { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_filter input { + margin-left: 0.5em; +} +.dataTables_wrapper .dataTables_info { + clear: both; + float: left; + padding-top: 0.755em; +} +.dataTables_wrapper .dataTables_paginate { + float: right; + text-align: right; + padding-top: 0.25em; +} +.dataTables_wrapper .dataTables_paginate .paginate_button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em 1em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + color: #333 !important; + border: 1px solid transparent; + border-radius: 2px; +} +.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { + color: #333 !important; + border: 1px solid #979797; + background-color: white; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%); + /* IE10+ */ + background: -o-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, white 0%, #dcdcdc 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active { + cursor: default; + color: #666 !important; + border: 1px solid transparent; + background: transparent; + box-shadow: none; +} +.dataTables_wrapper .dataTables_paginate .paginate_button:hover { + color: white !important; + border: 1px solid #111; + background-color: #585858; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #585858 0%, #111 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #585858 0%, #111 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #585858 0%, #111 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #585858 0%, #111 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #585858 0%, #111 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button:active { + outline: none; + background-color: #2b2b2b; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%); + /* W3C */ + box-shadow: inset 0 0 3px #111; +} +.dataTables_wrapper .dataTables_paginate .ellipsis { + padding: 0 1em; +} +.dataTables_wrapper .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + text-align: center; + font-size: 1.2em; + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0))); + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: #333; +} +.dataTables_wrapper .dataTables_scroll { + clear: both; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td { + vertical-align: middle; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing { + height: 0; + overflow: hidden; + margin: 0 !important; + padding: 0 !important; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: 1px solid #111; +} +.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable, +.dataTables_wrapper.no-footer div.dataTables_scrollBody > table { + border-bottom: none; +} +.dataTables_wrapper:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +@media screen and (max-width: 767px) { + .dataTables_wrapper .dataTables_info, + .dataTables_wrapper .dataTables_paginate { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_paginate { + margin-top: 0.5em; + } +} +@media screen and (max-width: 640px) { + .dataTables_wrapper .dataTables_length, + .dataTables_wrapper .dataTables_filter { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_filter { + margin-top: 0.5em; + } +} +table.dataTable thead th div.DataTables_sort_wrapper { + position: relative; +} +table.dataTable thead th div.DataTables_sort_wrapper span { + position: absolute; + top: 50%; + margin-top: -8px; + right: -18px; +} +table.dataTable thead th.ui-state-default, +table.dataTable tfoot th.ui-state-default { + border-left-width: 0; +} +table.dataTable thead th.ui-state-default:first-child, +table.dataTable tfoot th.ui-state-default:first-child { + border-left-width: 1px; +} + +/* + * Control feature layout + */ +.dataTables_wrapper .dataTables_paginate .fg-button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + border: 1px solid transparent; +} +.dataTables_wrapper .dataTables_paginate .fg-button:active { + outline: none; +} +.dataTables_wrapper .dataTables_paginate .fg-button:first-child { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.dataTables_wrapper .dataTables_paginate .fg-button:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.dataTables_wrapper .ui-widget-header { + font-weight: normal; +} +.dataTables_wrapper .ui-toolbar { + padding: 8px; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: none; +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: inherit; +} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.min.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.min.css new file mode 100644 index 0000000..4e99c26 --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.jqueryui.min.css @@ -0,0 +1 @@ +table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px}table.dataTable tbody tr{background-color:#ffffff}table.dataTable tbody tr.selected{background-color:#B0BED9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:0.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:0.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:0.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(100%, #dcdcdc));background:-webkit-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-moz-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-ms-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-o-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:linear-gradient(to bottom, #fff 0%, #dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));background:-webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:0.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:0.5em}}table.dataTable thead th div.DataTables_sort_wrapper{position:relative}table.dataTable thead th div.DataTables_sort_wrapper span{position:absolute;top:50%;margin-top:-8px;right:-18px}table.dataTable thead th.ui-state-default,table.dataTable tfoot th.ui-state-default{border-left-width:0}table.dataTable thead th.ui-state-default:first-child,table.dataTable tfoot th.ui-state-default:first-child{border-left-width:1px}.dataTables_wrapper .dataTables_paginate .fg-button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;border:1px solid transparent}.dataTables_wrapper .dataTables_paginate .fg-button:active{outline:none}.dataTables_wrapper .dataTables_paginate .fg-button:first-child{border-top-left-radius:3px;border-bottom-left-radius:3px}.dataTables_wrapper .dataTables_paginate .fg-button:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}.dataTables_wrapper .ui-widget-header{font-weight:normal}.dataTables_wrapper .ui-toolbar{padding:8px}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:none}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:inherit} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.css new file mode 100644 index 0000000..077db2a --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.css @@ -0,0 +1,102 @@ +/* + * Styling for DataTables with Semantic UI + */ +table.dataTable.table { + margin: 0; +} +table.dataTable.table thead th, +table.dataTable.table thead td { + position: relative; +} +table.dataTable.table thead th.sorting, table.dataTable.table thead th.sorting_asc, table.dataTable.table thead th.sorting_desc, +table.dataTable.table thead td.sorting, +table.dataTable.table thead td.sorting_asc, +table.dataTable.table thead td.sorting_desc { + padding-right: 20px; +} +table.dataTable.table thead th.sorting:after, table.dataTable.table thead th.sorting_asc:after, table.dataTable.table thead th.sorting_desc:after, +table.dataTable.table thead td.sorting:after, +table.dataTable.table thead td.sorting_asc:after, +table.dataTable.table thead td.sorting_desc:after { + position: absolute; + top: 12px; + right: 8px; + display: block; + font-family: Icons; +} +table.dataTable.table thead th.sorting:after, +table.dataTable.table thead td.sorting:after { + content: "\f0dc"; + color: #ddd; + font-size: 0.8em; +} +table.dataTable.table thead th.sorting_asc:after, +table.dataTable.table thead td.sorting_asc:after { + content: "\f0de"; +} +table.dataTable.table thead th.sorting_desc:after, +table.dataTable.table thead td.sorting_desc:after { + content: "\f0dd"; +} +table.dataTable.table td, +table.dataTable.table th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable.table td.dataTables_empty, +table.dataTable.table th.dataTables_empty { + text-align: center; +} +table.dataTable.table.nowrap th, +table.dataTable.table.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length select { + vertical-align: middle; + min-height: 2.7142em; +} +div.dataTables_wrapper div.dataTables_length .ui.selection.dropdown { + min-width: 0; +} +div.dataTables_wrapper div.dataTables_filter span.input { + margin-left: 0.5em; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 13px; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + text-align: center; +} +div.dataTables_wrapper div.row.dt-table { + padding: 0; +} +div.dataTables_wrapper div.dataTables_scrollHead table.dataTable { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + border-bottom: none; +} +div.dataTables_wrapper div.dataTables_scrollBody thead .sorting:after, +div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_asc:after, +div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_desc:after { + display: none; +} +div.dataTables_wrapper div.dataTables_scrollBody table.dataTable { + border-radius: 0; + border-top: none; + border-bottom-width: 0; +} +div.dataTables_wrapper div.dataTables_scrollBody table.dataTable.no-footer { + border-bottom-width: 1px; +} +div.dataTables_wrapper div.dataTables_scrollFoot table.dataTable { + border-top-right-radius: 0; + border-top-left-radius: 0; + border-top: none; +} diff --git a/src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.min.css b/src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.min.css new file mode 100644 index 0000000..fcffe0c --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/dataTables.semanticui.min.css @@ -0,0 +1 @@ +table.dataTable.table{margin:0}table.dataTable.table thead th,table.dataTable.table thead td{position:relative}table.dataTable.table thead th.sorting,table.dataTable.table thead th.sorting_asc,table.dataTable.table thead th.sorting_desc,table.dataTable.table thead td.sorting,table.dataTable.table thead td.sorting_asc,table.dataTable.table thead td.sorting_desc{padding-right:20px}table.dataTable.table thead th.sorting:after,table.dataTable.table thead th.sorting_asc:after,table.dataTable.table thead th.sorting_desc:after,table.dataTable.table thead td.sorting:after,table.dataTable.table thead td.sorting_asc:after,table.dataTable.table thead td.sorting_desc:after{position:absolute;top:12px;right:8px;display:block;font-family:Icons}table.dataTable.table thead th.sorting:after,table.dataTable.table thead td.sorting:after{content:"\f0dc";color:#ddd;font-size:0.8em}table.dataTable.table thead th.sorting_asc:after,table.dataTable.table thead td.sorting_asc:after{content:"\f0de"}table.dataTable.table thead th.sorting_desc:after,table.dataTable.table thead td.sorting_desc:after{content:"\f0dd"}table.dataTable.table td,table.dataTable.table th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable.table td.dataTables_empty,table.dataTable.table th.dataTables_empty{text-align:center}table.dataTable.table.nowrap th,table.dataTable.table.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{vertical-align:middle;min-height:2.7142em}div.dataTables_wrapper div.dataTables_length .ui.selection.dropdown{min-width:0}div.dataTables_wrapper div.dataTables_filter span.input{margin-left:0.5em}div.dataTables_wrapper div.dataTables_info{padding-top:13px;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;text-align:center}div.dataTables_wrapper div.row.dt-table{padding:0}div.dataTables_wrapper div.dataTables_scrollHead table.dataTable{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:none}div.dataTables_wrapper div.dataTables_scrollBody thead .sorting:after,div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_asc:after,div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_desc:after{display:none}div.dataTables_wrapper div.dataTables_scrollBody table.dataTable{border-radius:0;border-top:none;border-bottom-width:0}div.dataTables_wrapper div.dataTables_scrollBody table.dataTable.no-footer{border-bottom-width:1px}div.dataTables_wrapper div.dataTables_scrollFoot table.dataTable{border-top-right-radius:0;border-top-left-radius:0;border-top:none} diff --git a/src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.css b/src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.css new file mode 100644 index 0000000..760eccb --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.css @@ -0,0 +1,448 @@ +/* + * Table styles + */ +table.dataTable { + width: 100%; + margin: 0 auto; + clear: both; + border-collapse: separate; + border-spacing: 0; + /* + * Header and footer styles + */ + /* + * Body styles + */ +} +table.dataTable thead th, +table.dataTable tfoot th { + font-weight: bold; +} +table.dataTable thead th, +table.dataTable thead td { + padding: 10px 18px; + border-bottom: 1px solid #111; +} +table.dataTable thead th:active, +table.dataTable thead td:active { + outline: none; +} +table.dataTable tfoot th, +table.dataTable tfoot td { + padding: 10px 18px 6px 18px; + border-top: 1px solid #111; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + *cursor: hand; + background-repeat: no-repeat; + background-position: center right; +} +table.dataTable thead .sorting { + background-image: url("../images/sort_both.png"); +} +table.dataTable thead .sorting_asc { + background-image: url("../images/sort_asc.png"); +} +table.dataTable thead .sorting_desc { + background-image: url("../images/sort_desc.png"); +} +table.dataTable thead .sorting_asc_disabled { + background-image: url("../images/sort_asc_disabled.png"); +} +table.dataTable thead .sorting_desc_disabled { + background-image: url("../images/sort_desc_disabled.png"); +} +table.dataTable tbody tr { + background-color: #ffffff; +} +table.dataTable tbody tr.selected { + background-color: #B0BED9; +} +table.dataTable tbody th, +table.dataTable tbody td { + padding: 8px 10px; +} +table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { + border-top: 1px solid #ddd; +} +table.dataTable.row-border tbody tr:first-child th, +table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th, +table.dataTable.display tbody tr:first-child td { + border-top: none; +} +table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { + border-top: 1px solid #ddd; + border-right: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr th:first-child, +table.dataTable.cell-border tbody tr td:first-child { + border-left: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr:first-child th, +table.dataTable.cell-border tbody tr:first-child td { + border-top: none; +} +table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd { + background-color: #f9f9f9; +} +table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected { + background-color: #acbad4; +} +table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover { + background-color: #f6f6f6; +} +table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected { + background-color: #aab7d1; +} +table.dataTable.order-column tbody tr > .sorting_1, +table.dataTable.order-column tbody tr > .sorting_2, +table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1, +table.dataTable.display tbody tr > .sorting_2, +table.dataTable.display tbody tr > .sorting_3 { + background-color: #fafafa; +} +table.dataTable.order-column tbody tr.selected > .sorting_1, +table.dataTable.order-column tbody tr.selected > .sorting_2, +table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1, +table.dataTable.display tbody tr.selected > .sorting_2, +table.dataTable.display tbody tr.selected > .sorting_3 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 { + background-color: #f1f1f1; +} +table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 { + background-color: #f3f3f3; +} +table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 { + background-color: whitesmoke; +} +table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 { + background-color: #a6b4cd; +} +table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 { + background-color: #a8b5cf; +} +table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 { + background-color: #a9b7d1; +} +table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 { + background-color: #fafafa; +} +table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 { + background-color: #fcfcfc; +} +table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 { + background-color: #fefefe; +} +table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 { + background-color: #aebcd6; +} +table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 { + background-color: #afbdd8; +} +table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 { + background-color: #eaeaea; +} +table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 { + background-color: #ececec; +} +table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 { + background-color: #efefef; +} +table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 { + background-color: #a2aec7; +} +table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 { + background-color: #a3b0c9; +} +table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 { + background-color: #a5b2cb; +} +table.dataTable.no-footer { + border-bottom: 1px solid #111; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} +table.dataTable.compact thead th, +table.dataTable.compact thead td { + padding: 4px 17px 4px 4px; +} +table.dataTable.compact tfoot th, +table.dataTable.compact tfoot td { + padding: 4px; +} +table.dataTable.compact tbody th, +table.dataTable.compact tbody td { + padding: 4px; +} +table.dataTable th.dt-left, +table.dataTable td.dt-left { + text-align: left; +} +table.dataTable th.dt-center, +table.dataTable td.dt-center, +table.dataTable td.dataTables_empty { + text-align: center; +} +table.dataTable th.dt-right, +table.dataTable td.dt-right { + text-align: right; +} +table.dataTable th.dt-justify, +table.dataTable td.dt-justify { + text-align: justify; +} +table.dataTable th.dt-nowrap, +table.dataTable td.dt-nowrap { + white-space: nowrap; +} +table.dataTable thead th.dt-head-left, +table.dataTable thead td.dt-head-left, +table.dataTable tfoot th.dt-head-left, +table.dataTable tfoot td.dt-head-left { + text-align: left; +} +table.dataTable thead th.dt-head-center, +table.dataTable thead td.dt-head-center, +table.dataTable tfoot th.dt-head-center, +table.dataTable tfoot td.dt-head-center { + text-align: center; +} +table.dataTable thead th.dt-head-right, +table.dataTable thead td.dt-head-right, +table.dataTable tfoot th.dt-head-right, +table.dataTable tfoot td.dt-head-right { + text-align: right; +} +table.dataTable thead th.dt-head-justify, +table.dataTable thead td.dt-head-justify, +table.dataTable tfoot th.dt-head-justify, +table.dataTable tfoot td.dt-head-justify { + text-align: justify; +} +table.dataTable thead th.dt-head-nowrap, +table.dataTable thead td.dt-head-nowrap, +table.dataTable tfoot th.dt-head-nowrap, +table.dataTable tfoot td.dt-head-nowrap { + white-space: nowrap; +} +table.dataTable tbody th.dt-body-left, +table.dataTable tbody td.dt-body-left { + text-align: left; +} +table.dataTable tbody th.dt-body-center, +table.dataTable tbody td.dt-body-center { + text-align: center; +} +table.dataTable tbody th.dt-body-right, +table.dataTable tbody td.dt-body-right { + text-align: right; +} +table.dataTable tbody th.dt-body-justify, +table.dataTable tbody td.dt-body-justify { + text-align: justify; +} +table.dataTable tbody th.dt-body-nowrap, +table.dataTable tbody td.dt-body-nowrap { + white-space: nowrap; +} + +table.dataTable, +table.dataTable th, +table.dataTable td { + box-sizing: content-box; +} + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; + *zoom: 1; + zoom: 1; +} +.dataTables_wrapper .dataTables_length { + float: left; +} +.dataTables_wrapper .dataTables_filter { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_filter input { + margin-left: 0.5em; +} +.dataTables_wrapper .dataTables_info { + clear: both; + float: left; + padding-top: 0.755em; +} +.dataTables_wrapper .dataTables_paginate { + float: right; + text-align: right; + padding-top: 0.25em; +} +.dataTables_wrapper .dataTables_paginate .paginate_button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em 1em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + color: #333 !important; + border: 1px solid transparent; + border-radius: 2px; +} +.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { + color: #333 !important; + border: 1px solid #979797; + background-color: white; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%); + /* IE10+ */ + background: -o-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, white 0%, #dcdcdc 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active { + cursor: default; + color: #666 !important; + border: 1px solid transparent; + background: transparent; + box-shadow: none; +} +.dataTables_wrapper .dataTables_paginate .paginate_button:hover { + color: white !important; + border: 1px solid #111; + background-color: #585858; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #585858 0%, #111 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #585858 0%, #111 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #585858 0%, #111 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #585858 0%, #111 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #585858 0%, #111 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button:active { + outline: none; + background-color: #2b2b2b; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%); + /* W3C */ + box-shadow: inset 0 0 3px #111; +} +.dataTables_wrapper .dataTables_paginate .ellipsis { + padding: 0 1em; +} +.dataTables_wrapper .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + text-align: center; + font-size: 1.2em; + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0))); + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: #333; +} +.dataTables_wrapper .dataTables_scroll { + clear: both; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td { + vertical-align: middle; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing { + height: 0; + overflow: hidden; + margin: 0 !important; + padding: 0 !important; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: 1px solid #111; +} +.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable, +.dataTables_wrapper.no-footer div.dataTables_scrollBody > table { + border-bottom: none; +} +.dataTables_wrapper:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +@media screen and (max-width: 767px) { + .dataTables_wrapper .dataTables_info, + .dataTables_wrapper .dataTables_paginate { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_paginate { + margin-top: 0.5em; + } +} +@media screen and (max-width: 640px) { + .dataTables_wrapper .dataTables_length, + .dataTables_wrapper .dataTables_filter { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_filter { + margin-top: 0.5em; + } +} diff --git a/src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.min.css b/src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.min.css new file mode 100644 index 0000000..6565b40 --- /dev/null +++ b/src/main/resources/static/DataTables-1.10.20/css/jquery.dataTables.min.css @@ -0,0 +1 @@ +table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px;border-bottom:1px solid #111}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px;border-top:1px solid #111}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;*cursor:hand;background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("../images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("../images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("../images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("../images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("../images/sort_desc_disabled.png")}table.dataTable tbody tr{background-color:#ffffff}table.dataTable tbody tr.selected{background-color:#B0BED9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:0.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:0.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:0.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(100%, #dcdcdc));background:-webkit-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-moz-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-ms-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-o-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:linear-gradient(to bottom, #fff 0%, #dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));background:-webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:0.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:0.5em}} diff --git a/src/main/resources/static/DataTables-1.10.20/images/sort_asc.png b/src/main/resources/static/DataTables-1.10.20/images/sort_asc.png new file mode 100644 index 0000000000000000000000000000000000000000..e1ba61a8055fcb18273f2468d335572204667b1f GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3I*bWaz@5R22v2@;zYta_*?F5u6Q zWR@in#&u+WgT?Hi<}D3B3}GOXuX|8Oj3tosHiJ3*4TN zC7>_x-r1O=t(?KoTC+`+>7&2GzdqLHBg&F)2Q?&EGZ+}|Rpsc~9`m>jw35No)z4*} HQ$iB}HK{Sd literal 0 HcmV?d00001 diff --git a/src/main/resources/static/DataTables-1.10.20/images/sort_asc_disabled.png b/src/main/resources/static/DataTables-1.10.20/images/sort_asc_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..fb11dfe24a6c564cb7ddf8bc96703ebb121df1e7 GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S0wixl{&NRX(Vi}jAsXkC6BcOhI9!^3NY?Do zDX;f`c1`y6n0RgO@$!H7chZT&|Jn0dmaqO^XNm-CGtk!Ur<_=Jws3;%W$<+Mb6Mw<&;$T1GdZXL literal 0 HcmV?d00001 diff --git a/src/main/resources/static/DataTables-1.10.20/images/sort_both.png b/src/main/resources/static/DataTables-1.10.20/images/sort_both.png new file mode 100644 index 0000000000000000000000000000000000000000..af5bc7c5a10b9d6d57cb641aeec752428a07f0ca GIT binary patch literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S0wixl{&NRX6FglULp08Bycxyy87-Q;~nRxO8@-UU*I^KVWyN+&SiMHu5xDOu|HNvwzODfTdXjhVyNu1 z#7^XbGKZ7LW3XeONb$RKLeE*WhqbYpIXPIqK@r4)v+qN8um%99%MPpS9d#7Ed7SL@Bp00i_>zopr0H-Zb Aj{pDw literal 0 HcmV?d00001 diff --git a/src/main/resources/static/DataTables-1.10.20/images/sort_desc.png b/src/main/resources/static/DataTables-1.10.20/images/sort_desc.png new file mode 100644 index 0000000000000000000000000000000000000000..0e156deb5f61d18f9e2ec5da4f6a8c94a5b4fb41 GIT binary patch literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3I*R8JSj5R22v2@yo z(czD9$NuDl3Ljm9c#_#4$vXUz=f1~&WY3aa=h!;z7fOEN>ySP9QA=6C-^Dmb&tuM= z4Z&=WZU;2WF>e%GI&mWJk^K!jrbro{W;-I>FeCfLGJl3}+Z^2)3Kw?+EoAU?^>bP0 Hl+XkKC^j|Q{b@g3TV7E(Grjn^aLC2o)_ptHrtUEoT$S@q)~)7U@V;W{6)!%@ u>N?4t-1qslpJw9!O?PJ&w0Cby<'col-sm-6'f>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-7'p>>", + renderer: 'bootstrap' +} ); + + +/* Default class modification */ +$.extend( DataTable.ext.classes, { + sWrapper: "dataTables_wrapper form-inline dt-bootstrap", + sFilterInput: "form-control input-sm", + sLengthSelect: "form-control input-sm", + sProcessing: "dataTables_processing panel panel-default" +} ); + + +/* Bootstrap paging button renderer */ +DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { + var api = new DataTable.Api( settings ); + var classes = settings.oClasses; + var lang = settings.oLanguage.oPaginate; + var aria = settings.oLanguage.oAria.paginate || {}; + var btnDisplay, btnClass, counter=0; + + var attach = function( container, buttons ) { + var i, ien, node, button; + var clickHandler = function ( e ) { + e.preventDefault(); + if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) { + api.page( e.data.action ).draw( 'page' ); + } + }; + + for ( i=0, ien=buttons.length ; i 0 ? + '' : ' disabled'); + break; + + case 'previous': + btnDisplay = lang.sPrevious; + btnClass = button + (page > 0 ? + '' : ' disabled'); + break; + + case 'next': + btnDisplay = lang.sNext; + btnClass = button + (page < pages-1 ? + '' : ' disabled'); + break; + + case 'last': + btnDisplay = lang.sLast; + btnClass = button + (page < pages-1 ? + '' : ' disabled'); + break; + + default: + btnDisplay = button + 1; + btnClass = page === button ? + 'active' : ''; + break; + } + + if ( btnDisplay ) { + node = $('
  • ', { + 'class': classes.sPageButton+' '+btnClass, + 'id': idx === 0 && typeof button === 'string' ? + settings.sTableId +'_'+ button : + null + } ) + .append( $('', { + 'href': '#', + 'aria-controls': settings.sTableId, + 'aria-label': aria[ button ], + 'data-dt-idx': counter, + 'tabindex': settings.iTabIndex + } ) + .html( btnDisplay ) + ) + .appendTo( container ); + + settings.oApi._fnBindAction( + node, {action: button}, clickHandler + ); + + counter++; + } + } + } + }; + + // IE9 throws an 'unknown error' if document.activeElement is used + // inside an iframe or frame. + var activeEl; + + try { + // Because this approach is destroying and recreating the paging + // elements, focus is lost on the select button which is bad for + // accessibility. So we want to restore focus once the draw has + // completed + activeEl = $(host).find(document.activeElement).data('dt-idx'); + } + catch (e) {} + + attach( + $(host).empty().html('