├── .gitignore ├── .idea ├── .gitignore ├── dataSources.xml ├── encodings.xml ├── misc.xml ├── uiDesigner.xml └── vcs.xml ├── LICENSE ├── README.md ├── pom.xml └── src └── main ├── java └── lk │ └── ijse │ └── library_management │ ├── AdminAppInitializer.java │ ├── MemberAppInitializer.java │ ├── controller │ ├── admin │ │ ├── AdminGlobalFormController.java │ │ ├── AdminGlobalLoginFormController.java │ │ ├── AdminProfileFormController.java │ │ ├── BookAddFormController.java │ │ ├── BookBorrowManageFormController.java │ │ ├── BookBorrowManageRowFormController.java │ │ ├── BookBorrowViewFormController.java │ │ ├── BookBorrowViewRowFormController.java │ │ ├── BookManageFormController.java │ │ ├── BookManageRowFormController.java │ │ ├── BookUpdateFormController.java │ │ ├── BookViewFormController.java │ │ ├── BranchAddFormController.java │ │ ├── BranchManageFormController.java │ │ ├── BranchManageRowFormController.java │ │ ├── BranchUpdateFormController.java │ │ ├── BranchViewFormController.java │ │ ├── ChangeCredentialFormController.java │ │ ├── DashboardFormController.java │ │ ├── DeleteAdminFormController.java │ │ ├── ForgotPasswordFormController.java │ │ ├── MemberManageFormController.java │ │ ├── MemberManageRowFormController.java │ │ ├── MemberViewFormController.java │ │ ├── ResetPasswordFormController.java │ │ ├── SignInFormController.java │ │ ├── SignInVerifyOtpFormController.java │ │ ├── SignUpFormController.java │ │ ├── SignUpVerifyOtpFormController.java │ │ └── TransactionShortcutRowFormController.java │ └── member │ │ ├── BookBorrowAddFormController.java │ │ ├── BookBorrowAddRowFormController.java │ │ ├── BookBorrowManageFormController.java │ │ ├── BookBorrowManageRowFormController.java │ │ ├── BookBorrowViewFormController.java │ │ ├── BookBorrowViewRowFormController.java │ │ ├── BookManageFormController.java │ │ ├── BookManageRowFormController.java │ │ ├── BookViewFormController.java │ │ ├── BranchManageFormController.java │ │ ├── BranchManageRowFormController.java │ │ ├── BranchViewFormController.java │ │ ├── ChangeCredentialFormController.java │ │ ├── DashboardFormController.java │ │ ├── DeleteMemberFormController.java │ │ ├── ForgotPasswordFormController.java │ │ ├── MemberGlobalFormController.java │ │ ├── MemberGlobalLoginFormController.java │ │ ├── MemberProfileFormController.java │ │ ├── ResetPasswordFormController.java │ │ ├── SignInFormController.java │ │ ├── SignInVerifyOtpFormController.java │ │ ├── SignUpFormController.java │ │ ├── SignUpVerifyOtpFormController.java │ │ └── TransactionShortcutRowFormController.java │ ├── dto │ ├── AdminDto.java │ ├── BookDto.java │ ├── BranchDto.java │ ├── MemberDto.java │ ├── TransactionDetailsDto.java │ └── TransactionDto.java │ ├── embedded │ ├── NameIdentifier.java │ └── TransactionDetailPK.java │ ├── entity │ ├── Admin.java │ ├── Book.java │ ├── Branch.java │ ├── Member.java │ ├── Transaction.java │ └── TransactionDetails.java │ ├── projection │ ├── AdminTransactionProjection.java │ └── MemberTransactionProjection.java │ ├── repository │ ├── RepositoryFactory.java │ ├── SuperRepository.java │ └── custom │ │ ├── AdminRepository.java │ │ ├── BookRepository.java │ │ ├── BranchRepository.java │ │ ├── MemberRepository.java │ │ ├── TransactionDetailRepository.java │ │ ├── TransactionRepository.java │ │ └── impl │ │ ├── AdminRepositoryImpl.java │ │ ├── BookRepositoryImpl.java │ │ ├── BranchRepositoryImpl.java │ │ ├── MemberRepositoryImpl.java │ │ ├── TransactionDetailRepositoryImpl.java │ │ └── TransactionRepositoryImpl.java │ ├── service │ ├── ServiceFactory.java │ ├── SuperService.java │ └── custom │ │ ├── AdminProfileService.java │ │ ├── AdminSignInService.java │ │ ├── AdminSignUpService.java │ │ ├── BookService.java │ │ ├── BranchService.java │ │ ├── DashboardService.java │ │ ├── MemberProfileService.java │ │ ├── MemberService.java │ │ ├── MemberSignInService.java │ │ ├── MemberSignUpService.java │ │ ├── TransactionService.java │ │ └── impl │ │ ├── AdminProfileServiceImpl.java │ │ ├── AdminSignInServiceImpl.java │ │ ├── AdminSignUpServiceImpl.java │ │ ├── BookServiceImpl.java │ │ ├── BranchServiceImpl.java │ │ ├── DashboardServiceImpl.java │ │ ├── MemberProfileServiceImpl.java │ │ ├── MemberServiceImpl.java │ │ ├── MemberSignInServiceImpl.java │ │ ├── MemberSignUpServiceImpl.java │ │ └── TransactionServiceImpl.java │ └── util │ ├── CrudUtil.java │ ├── OTPGenerator.java │ ├── Regex.java │ ├── SendEmail.java │ ├── SessionFactoryConfig.java │ ├── Style.java │ ├── Utility.java │ └── navigation │ ├── AdminNavigation.java │ └── MemberNavigation.java ├── resources - Shortcut.lnk └── resources ├── assests ├── icon │ ├── add.png │ ├── book.png │ ├── book_color.png │ ├── book_shortcut.png │ ├── borrow.png │ ├── borrow_book_color.png │ ├── borrow_color.png │ ├── branch.png │ ├── branch_color.png │ ├── branch_shortcut.png │ ├── close.png │ ├── dashboard.png │ ├── dashboard_color.png │ ├── delete.png │ ├── due_transations.png │ ├── eye_close.png │ ├── eye_open.png │ ├── logout.png │ ├── logout_color.png │ ├── member.png │ ├── member_color.png │ ├── profile.png │ ├── profile_color.png │ ├── profile_shortcut.png │ ├── redo.png │ ├── return.png │ ├── returned_transaction.png │ ├── update.png │ ├── view.png │ └── waving_hand.png └── img │ ├── dashboard_book.png │ ├── dashbord_book 1.png │ ├── grey_background.png │ ├── login_background.png │ └── logo.png ├── email ├── ChangePasswordEmail.html ├── DeleteUserEmail.html ├── ForgotPasswordEmail.html └── SignUpEmail.html ├── hibernate.properties └── view ├── admin ├── AdminGlobalForm.fxml ├── AdminGlobalLoginForm.fxml ├── AdminProfileForm.fxml ├── BookAddForm.fxml ├── BookBorrowManageForm.fxml ├── BookBorrowManageRowForm.fxml ├── BookBorrowViewForm.fxml ├── BookBorrowViewRowForm.fxml ├── BookManageForm.fxml ├── BookManageRowForm.fxml ├── BookUpdateForm.fxml ├── BookViewForm.fxml ├── BranchAddForm.fxml ├── BranchManageForm.fxml ├── BranchManageRowForm.fxml ├── BranchUpdateForm.fxml ├── BranchViewForm.fxml ├── ChangeCredentialForm.fxml ├── DashboardForm.fxml ├── DeleteAdminForm.fxml ├── FrogotPasswordForm.fxml ├── MemberManageForm.fxml ├── MemberManageRowForm.fxml ├── MemberViewForm.fxml ├── ResetPasswordForm.fxml ├── SignInForm.fxml ├── SignInVerifyOtpForm.fxml ├── SignUpForm.fxml ├── SignUpVerifyOtpForm.fxml └── TransactionShortcutRowForm.fxml └── member ├── BookBorrowAddForm.fxml ├── BookBorrowAddRowForm.fxml ├── BookBorrowManageForm.fxml ├── BookBorrowManageRowForm.fxml ├── BookBorrowViewForm.fxml ├── BookBorrowViewRowForm.fxml ├── BookManageForm.fxml ├── BookManageRowForm.fxml ├── BookViewForm.fxml ├── BranchManageForm.fxml ├── BranchManageRowForm.fxml ├── BranchViewForm.fxml ├── ChangeCredentialForm.fxml ├── DashboardForm.fxml ├── DeleteMemberForm.fxml ├── FrogotPasswordForm.fxml ├── MemberGlobalForm.fxml ├── MemberGlobalLoginForm.fxml ├── MemberProfileForm.fxml ├── ResetPasswordForm.fxml ├── SignInForm.fxml ├── SignInVerifyOtpForm.fxml ├── SignUpForm.fxml ├── SignUpVerifyOtpForm.fxml └── TransactionShortcutRowForm.fxml /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql.8 6 | true 7 | com.mysql.cj.jdbc.Driver 8 | jdbc:mysql://localhost:3306/BookWorm 9 | 10 | 11 | 12 | 13 | 14 | $ProjectFileDir$ 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Janindu Lokitha 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | lk.ijse 8 | library-management-system 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 11 13 | 11 14 | UTF-8 15 | 16 | 17 | 18 | 19 | org.openjfx 20 | javafx-controls 21 | 19.0.2.1 22 | 23 | 24 | org.openjfx 25 | javafx-fxml 26 | 19.0.2.1 27 | 28 | 29 | 30 | org.hibernate 31 | hibernate-core 32 | 5.6.5.Final 33 | 34 | 35 | mysql 36 | mysql-connector-java 37 | 8.0.33 38 | 39 | 40 | 41 | org.projectlombok 42 | lombok 43 | 1.18.30 44 | provided 45 | 46 | 47 | com.jfoenix 48 | jfoenix 49 | 9.0.10 50 | 51 | 52 | javax.mail 53 | javax.mail-api 54 | 1.6.2 55 | 56 | 57 | org.apache.xmlgraphics 58 | batik-bridge 59 | 1.14 60 | 61 | 62 | org.controlsfx 63 | controlsfx 64 | 11.1.0 65 | 66 | 67 | commons-io 68 | commons-io 69 | 2.11.0 70 | 71 | 72 | com.sun.mail 73 | javax.mail 74 | 1.6.2 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/AdminAppInitializer.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management; 2 | 3 | import javafx.application.Application; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Scene; 6 | import javafx.scene.layout.AnchorPane; 7 | import javafx.stage.Stage; 8 | import javafx.stage.StageStyle; 9 | import lk.ijse.library_management.controller.admin.AdminGlobalLoginFormController; 10 | 11 | public class AdminAppInitializer extends Application { 12 | public static void main(String[] args) { 13 | launch(args); 14 | } 15 | 16 | @Override 17 | public void start(Stage stage) throws Exception { 18 | AnchorPane root = FXMLLoader.load(getClass().getResource("/view/admin/AdminGlobalLoginForm.fxml")); 19 | AdminGlobalLoginFormController.stage = stage; 20 | stage.setScene(new Scene(root)); 21 | stage.initStyle(StageStyle.UNDECORATED); 22 | stage.centerOnScreen(); 23 | stage.show(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/MemberAppInitializer.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management; 2 | 3 | import javafx.application.Application; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Scene; 6 | import javafx.scene.layout.AnchorPane; 7 | import javafx.stage.Stage; 8 | import javafx.stage.StageStyle; 9 | import lk.ijse.library_management.controller.member.MemberGlobalLoginFormController; 10 | 11 | public class MemberAppInitializer extends Application { 12 | public static void main(String[] args) { 13 | launch(args); 14 | } 15 | 16 | @Override 17 | public void start(Stage stage) throws Exception { 18 | AnchorPane root = FXMLLoader.load(getClass().getResource("/view/member/MemberGlobalLoginForm.fxml")); 19 | MemberGlobalLoginFormController.stage = stage; 20 | stage.setScene(new Scene(root)); 21 | stage.initStyle(StageStyle.UNDECORATED); 22 | stage.centerOnScreen(); 23 | stage.show(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/AdminGlobalLoginFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.fxml.Initializable; 5 | import javafx.scene.layout.AnchorPane; 6 | import javafx.stage.Stage; 7 | import lk.ijse.library_management.util.navigation.AdminNavigation; 8 | 9 | import java.io.IOException; 10 | import java.net.URL; 11 | import java.util.ResourceBundle; 12 | 13 | public class AdminGlobalLoginFormController implements Initializable { 14 | 15 | public static Stage stage; 16 | 17 | @FXML 18 | public AnchorPane loginPane; 19 | 20 | public static AdminGlobalLoginFormController controller; 21 | 22 | public AdminGlobalLoginFormController() { 23 | controller = this; 24 | } 25 | 26 | public static AdminGlobalLoginFormController getInstance() { 27 | return controller; 28 | } 29 | 30 | @Override 31 | public void initialize(URL url, ResourceBundle resourceBundle) { 32 | try { 33 | AdminNavigation.switchLoginPage("SignInForm.fxml"); 34 | } catch (IOException e) { 35 | e.printStackTrace (); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/AdminProfileFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.image.ImageView; 9 | import javafx.scene.input.MouseEvent; 10 | import lk.ijse.library_management.dto.AdminDto; 11 | import lk.ijse.library_management.service.ServiceFactory; 12 | import lk.ijse.library_management.service.custom.AdminProfileService; 13 | import lk.ijse.library_management.service.custom.impl.AdminProfileServiceImpl; 14 | import lk.ijse.library_management.util.navigation.AdminNavigation; 15 | 16 | import java.io.IOException; 17 | import java.net.URL; 18 | import java.util.ResourceBundle; 19 | 20 | public class AdminProfileFormController implements Initializable { 21 | 22 | @FXML 23 | private JFXButton btnDelete; 24 | 25 | @FXML 26 | private JFXButton btnReset; 27 | 28 | @FXML 29 | private Label lblUserName; 30 | 31 | @FXML 32 | private Label lblName; 33 | 34 | @FXML 35 | private Label lblEmail; 36 | 37 | @FXML 38 | private Label lblAdminId; 39 | 40 | @FXML 41 | private ImageView imgClose; 42 | 43 | @FXML 44 | private Label lblMobile; 45 | 46 | private final AdminProfileService profileService = 47 | (AdminProfileServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.ADMINPROFILE); 48 | 49 | @FXML 50 | void btnDeleteOnAction(ActionEvent event) { 51 | try { 52 | AdminNavigation.closePane(); 53 | AdminNavigation.popupPane("DeleteAdminForm.fxml"); 54 | } catch (IOException e) { 55 | e.printStackTrace(); 56 | } 57 | } 58 | 59 | @FXML 60 | void btnDeleteOnMouseEntered(MouseEvent event) { 61 | 62 | } 63 | 64 | @FXML 65 | void btnDeleteOnMouseExited(MouseEvent event) { 66 | 67 | } 68 | 69 | @FXML 70 | void btnResetOnAction(ActionEvent event) { 71 | try { 72 | AdminNavigation.closePane(); 73 | AdminNavigation.popupPane("ChangeCredentialForm.fxml"); 74 | } catch (IOException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | 79 | @FXML 80 | void btnResetOnMouseEntered(MouseEvent event) { 81 | 82 | } 83 | 84 | @FXML 85 | void btnResetOnMouseExited(MouseEvent event) { 86 | 87 | } 88 | 89 | @FXML 90 | void imgCloseOnMouseClicked(MouseEvent event) { 91 | AdminNavigation.closePane(); 92 | } 93 | 94 | @FXML 95 | void imgCloseOnMouseEntered(MouseEvent event) { 96 | 97 | } 98 | 99 | @FXML 100 | void imgCloseOnMouseExited(MouseEvent event) { 101 | 102 | } 103 | 104 | private void setData() { 105 | int id = profileService.getIdFromUsername(AdminGlobalFormController.username); 106 | AdminDto dto = profileService.getAdminData(id); 107 | 108 | lblAdminId.setText(String.valueOf(dto.getId())); 109 | lblName.setText(dto.getFName() + " " + dto.getLName()); 110 | lblUserName.setText(dto.getUsername()); 111 | lblMobile.setText(dto.getMobile()); 112 | lblEmail.setText(dto.getEmail()); 113 | } 114 | 115 | @Override 116 | public void initialize(URL url, ResourceBundle resourceBundle) { 117 | setData(); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/BookBorrowViewRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.Label; 5 | import lk.ijse.library_management.dto.BookDto; 6 | 7 | public class BookBorrowViewRowFormController { 8 | 9 | @FXML 10 | private Label lblBookId; 11 | 12 | @FXML 13 | private Label lblTitle; 14 | 15 | @FXML 16 | private Label lblAuthor; 17 | 18 | @FXML 19 | private Label lblGenre; 20 | 21 | public void setData(BookDto dto) { 22 | lblBookId.setText(String.valueOf(dto.getId())); 23 | lblTitle.setText(dto.getTitle()); 24 | lblAuthor.setText(dto.getAuthor()); 25 | lblGenre.setText(dto.getGenre()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/BookViewFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.BookDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.BookService; 12 | import lk.ijse.library_management.service.custom.impl.BookServiceImpl; 13 | import lk.ijse.library_management.util.navigation.AdminNavigation; 14 | 15 | import java.net.URL; 16 | import java.util.ResourceBundle; 17 | 18 | public class BookViewFormController implements Initializable { 19 | 20 | @FXML 21 | private JFXButton btnCancel; 22 | 23 | @FXML 24 | private Label lblId; 25 | 26 | @FXML 27 | private Label lblTitle; 28 | 29 | @FXML 30 | private Label lblAuthor; 31 | 32 | @FXML 33 | private Label lblGenre; 34 | 35 | @FXML 36 | private Label lblAvailability; 37 | 38 | public static int id; 39 | 40 | private final BookService bookService = 41 | (BookServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BOOK); 42 | 43 | @FXML 44 | void btnCancelOnAction(ActionEvent event) { 45 | AdminNavigation.closePane(); 46 | } 47 | 48 | @FXML 49 | void btnCancelOnMouseEntered(MouseEvent event) { 50 | 51 | } 52 | 53 | @FXML 54 | void btnCancelOnMouseExited(MouseEvent event) { 55 | 56 | } 57 | 58 | public void setData() { 59 | BookDto dto = bookService.getBookData(id); 60 | 61 | if (dto.getAvailability().equals("Removed")) throw new RuntimeException(); 62 | 63 | lblId.setText(String.valueOf(dto.getId())); 64 | lblTitle.setText(dto.getTitle()); 65 | lblAuthor.setText(dto.getAuthor()); 66 | lblGenre.setText(dto.getGenre()); 67 | lblAvailability.setText(dto.getAvailability()); 68 | } 69 | 70 | @Override 71 | public void initialize(URL url, ResourceBundle resourceBundle) { 72 | try { 73 | setData(); 74 | } catch (Exception e) { 75 | AdminNavigation.closePane(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/BranchManageRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.Alert; 5 | import javafx.scene.control.ButtonType; 6 | import javafx.scene.control.Label; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.BranchDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.BranchService; 12 | import lk.ijse.library_management.service.custom.impl.BranchServiceImpl; 13 | import lk.ijse.library_management.util.navigation.AdminNavigation; 14 | 15 | import java.io.IOException; 16 | import java.sql.SQLException; 17 | 18 | public class BranchManageRowFormController { 19 | 20 | @FXML 21 | private Label lblId; 22 | 23 | @FXML 24 | private Label lblName; 25 | 26 | @FXML 27 | private Label lblMobile; 28 | 29 | @FXML 30 | private Label lblEmail; 31 | 32 | @FXML 33 | private ImageView imgView; 34 | 35 | @FXML 36 | private ImageView imgUpdate; 37 | 38 | @FXML 39 | private ImageView imgDelete; 40 | 41 | private final BranchService branchService = 42 | (BranchServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BRANCH); 43 | 44 | @FXML 45 | void imgDeleteOnMouseClicked(MouseEvent event) { 46 | Alert alert = new Alert(Alert.AlertType.CONFIRMATION); 47 | alert.setHeaderText("Delete Branch"); 48 | alert.setContentText("Are you sure you want to delete this branch?"); 49 | 50 | ButtonType result = alert.showAndWait().orElse(ButtonType.CANCEL); 51 | 52 | if (result == ButtonType.OK) { 53 | branchService.deleteBranch(Integer.parseInt(lblId.getText())); 54 | BranchManageFormController.controller.getAllData(); 55 | } 56 | } 57 | 58 | @FXML 59 | void imgDeleteOnMouseEntered(MouseEvent event) { 60 | 61 | } 62 | 63 | @FXML 64 | void imgDeleteOnMouseExited(MouseEvent event) { 65 | 66 | } 67 | 68 | @FXML 69 | void imgUpdateOnMouseClicked(MouseEvent event) { 70 | try { 71 | BranchUpdateFormController.id = Integer.parseInt(lblId.getText()); 72 | AdminNavigation.popupPane("BranchUpdateForm.fxml"); 73 | } catch (IOException e) { 74 | e.printStackTrace(); 75 | } 76 | } 77 | 78 | @FXML 79 | void imgUpdateOnMouseEntered(MouseEvent event) { 80 | 81 | } 82 | 83 | @FXML 84 | void imgUpdateOnMouseExited(MouseEvent event) { 85 | 86 | } 87 | 88 | @FXML 89 | void imgViewOnMouseClicked(MouseEvent event) { 90 | try { 91 | BranchViewFormController.id = Integer.parseInt(lblId.getText()); 92 | AdminNavigation.popupPane("BranchViewForm.fxml"); 93 | } catch (IOException e) { 94 | e.printStackTrace(); 95 | } 96 | } 97 | 98 | @FXML 99 | void imgViewOnMouseEntered(MouseEvent event) { 100 | 101 | } 102 | 103 | @FXML 104 | void imgViewOnMouseExited(MouseEvent event) { 105 | 106 | } 107 | 108 | public void setData(BranchDto dto) { 109 | 110 | lblId.setText(String.valueOf(dto.getId())); 111 | lblName.setText(dto.getName()); 112 | lblMobile.setText(dto.getMobile()); 113 | lblEmail.setText(dto.getEmail()); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/BranchViewFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.BranchDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.BranchService; 12 | import lk.ijse.library_management.service.custom.impl.BranchServiceImpl; 13 | import lk.ijse.library_management.util.navigation.AdminNavigation; 14 | 15 | import java.net.URL; 16 | import java.util.ResourceBundle; 17 | 18 | public class BranchViewFormController implements Initializable { 19 | 20 | @FXML 21 | private JFXButton btnCancel; 22 | 23 | @FXML 24 | private Label lblBranchId; 25 | 26 | @FXML 27 | private Label lblBranchName; 28 | 29 | @FXML 30 | private Label lblBranchMobile; 31 | 32 | @FXML 33 | private Label lblBranchEmail; 34 | 35 | @FXML 36 | private Label lblBranchAddress; 37 | 38 | public static int id; 39 | 40 | private final BranchService branchService = 41 | (BranchServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BRANCH); 42 | 43 | @FXML 44 | void btnCancelOnAction(ActionEvent event) { 45 | AdminNavigation.closePane(); 46 | } 47 | 48 | @FXML 49 | void btnCancelOnMouseEntered(MouseEvent event) { 50 | 51 | } 52 | 53 | @FXML 54 | void btnCancelOnMouseExited(MouseEvent event) { 55 | 56 | } 57 | 58 | public void setData() { 59 | BranchDto dto = branchService.getBranchData(id); 60 | 61 | lblBranchId.setText(String.valueOf(dto.getId())); 62 | lblBranchName.setText(dto.getName()); 63 | lblBranchAddress.setText(dto.getLocation()); 64 | lblBranchMobile.setText(dto.getMobile()); 65 | lblBranchEmail.setText(dto.getEmail()); 66 | } 67 | 68 | @Override 69 | public void initialize(URL url, ResourceBundle resourceBundle) { 70 | setData(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/DeleteAdminFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import com.jfoenix.controls.JFXTextField; 5 | import javafx.event.ActionEvent; 6 | import javafx.fxml.FXML; 7 | import javafx.fxml.Initializable; 8 | import javafx.scene.control.Label; 9 | import javafx.scene.input.MouseEvent; 10 | import lk.ijse.library_management.dto.AdminDto; 11 | import lk.ijse.library_management.service.ServiceFactory; 12 | import lk.ijse.library_management.service.custom.AdminProfileService; 13 | import lk.ijse.library_management.service.custom.impl.AdminProfileServiceImpl; 14 | import lk.ijse.library_management.util.Regex; 15 | import lk.ijse.library_management.util.navigation.AdminNavigation; 16 | 17 | import java.io.IOException; 18 | import java.net.URL; 19 | import java.util.ResourceBundle; 20 | 21 | public class DeleteAdminFormController implements Initializable { 22 | 23 | @FXML 24 | private JFXTextField txtPassword; 25 | 26 | @FXML 27 | private JFXButton btnCancel; 28 | 29 | @FXML 30 | private JFXButton btnDelete; 31 | 32 | @FXML 33 | private Label lblUserName; 34 | 35 | @FXML 36 | private Label lblOtp; 37 | 38 | private final AdminProfileService profileService = 39 | (AdminProfileServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.ADMINPROFILE); 40 | 41 | @FXML 42 | void btnDeleteOnAction(ActionEvent event) { 43 | 44 | if (validatePassword()) { 45 | int id = profileService.getIdFromUsernamePassword(lblUserName.getText(), txtPassword.getText()); 46 | 47 | if (id > 0) { 48 | 49 | AdminDto adminData = profileService.getAdminData(id); 50 | 51 | try { 52 | profileService.deleteAdmin(id); 53 | SignInFormController.stage.close(); 54 | AdminNavigation.switchNavigation("SignInForm.fxml", event); 55 | profileService.sendAccountDeletionEmail(adminData.getEmail()); 56 | } catch (IOException e) { 57 | e.printStackTrace(); 58 | } 59 | 60 | } 61 | } 62 | 63 | } 64 | 65 | @FXML 66 | void btnCancelOnAction(ActionEvent event) { 67 | AdminNavigation.closePane(); 68 | } 69 | 70 | @FXML 71 | void btnCancelOnMouseEntered(MouseEvent event) { 72 | 73 | } 74 | 75 | @FXML 76 | void btnCancelOnMouseExited(MouseEvent event) { 77 | 78 | } 79 | 80 | @FXML 81 | void btnDeleteOnMouseEntered(MouseEvent event) { 82 | 83 | } 84 | 85 | @FXML 86 | void btnDeleteOnMouseExited(MouseEvent event) { 87 | 88 | } 89 | 90 | @FXML 91 | void txtPasswordOnAction(ActionEvent event) { 92 | 93 | } 94 | 95 | @FXML 96 | void txtPasswordOnMouseClicked(MouseEvent event) { 97 | 98 | } 99 | 100 | public boolean validatePassword() { 101 | String password = txtPassword.getText(); 102 | 103 | if (Regex.password(password)) { 104 | lblOtp.setText("Password should contain at least 6 characters"); 105 | return false; 106 | } 107 | 108 | return true; 109 | } 110 | 111 | @Override 112 | public void initialize(URL url, ResourceBundle resourceBundle) { 113 | lblUserName.setText(AdminGlobalFormController.username); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/MemberManageRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.Alert; 5 | import javafx.scene.control.ButtonType; 6 | import javafx.scene.control.Label; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.MemberDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.MemberService; 12 | import lk.ijse.library_management.service.custom.impl.MemberServiceImpl; 13 | import lk.ijse.library_management.util.navigation.AdminNavigation; 14 | 15 | import java.io.IOException; 16 | 17 | public class MemberManageRowFormController { 18 | 19 | @FXML 20 | private Label lblId; 21 | 22 | @FXML 23 | private Label lblName; 24 | 25 | @FXML 26 | private Label lblMobile; 27 | 28 | @FXML 29 | private Label lblEmail; 30 | 31 | @FXML 32 | private ImageView imgView; 33 | 34 | @FXML 35 | private ImageView imgDelete; 36 | 37 | private final MemberService memberService = 38 | (MemberServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.MEMBER); 39 | 40 | @FXML 41 | void imgDeleteOnMouseClicked(MouseEvent event) { 42 | Alert alert = new Alert(Alert.AlertType.CONFIRMATION); 43 | alert.setHeaderText("Delete Member"); 44 | alert.setContentText("Are you sure you want to delete this member?"); 45 | 46 | ButtonType result = alert.showAndWait().orElse(ButtonType.CANCEL); 47 | 48 | if (result == ButtonType.OK) { 49 | memberService.deleteMember(Integer.parseInt(lblId.getText())); 50 | MemberManageFormController.controller.getAllData(); 51 | } 52 | } 53 | 54 | @FXML 55 | void imgDeleteOnMouseEntered(MouseEvent event) { 56 | 57 | } 58 | 59 | @FXML 60 | void imgDeleteOnMouseExited(MouseEvent event) { 61 | 62 | } 63 | 64 | @FXML 65 | void imgViewOnMouseClicked(MouseEvent event) { 66 | try { 67 | MemberViewFormController.id = Integer.parseInt(lblId.getText()); 68 | AdminNavigation.popupPane("MemberViewForm.fxml"); 69 | } catch (IOException e) { 70 | e.printStackTrace(); 71 | } 72 | } 73 | 74 | @FXML 75 | void imgViewOnMouseEntered(MouseEvent event) { 76 | 77 | } 78 | 79 | @FXML 80 | void imgViewOnMouseExited(MouseEvent event) { 81 | 82 | } 83 | 84 | public void setData(MemberDto dto) { 85 | lblId.setText(String.valueOf(dto.getId())); 86 | lblName.setText(dto.getName()); 87 | lblEmail.setText(dto.getEmail()); 88 | lblMobile.setText(dto.getMobile()); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/MemberViewFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.MemberDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.MemberService; 12 | import lk.ijse.library_management.service.custom.impl.MemberServiceImpl; 13 | import lk.ijse.library_management.util.navigation.AdminNavigation; 14 | 15 | import java.net.URL; 16 | import java.util.ResourceBundle; 17 | 18 | public class MemberViewFormController implements Initializable { 19 | 20 | @FXML 21 | public Label lblMemberUsername; 22 | 23 | @FXML 24 | private JFXButton btnCancel; 25 | 26 | @FXML 27 | private Label lblMemberId; 28 | 29 | @FXML 30 | private Label lblMemberName; 31 | 32 | @FXML 33 | private Label lblMemberMobile; 34 | 35 | @FXML 36 | private Label lblMemberEmail; 37 | 38 | public static int id; 39 | 40 | private final MemberService memberService = 41 | (MemberServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.MEMBER); 42 | 43 | @FXML 44 | void btnCancelOnAction(ActionEvent event) { 45 | AdminNavigation.closePane(); 46 | } 47 | 48 | @FXML 49 | void btnCancelOnMouseEntered(MouseEvent event) { 50 | 51 | } 52 | 53 | @FXML 54 | void btnCancelOnMouseExited(MouseEvent event) { 55 | 56 | } 57 | 58 | public void setData() { 59 | try { 60 | MemberDto dto = memberService.getMemberData(id); 61 | 62 | lblMemberId.setText(String.valueOf(dto.getId())); 63 | lblMemberUsername.setText(dto.getUsername()); 64 | lblMemberName.setText(dto.getName()); 65 | lblMemberMobile.setText(dto.getMobile()); 66 | lblMemberEmail.setText(dto.getEmail()); 67 | } catch (NumberFormatException e) { 68 | 69 | } 70 | } 71 | 72 | @Override 73 | public void initialize(URL url, ResourceBundle resourceBundle) { 74 | setData(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/SignInVerifyOtpFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import com.jfoenix.controls.JFXTextField; 5 | import javafx.event.ActionEvent; 6 | import javafx.fxml.FXML; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.AdminDto; 10 | import lk.ijse.library_management.util.Regex; 11 | import lk.ijse.library_management.util.navigation.AdminNavigation; 12 | 13 | import java.io.IOException; 14 | 15 | public class SignInVerifyOtpFormController { 16 | 17 | public static String otp; 18 | 19 | public static AdminDto dto; 20 | 21 | @FXML 22 | private JFXTextField txtOtp; 23 | 24 | @FXML 25 | private JFXButton btnVerify; 26 | 27 | @FXML 28 | private JFXButton btnBack; 29 | 30 | @FXML 31 | private Label lblOtp; 32 | 33 | @FXML 34 | void btnBackOnAction(ActionEvent event) { 35 | try { 36 | dto = null; 37 | otp= null; 38 | AdminNavigation.switchLoginPage("FrogotPasswordForm.fxml"); 39 | } catch (IOException e) { 40 | e.printStackTrace(); 41 | } 42 | } 43 | 44 | @FXML 45 | void btnBackOnMouseEntered(MouseEvent event) { 46 | 47 | } 48 | 49 | @FXML 50 | void btnBackOnMouseExited(MouseEvent event) { 51 | 52 | } 53 | 54 | @FXML 55 | void btnVerifyOnAction(ActionEvent event) { 56 | 57 | if (validate()) { 58 | if (txtOtp.getText().equals(otp)) { 59 | try { 60 | ResetPasswordFormController.dto = dto; 61 | AdminNavigation.switchLoginPage("ResetPasswordForm.fxml"); 62 | dto = null; 63 | otp= null; 64 | } catch (IOException e) { 65 | e.printStackTrace(); 66 | } 67 | } 68 | } 69 | } 70 | 71 | @FXML 72 | void btnVerifyOnMouseEntered(MouseEvent event) { 73 | 74 | } 75 | 76 | @FXML 77 | void btnVerifyOnMouseExited(MouseEvent event) { 78 | 79 | } 80 | 81 | @FXML 82 | void txtOtpOnAction(ActionEvent event) { 83 | String userName = txtOtp.getText(); 84 | 85 | if (Regex.userName(userName)) { 86 | lblOtp.setText("Invalid OTP"); 87 | } else { 88 | btnVerifyOnAction(event); 89 | } 90 | } 91 | 92 | @FXML 93 | void txtOtpOnMouseClicked(MouseEvent event) { 94 | lblOtp.setText(""); 95 | } 96 | 97 | public boolean validate() { 98 | String otp = txtOtp.getText(); 99 | 100 | if (Regex.otp(otp)) { 101 | lblOtp.setText("Invalid OTP"); 102 | return false; 103 | } 104 | 105 | return true; 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/admin/TransactionShortcutRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.admin; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.fxml.FXML; 5 | import javafx.scene.control.Label; 6 | import lk.ijse.library_management.projection.AdminTransactionProjection; 7 | import lk.ijse.library_management.util.navigation.AdminNavigation; 8 | 9 | import java.io.IOException; 10 | import java.sql.Timestamp; 11 | import java.text.SimpleDateFormat; 12 | 13 | public class TransactionShortcutRowFormController { 14 | 15 | @FXML 16 | private Label lblTransactionId; 17 | 18 | @FXML 19 | private Label lblContent; 20 | 21 | @FXML 22 | private Label lblDate; 23 | 24 | @FXML 25 | private Label lblTime; 26 | 27 | public void setDateAndTime(Timestamp dateAndTime) { 28 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 29 | String date = dateFormat.format(dateAndTime); 30 | 31 | SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 32 | String time = timeFormat.format(dateAndTime); 33 | 34 | lblDate.setText(date); 35 | lblTime.setText(time); 36 | } 37 | 38 | public void setData(AdminTransactionProjection dto) { 39 | lblTransactionId.setText(String.valueOf(dto.getId())); 40 | lblContent.setText("Borrowed " + dto.getQty() + " Books Due " + dto.getDueDate()); 41 | lblContent.setText("Member Id : " + dto.getId() + " borrowed " + dto.getQty() + " books, due on " + dto.getDueDate()); 42 | setDateAndTime((Timestamp) dto.getAddedDate()); 43 | } 44 | 45 | @FXML 46 | public void btnViewOnAction(ActionEvent actionEvent) { 47 | try { 48 | BookBorrowViewFormController.id = Integer.parseInt(lblTransactionId.getText()); 49 | AdminNavigation.popupPane("BookBorrowViewForm.fxml"); 50 | } catch (IOException e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BookBorrowAddRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.Label; 5 | import javafx.scene.image.ImageView; 6 | import javafx.scene.input.MouseEvent; 7 | import lk.ijse.library_management.dto.BookDto; 8 | 9 | public class BookBorrowAddRowFormController { 10 | 11 | @FXML 12 | private Label lblBookId; 13 | 14 | @FXML 15 | private Label lblTitle; 16 | 17 | @FXML 18 | private Label lblAuthor; 19 | 20 | @FXML 21 | private Label lblGenre; 22 | 23 | @FXML 24 | private ImageView imgDelete; 25 | 26 | private BookDto dto; 27 | 28 | @FXML 29 | void imgDeleteOnMouseClicked(MouseEvent event) { 30 | BookBorrowAddFormController.controller.removeBook(dto); 31 | BookBorrowAddFormController.controller.getBooks(); 32 | } 33 | 34 | @FXML 35 | void imgDeleteOnMouseEntered(MouseEvent event) { 36 | 37 | } 38 | 39 | @FXML 40 | void imgDeleteOnMouseExited(MouseEvent event) { 41 | 42 | } 43 | 44 | public void setData(BookDto dto) { 45 | lblBookId.setText(String.valueOf(dto.getId())); 46 | lblAuthor.setText(dto.getAuthor()); 47 | lblTitle.setText(dto.getTitle()); 48 | lblGenre.setText(dto.getGenre()); 49 | 50 | this.dto = dto; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BookBorrowManageRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.geometry.Pos; 5 | import javafx.scene.control.Label; 6 | import javafx.scene.image.ImageView; 7 | import javafx.scene.input.MouseEvent; 8 | import lk.ijse.library_management.dto.TransactionDto; 9 | import lk.ijse.library_management.util.navigation.MemberNavigation; 10 | 11 | import java.io.IOException; 12 | import java.time.LocalDate; 13 | import java.util.List; 14 | import java.util.Objects; 15 | 16 | public class BookBorrowManageRowFormController { 17 | 18 | @FXML 19 | private Label lblBorrowId; 20 | 21 | @FXML 22 | private Label lblMemberId; 23 | 24 | @FXML 25 | private Label lblBookAmount; 26 | 27 | @FXML 28 | private Label lblReturnDate; 29 | 30 | @FXML 31 | private Label lblStatus; 32 | 33 | @FXML 34 | private ImageView imgView; 35 | 36 | @FXML 37 | void imgViewOnMouseClicked(MouseEvent event) { 38 | try { 39 | BookBorrowViewFormController.id = Integer.parseInt(lblBorrowId.getText()); 40 | MemberNavigation.popupPane("BookBorrowViewForm.fxml"); 41 | } catch (IOException e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | @FXML 47 | void imgViewOnMouseEntered(MouseEvent event) { 48 | 49 | } 50 | 51 | @FXML 52 | void imgViewOnMouseExited(MouseEvent event) { 53 | 54 | } 55 | 56 | public void setStatus(TransactionDto dto) { 57 | LocalDate currentDate = LocalDate.now(); 58 | LocalDate expDate = dto.getDueDate().toLocalDate(); 59 | 60 | if ( (currentDate.isAfter(expDate)) && (dto.getStatus().equals("Due")) ) { 61 | dto.setStatus("Overdue"); 62 | BookBorrowManageFormController.controller.updateList.add(dto); 63 | lblStatus.setText("Overdue"); 64 | } else { 65 | lblStatus.setText(dto.getStatus()); 66 | } 67 | } 68 | 69 | public void setStatusStyle() { 70 | String status = lblStatus.getText(); 71 | 72 | lblStatus.setAlignment(Pos.CENTER); 73 | 74 | if ( Objects.equals(status, "Returned") ) { 75 | lblStatus.setStyle( 76 | "-fx-background-color: #C7FFDE;" + 77 | "-fx-background-radius: 20px;" + 78 | "-fx-text-fill: #139547"); 79 | } else if (Objects.equals(status, "Due")) { 80 | lblStatus.setStyle( 81 | "-fx-background-color: #A0C0FFFF;" + 82 | "-fx-background-radius: 20px;" + 83 | "-fx-text-fill: #1351CB"); 84 | 85 | } else { 86 | lblStatus.setStyle( 87 | "-fx-background-color: #FFD3D3;" + 88 | "-fx-background-radius: 20px;" + 89 | "-fx-text-fill: #FF0E0E"); 90 | } 91 | } 92 | 93 | public void setData(TransactionDto dto) { 94 | lblBorrowId.setText(String.valueOf(dto.getId())); 95 | lblBookAmount.setText(String.valueOf(dto.getQty())); 96 | lblMemberId.setText(String.valueOf(dto.getMember().getId())); 97 | lblReturnDate.setText(String.valueOf(dto.getDueDate())); 98 | setStatus(dto); 99 | setStatusStyle(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BookBorrowViewRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.Label; 5 | import lk.ijse.library_management.dto.BookDto; 6 | 7 | public class BookBorrowViewRowFormController { 8 | 9 | @FXML 10 | private Label lblBookId; 11 | 12 | @FXML 13 | private Label lblTitle; 14 | 15 | @FXML 16 | private Label lblAuthor; 17 | 18 | @FXML 19 | private Label lblGenre; 20 | 21 | public void setData(BookDto dto) { 22 | lblBookId.setText(String.valueOf(dto.getId())); 23 | lblTitle.setText(dto.getTitle()); 24 | lblAuthor.setText(dto.getAuthor()); 25 | lblGenre.setText(dto.getGenre()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BookManageRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.geometry.Pos; 5 | import javafx.scene.control.Label; 6 | import javafx.scene.image.ImageView; 7 | import javafx.scene.input.MouseEvent; 8 | import lk.ijse.library_management.dto.BookDto; 9 | import lk.ijse.library_management.service.ServiceFactory; 10 | import lk.ijse.library_management.service.custom.BookService; 11 | import lk.ijse.library_management.service.custom.impl.BookServiceImpl; 12 | import lk.ijse.library_management.util.navigation.MemberNavigation; 13 | 14 | import java.io.IOException; 15 | import java.util.Objects; 16 | 17 | public class BookManageRowFormController { 18 | 19 | @FXML 20 | private Label lblId; 21 | 22 | @FXML 23 | private Label lblTitle; 24 | 25 | @FXML 26 | private Label lblGenre; 27 | 28 | @FXML 29 | private Label lblAvailability; 30 | 31 | @FXML 32 | private ImageView imgView; 33 | 34 | private final BookService bookService = 35 | (BookServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BOOK); 36 | 37 | @FXML 38 | void imgViewOnMouseClicked(MouseEvent event) { 39 | try { 40 | BookViewFormController.id = Integer.parseInt(lblId.getText()); 41 | MemberNavigation.popupPane("BookViewForm.fxml"); 42 | } catch (IOException e) { 43 | e.printStackTrace(); 44 | } 45 | } 46 | 47 | @FXML 48 | void imgViewOnMouseEntered(MouseEvent event) { 49 | 50 | } 51 | 52 | @FXML 53 | void imgViewOnMouseExited(MouseEvent event) { 54 | 55 | } 56 | 57 | public void setStatus(String status) { 58 | lblAvailability.setAlignment(Pos.CENTER); 59 | 60 | if ( Objects.equals(status, "Available") ) { 61 | lblAvailability.setStyle( 62 | "-fx-background-color: #C7FFDE;" + 63 | "-fx-background-radius: 20px;" + 64 | "-fx-text-fill: #139547"); 65 | } else { 66 | lblAvailability.setStyle( 67 | "-fx-background-color: #FFD3D3;" + 68 | "-fx-background-radius: 20px;" + 69 | "-fx-text-fill: #FF0E0E"); 70 | } 71 | } 72 | 73 | public void setData(BookDto dto) { 74 | lblId.setText(String.valueOf(dto.getId())); 75 | lblGenre.setText(dto.getGenre()); 76 | lblTitle.setText(dto.getTitle()); 77 | lblAvailability.setText(dto.getAvailability()); 78 | setStatus(dto.getAvailability()); 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BookViewFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.BookDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.BookService; 12 | import lk.ijse.library_management.service.custom.impl.BookServiceImpl; 13 | import lk.ijse.library_management.util.navigation.MemberNavigation; 14 | 15 | import java.net.URL; 16 | import java.util.ResourceBundle; 17 | 18 | public class BookViewFormController implements Initializable { 19 | 20 | @FXML 21 | private JFXButton btnCancel; 22 | 23 | @FXML 24 | private Label lblId; 25 | 26 | @FXML 27 | private Label lblTitle; 28 | 29 | @FXML 30 | private Label lblAuthor; 31 | 32 | @FXML 33 | private Label lblGenre; 34 | 35 | @FXML 36 | private Label lblAvailability; 37 | 38 | public static int id; 39 | 40 | private final BookService bookService = 41 | (BookServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BOOK); 42 | 43 | @FXML 44 | void btnCancelOnAction(ActionEvent event) { 45 | MemberNavigation.closePane(); 46 | } 47 | 48 | @FXML 49 | void btnCancelOnMouseEntered(MouseEvent event) { 50 | 51 | } 52 | 53 | @FXML 54 | void btnCancelOnMouseExited(MouseEvent event) { 55 | 56 | } 57 | 58 | public void setData() { 59 | BookDto dto = bookService.getBookData(id); 60 | 61 | if (dto.getAvailability().equals("Removed")) throw new RuntimeException(); 62 | 63 | lblId.setText(String.valueOf(dto.getId())); 64 | lblTitle.setText(dto.getTitle()); 65 | lblAuthor.setText(dto.getAuthor()); 66 | lblGenre.setText(dto.getGenre()); 67 | lblAvailability.setText(dto.getAvailability()); 68 | } 69 | 70 | @Override 71 | public void initialize(URL url, ResourceBundle resourceBundle) { 72 | try { 73 | setData(); 74 | } catch (Exception e) { 75 | MemberNavigation.closePane(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BranchManageRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.Label; 5 | import javafx.scene.image.ImageView; 6 | import javafx.scene.input.MouseEvent; 7 | import lk.ijse.library_management.dto.BranchDto; 8 | import lk.ijse.library_management.service.ServiceFactory; 9 | import lk.ijse.library_management.service.custom.BranchService; 10 | import lk.ijse.library_management.service.custom.impl.BranchServiceImpl; 11 | import lk.ijse.library_management.util.navigation.MemberNavigation; 12 | 13 | import java.io.IOException; 14 | 15 | public class BranchManageRowFormController { 16 | 17 | @FXML 18 | private Label lblId; 19 | 20 | @FXML 21 | private Label lblName; 22 | 23 | @FXML 24 | private Label lblMobile; 25 | 26 | @FXML 27 | private Label lblEmail; 28 | 29 | @FXML 30 | private ImageView imgView; 31 | 32 | private final BranchService branchService = 33 | (BranchServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BRANCH); 34 | 35 | @FXML 36 | void imgViewOnMouseClicked(MouseEvent event) { 37 | try { 38 | BranchViewFormController.id = Integer.parseInt(lblId.getText()); 39 | MemberNavigation.popupPane("BranchViewForm.fxml"); 40 | } catch (IOException e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | @FXML 46 | void imgViewOnMouseEntered(MouseEvent event) { 47 | 48 | } 49 | 50 | @FXML 51 | void imgViewOnMouseExited(MouseEvent event) { 52 | 53 | } 54 | 55 | public void setData(BranchDto dto) { 56 | 57 | lblId.setText(String.valueOf(dto.getId())); 58 | lblName.setText(dto.getName()); 59 | lblMobile.setText(dto.getMobile()); 60 | lblEmail.setText(dto.getEmail()); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/BranchViewFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.BranchDto; 10 | import lk.ijse.library_management.service.ServiceFactory; 11 | import lk.ijse.library_management.service.custom.BranchService; 12 | import lk.ijse.library_management.service.custom.impl.BranchServiceImpl; 13 | import lk.ijse.library_management.util.navigation.MemberNavigation; 14 | 15 | import java.net.URL; 16 | import java.util.ResourceBundle; 17 | 18 | public class BranchViewFormController implements Initializable { 19 | 20 | @FXML 21 | private JFXButton btnCancel; 22 | 23 | @FXML 24 | private Label lblBranchId; 25 | 26 | @FXML 27 | private Label lblBranchName; 28 | 29 | @FXML 30 | private Label lblBranchMobile; 31 | 32 | @FXML 33 | private Label lblBranchEmail; 34 | 35 | @FXML 36 | private Label lblBranchAddress; 37 | 38 | public static int id; 39 | 40 | private final BranchService branchService = 41 | (BranchServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BRANCH); 42 | 43 | @FXML 44 | void btnCancelOnAction(ActionEvent event) { 45 | MemberNavigation.closePane(); 46 | } 47 | 48 | @FXML 49 | void btnCancelOnMouseEntered(MouseEvent event) { 50 | 51 | } 52 | 53 | @FXML 54 | void btnCancelOnMouseExited(MouseEvent event) { 55 | 56 | } 57 | 58 | public void setData() { 59 | BranchDto dto = branchService.getBranchData(id); 60 | 61 | lblBranchId.setText(String.valueOf(dto.getId())); 62 | lblBranchName.setText(dto.getName()); 63 | lblBranchAddress.setText(dto.getLocation()); 64 | lblBranchMobile.setText(dto.getMobile()); 65 | lblBranchEmail.setText(dto.getEmail()); 66 | } 67 | 68 | @Override 69 | public void initialize(URL url, ResourceBundle resourceBundle) { 70 | setData(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/DashboardFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.fxml.Initializable; 6 | import javafx.scene.Parent; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.layout.VBox; 9 | import lk.ijse.library_management.dto.MemberDto; 10 | import lk.ijse.library_management.projection.AdminTransactionProjection; 11 | import lk.ijse.library_management.projection.MemberTransactionProjection; 12 | import lk.ijse.library_management.service.ServiceFactory; 13 | import lk.ijse.library_management.service.custom.DashboardService; 14 | import lk.ijse.library_management.service.custom.impl.DashboardServiceImpl; 15 | 16 | import java.io.IOException; 17 | import java.net.URL; 18 | import java.util.List; 19 | import java.util.ResourceBundle; 20 | 21 | public class DashboardFormController implements Initializable { 22 | 23 | @FXML 24 | public Label lblTotBorrowBooks; 25 | 26 | @FXML 27 | private VBox vBoxTransaction; 28 | 29 | @FXML 30 | private Label lblTotBooks; 31 | 32 | @FXML 33 | private Label lblTotReturned; 34 | 35 | @FXML 36 | private Label lblTotDue; 37 | 38 | private final DashboardService dashboardService = 39 | (DashboardServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.DASHBOARD); 40 | 41 | 42 | public void setLabelData() { 43 | int id = dashboardService.getMemberIdFormUsername(MemberGlobalFormController.username); 44 | 45 | MemberDto dto = dashboardService.getMemberData(id); 46 | 47 | lblTotBooks.setText(String.valueOf(dashboardService.getMemberReadBookCount(dto))); 48 | 49 | lblTotBorrowBooks.setText(String.valueOf(dashboardService.getMemberBorrowBookCount(dto))); 50 | 51 | lblTotReturned.setText(String.valueOf(dashboardService.getMemberReturnedCount(dto))); 52 | 53 | lblTotDue.setText(String.valueOf(dashboardService.getMemberDueCount(dto))); 54 | 55 | loadTransactionData(dto); 56 | } 57 | 58 | public void loadTransactionData(MemberDto dto) { 59 | List list = dashboardService.getAllTransactionsOfMember(dto); 60 | 61 | if (list != null) { 62 | vBoxTransaction.getChildren().clear(); 63 | 64 | for (MemberTransactionProjection projection : list) { 65 | loadDataTable(projection); 66 | } 67 | } 68 | } 69 | 70 | private void loadDataTable(MemberTransactionProjection dto) { 71 | try { 72 | FXMLLoader loader = new FXMLLoader(lk.ijse.library_management.controller.member.DashboardFormController.class.getResource("/view/member/TransactionShortcutRowForm.fxml")); 73 | Parent root = loader.load(); 74 | TransactionShortcutRowFormController controller = loader.getController(); 75 | controller.setData(dto); 76 | vBoxTransaction.getChildren().add(root); 77 | } catch (IOException e) { 78 | 79 | } 80 | } 81 | 82 | @Override 83 | public void initialize(URL url , ResourceBundle resourceBundle) { 84 | setLabelData(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/MemberGlobalLoginFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.fxml.Initializable; 5 | import javafx.scene.layout.AnchorPane; 6 | import javafx.stage.Stage; 7 | import lk.ijse.library_management.util.navigation.MemberNavigation; 8 | 9 | import java.io.IOException; 10 | import java.net.URL; 11 | import java.util.ResourceBundle; 12 | 13 | public class MemberGlobalLoginFormController implements Initializable { 14 | 15 | public static Stage stage; 16 | 17 | @FXML 18 | public AnchorPane loginPane; 19 | 20 | public static MemberGlobalLoginFormController controller; 21 | 22 | public MemberGlobalLoginFormController() { 23 | controller = this; 24 | } 25 | 26 | public static MemberGlobalLoginFormController getInstance() { 27 | return controller; 28 | } 29 | 30 | @Override 31 | public void initialize(URL url, ResourceBundle resourceBundle) { 32 | try { 33 | MemberNavigation.switchLoginPage("SignInForm.fxml"); 34 | } catch (IOException e) { 35 | e.printStackTrace (); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/MemberProfileFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import javafx.event.ActionEvent; 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.Initializable; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.image.ImageView; 9 | import javafx.scene.input.MouseEvent; 10 | import lk.ijse.library_management.dto.MemberDto; 11 | import lk.ijse.library_management.service.ServiceFactory; 12 | import lk.ijse.library_management.service.custom.MemberProfileService; 13 | import lk.ijse.library_management.service.custom.impl.MemberProfileServiceImpl; 14 | import lk.ijse.library_management.util.navigation.MemberNavigation; 15 | 16 | import java.io.IOException; 17 | import java.net.URL; 18 | import java.util.ResourceBundle; 19 | 20 | public class MemberProfileFormController implements Initializable { 21 | 22 | @FXML 23 | private JFXButton btnDelete; 24 | 25 | @FXML 26 | private JFXButton btnReset; 27 | 28 | @FXML 29 | private Label lblUserName; 30 | 31 | @FXML 32 | private Label lblName; 33 | 34 | @FXML 35 | private Label lblEmail; 36 | 37 | @FXML 38 | private Label lblMemberId; 39 | 40 | @FXML 41 | private ImageView imgClose; 42 | 43 | @FXML 44 | private Label lblMobile; 45 | 46 | private final MemberProfileService memberProfileService = 47 | (MemberProfileServiceImpl) ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.MEMBERPROFILE); 48 | 49 | @FXML 50 | void btnDeleteOnAction(ActionEvent event) { 51 | try { 52 | MemberNavigation.closePane(); 53 | MemberNavigation.popupPane("DeleteMemberForm.fxml"); 54 | } catch (IOException e) { 55 | e.printStackTrace(); 56 | } 57 | } 58 | 59 | @FXML 60 | void btnDeleteOnMouseEntered(MouseEvent event) { 61 | 62 | } 63 | 64 | @FXML 65 | void btnDeleteOnMouseExited(MouseEvent event) { 66 | 67 | } 68 | 69 | @FXML 70 | void btnResetOnAction(ActionEvent event) { 71 | try { 72 | MemberNavigation.closePane(); 73 | MemberNavigation.popupPane("ChangeCredentialForm.fxml"); 74 | } catch (IOException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | 79 | @FXML 80 | void btnResetOnMouseEntered(MouseEvent event) { 81 | 82 | } 83 | 84 | @FXML 85 | void btnResetOnMouseExited(MouseEvent event) { 86 | 87 | } 88 | 89 | @FXML 90 | void imgCloseOnMouseClicked(MouseEvent event) { 91 | MemberNavigation.closePane(); 92 | } 93 | 94 | @FXML 95 | void imgCloseOnMouseEntered(MouseEvent event) { 96 | 97 | } 98 | 99 | @FXML 100 | void imgCloseOnMouseExited(MouseEvent event) { 101 | 102 | } 103 | 104 | private void setData() { 105 | int id = memberProfileService.getIdFromUsername(MemberGlobalFormController.username); 106 | MemberDto dto = memberProfileService.getMemberData(id); 107 | 108 | lblMemberId.setText(String.valueOf(dto.getId())); 109 | lblName.setText(dto.getName()); 110 | lblUserName.setText(dto.getUsername()); 111 | lblMobile.setText(dto.getMobile()); 112 | lblEmail.setText(dto.getEmail()); 113 | } 114 | 115 | @Override 116 | public void initialize(URL url, ResourceBundle resourceBundle) { 117 | setData(); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/SignInVerifyOtpFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import com.jfoenix.controls.JFXButton; 4 | import com.jfoenix.controls.JFXTextField; 5 | import javafx.event.ActionEvent; 6 | import javafx.fxml.FXML; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.input.MouseEvent; 9 | import lk.ijse.library_management.dto.MemberDto; 10 | import lk.ijse.library_management.util.Regex; 11 | import lk.ijse.library_management.util.navigation.MemberNavigation; 12 | 13 | import java.io.IOException; 14 | 15 | public class SignInVerifyOtpFormController { 16 | 17 | public static MemberDto dto; 18 | 19 | public static String otp; 20 | 21 | @FXML 22 | private JFXTextField txtOtp; 23 | 24 | @FXML 25 | private JFXButton btnVerify; 26 | 27 | @FXML 28 | private JFXButton btnBack; 29 | 30 | @FXML 31 | private Label lblOtp; 32 | 33 | @FXML 34 | void btnBackOnAction(ActionEvent event) { 35 | try { 36 | dto = null; 37 | otp= null; 38 | MemberNavigation.switchLoginPage("FrogotPasswordForm.fxml"); 39 | } catch (IOException e) { 40 | e.printStackTrace(); 41 | } 42 | } 43 | 44 | @FXML 45 | void btnBackOnMouseEntered(MouseEvent event) { 46 | 47 | } 48 | 49 | @FXML 50 | void btnBackOnMouseExited(MouseEvent event) { 51 | 52 | } 53 | 54 | @FXML 55 | void btnVerifyOnAction(ActionEvent event) { 56 | if (validate()) { 57 | if (txtOtp.getText().equals(otp)) { 58 | try { 59 | ResetPasswordFormController.dto = dto; 60 | MemberNavigation.switchLoginPage("ResetPasswordForm.fxml"); 61 | dto = null; 62 | otp= null; 63 | } catch (IOException e) { 64 | e.printStackTrace(); 65 | } 66 | } 67 | } 68 | } 69 | 70 | @FXML 71 | void btnVerifyOnMouseEntered(MouseEvent event) { 72 | 73 | } 74 | 75 | @FXML 76 | void btnVerifyOnMouseExited(MouseEvent event) { 77 | 78 | } 79 | 80 | @FXML 81 | void txtOtpOnAction(ActionEvent event) { 82 | String otp = txtOtp.getText(); 83 | 84 | if (Regex.otp(otp)) { 85 | lblOtp.setText("Invalid OTP"); 86 | } else { 87 | btnVerifyOnAction(event); 88 | } 89 | } 90 | 91 | @FXML 92 | void txtOtpOnMouseClicked(MouseEvent event) { 93 | lblOtp.setText(""); 94 | } 95 | 96 | public boolean validate() { 97 | String otp = txtOtp.getText(); 98 | 99 | if (Regex.otp(otp)) { 100 | lblOtp.setText("Invalid OTP"); 101 | return false; 102 | } 103 | 104 | return true; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/controller/member/TransactionShortcutRowFormController.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.controller.member; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.fxml.FXML; 5 | import javafx.scene.control.Label; 6 | import lk.ijse.library_management.projection.AdminTransactionProjection; 7 | import lk.ijse.library_management.projection.MemberTransactionProjection; 8 | import lk.ijse.library_management.util.navigation.MemberNavigation; 9 | 10 | import java.io.IOException; 11 | import java.sql.Timestamp; 12 | import java.text.SimpleDateFormat; 13 | 14 | public class TransactionShortcutRowFormController { 15 | 16 | @FXML 17 | private Label lblTransactionId; 18 | 19 | @FXML 20 | private Label lblContent; 21 | 22 | @FXML 23 | private Label lblDate; 24 | 25 | @FXML 26 | private Label lblTime; 27 | 28 | public void setDateAndTime(Timestamp dateAndTime) { 29 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 30 | String date = dateFormat.format(dateAndTime); 31 | 32 | SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 33 | String time = timeFormat.format(dateAndTime); 34 | 35 | lblDate.setText(date); 36 | lblTime.setText(time); 37 | } 38 | 39 | public void setData(MemberTransactionProjection dto) { 40 | lblTransactionId.setText(String.valueOf(dto.getId())); 41 | lblContent.setText("Borrowed " + dto.getQty() + " Books Due " + dto.getDueDate()); 42 | setDateAndTime((Timestamp) dto.getAddedDate()); 43 | } 44 | 45 | @FXML 46 | public void btnViewOnAction(ActionEvent actionEvent) { 47 | try { 48 | BookBorrowViewFormController.id = Integer.parseInt(lblTransactionId.getText()); 49 | MemberNavigation.popupPane("BookBorrowViewForm.fxml"); 50 | } catch (IOException e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/dto/AdminDto.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.dto; 2 | 3 | import lk.ijse.library_management.embedded.NameIdentifier; 4 | import lk.ijse.library_management.entity.Admin; 5 | import lk.ijse.library_management.entity.Branch; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.sql.Timestamp; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Data 17 | public class AdminDto { 18 | private int id; 19 | private String fName; 20 | private String lName; 21 | private String mobile; 22 | private String email; 23 | private String username; 24 | private String password; 25 | private Timestamp addedDate; 26 | private Timestamp updatedDate; 27 | 28 | public Admin toEntity() { 29 | Admin admin = new Admin(); 30 | 31 | admin.setId(id); 32 | admin.setName(new NameIdentifier(fName, lName)); 33 | admin.setMobile(mobile); 34 | admin.setEmail(email); 35 | admin.setUsername(username); 36 | admin.setPassword(password); 37 | admin.setAddedDate(addedDate); 38 | admin.setUpdatedDate(updatedDate); 39 | 40 | return admin; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/dto/BookDto.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.dto; 2 | 3 | import lk.ijse.library_management.entity.Admin; 4 | import lk.ijse.library_management.entity.Book; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.sql.Timestamp; 10 | import java.util.ArrayList; 11 | 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @Data 15 | public class BookDto { 16 | private int id; 17 | 18 | private String title; 19 | 20 | private String author; 21 | 22 | private String genre; 23 | 24 | private String availability; 25 | 26 | private Timestamp addedDate; 27 | 28 | private Timestamp updatedDate; 29 | 30 | private AdminDto admin; 31 | 32 | public Book toEntity() { 33 | return new Book( 34 | id, 35 | title, 36 | author, 37 | genre, 38 | availability, 39 | addedDate, 40 | updatedDate, 41 | admin.toEntity(), 42 | new ArrayList<>() 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/dto/BranchDto.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.dto; 2 | 3 | import lk.ijse.library_management.entity.Admin; 4 | import lk.ijse.library_management.entity.Branch; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | 10 | import javax.persistence.Column; 11 | import java.sql.Timestamp; 12 | 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @Data 16 | public class BranchDto { 17 | 18 | private int id; 19 | 20 | private String name; 21 | 22 | private String location; 23 | 24 | private String mobile; 25 | 26 | private String email; 27 | 28 | private Timestamp createdDate; 29 | 30 | private Timestamp updatedDate; 31 | 32 | private AdminDto admin; 33 | 34 | public Branch toEntity() { 35 | return new Branch( 36 | id, 37 | name, 38 | location, 39 | mobile, 40 | email, 41 | createdDate, 42 | updatedDate, 43 | admin.toEntity() 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/dto/MemberDto.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.dto; 2 | 3 | import lk.ijse.library_management.entity.Member; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | 10 | import javax.persistence.Column; 11 | import java.sql.Timestamp; 12 | import java.util.ArrayList; 13 | 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Data 17 | public class MemberDto { 18 | 19 | private int id; 20 | 21 | private String name; 22 | 23 | private String mobile; 24 | 25 | private String email; 26 | 27 | private String username; 28 | 29 | private String password; 30 | 31 | private Timestamp addedDate; 32 | 33 | private Timestamp updatedDate; 34 | 35 | public Member toEntity() { 36 | Member member = new Member(); 37 | 38 | member.setId(id); 39 | member.setName(name); 40 | member.setMobile(mobile); 41 | member.setEmail(email); 42 | member.setUsername(username); 43 | member.setPassword(password); 44 | member.setAddedDate(addedDate); 45 | member.setUpdatedDate(updatedDate); 46 | 47 | return member; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/dto/TransactionDetailsDto.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.dto; 2 | 3 | import lk.ijse.library_management.embedded.TransactionDetailPK; 4 | import lk.ijse.library_management.entity.TransactionDetails; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | @Data 12 | public class TransactionDetailsDto { 13 | private TransactionDetailPK id; 14 | 15 | private TransactionDto transaction; 16 | 17 | private BookDto book; 18 | 19 | public TransactionDetails toEntity() { 20 | return new TransactionDetails( 21 | id, 22 | transaction.toEntity(), 23 | book.toEntity() 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/dto/TransactionDto.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.dto; 2 | 3 | import lk.ijse.library_management.entity.Member; 4 | import lk.ijse.library_management.entity.Transaction; 5 | import lk.ijse.library_management.entity.TransactionDetails; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.sql.Date; 11 | import java.sql.Timestamp; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Data 18 | public class TransactionDto { 19 | 20 | private int id; 21 | 22 | private int qty; 23 | 24 | private Date dueDate; 25 | 26 | private String status; 27 | 28 | private Timestamp addedDate; 29 | 30 | private MemberDto member; 31 | 32 | public Transaction toEntity() { 33 | return new Transaction( 34 | id, 35 | qty, 36 | dueDate, 37 | status, 38 | addedDate, 39 | member.toEntity(), 40 | new ArrayList<>() 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/embedded/NameIdentifier.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.embedded; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Embeddable; 9 | 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | @Data 13 | 14 | @Embeddable 15 | public class NameIdentifier { 16 | 17 | @Column(name = "first_name") 18 | private String fName; 19 | 20 | @Column(name = "last_name") 21 | private String lName; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/embedded/TransactionDetailPK.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.embedded; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Embeddable; 9 | import java.io.Serializable; 10 | 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @Data 14 | 15 | @Embeddable 16 | public class TransactionDetailPK implements Serializable { 17 | 18 | @Column(name = "transaction_id") 19 | private int transactionId; 20 | 21 | @Column(name = "book_id") 22 | private int bookId; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/entity/Admin.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.entity; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.embedded.NameIdentifier; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.hibernate.annotations.CreationTimestamp; 9 | import org.hibernate.annotations.UpdateTimestamp; 10 | 11 | import javax.persistence.*; 12 | import java.sql.Timestamp; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Data 19 | 20 | @Entity 21 | @Table(name = "admin") 22 | public class Admin { 23 | 24 | @Id 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) 26 | @Column(name = "admin_id") 27 | private int id; 28 | 29 | @Column(name = "admin_name", nullable = false) 30 | private NameIdentifier name; 31 | 32 | @Column(name = "admin_mobile", nullable = false, unique = true) 33 | private String mobile; 34 | 35 | @Column(name = "admin_email", nullable = false, unique = true) 36 | private String email; 37 | 38 | @Column(name = "username", nullable = false, unique = true) 39 | private String username; 40 | 41 | @Column(name = "password", nullable = false) 42 | private String password; 43 | 44 | @CreationTimestamp 45 | @Column(name = "admin_added") 46 | private Timestamp addedDate; 47 | 48 | @UpdateTimestamp 49 | @Column(name = "admin_updated") 50 | private Timestamp updatedDate; 51 | 52 | @OneToMany( 53 | cascade = CascadeType.ALL, 54 | fetch = FetchType.LAZY, 55 | mappedBy = "admin" 56 | ) 57 | private List branches = new ArrayList<>(); 58 | 59 | @OneToMany( 60 | cascade = CascadeType.ALL, 61 | fetch = FetchType.LAZY, 62 | mappedBy = "admin" 63 | ) 64 | private List books = new ArrayList<>(); 65 | 66 | public AdminDto toDto() { 67 | return new AdminDto( 68 | id, 69 | name.getFName(), 70 | name.getLName(), 71 | mobile, 72 | email, 73 | username, 74 | password, 75 | addedDate, 76 | updatedDate 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/entity/Book.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.entity; 2 | 3 | import lk.ijse.library_management.dto.BookDto; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | 10 | import javax.persistence.*; 11 | import java.sql.Timestamp; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Data 18 | 19 | @Entity 20 | @Table(name = "book") 21 | public class Book { 22 | 23 | @Id 24 | @GeneratedValue(strategy = GenerationType.IDENTITY) 25 | @Column(name = "book_id") 26 | private int id; 27 | 28 | @Column(name = "book_title", nullable = false) 29 | private String title; 30 | 31 | @Column(name = "book_author", nullable = false) 32 | private String author; 33 | 34 | @Column(name = "book_genre", nullable = false) 35 | private String genre; 36 | 37 | @Column(name = "book_availability", nullable = false) 38 | private String availability; 39 | 40 | @CreationTimestamp 41 | @Column(name = "book_added") 42 | private Timestamp addedDate; 43 | 44 | @UpdateTimestamp 45 | @Column(name = "book_updated") 46 | private Timestamp updatedDate; 47 | 48 | @ManyToOne 49 | @JoinColumn(name = "admin_id") 50 | private Admin admin; 51 | 52 | @OneToMany( 53 | cascade = CascadeType.ALL, 54 | fetch = FetchType.LAZY, 55 | mappedBy = "book" 56 | ) 57 | private List transactionDetails = new ArrayList<>(); 58 | 59 | public BookDto toDto() { 60 | return new BookDto( 61 | id, 62 | title, 63 | author, 64 | genre, 65 | availability, 66 | addedDate, 67 | updatedDate, 68 | admin.toDto() 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/entity/Branch.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.entity; 2 | 3 | import lk.ijse.library_management.dto.BranchDto; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | 10 | import javax.persistence.*; 11 | import java.io.Serializable; 12 | import java.sql.Timestamp; 13 | 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Data 17 | 18 | @Entity 19 | @Table(name = "branch") 20 | public class Branch implements Serializable { 21 | 22 | @Id 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) 24 | @Column(name = "branch_id") 25 | private int id; 26 | 27 | @Column(name = "branch_name", nullable = false, unique = true) 28 | private String name; 29 | 30 | @Column(name = "branch_location", nullable = false) 31 | private String location; 32 | 33 | @Column(name = "branch_moobile", nullable = false, unique = true) 34 | private String mobile; 35 | 36 | @Column(name = "branch_email", nullable = false) 37 | private String email; 38 | 39 | @CreationTimestamp 40 | @Column(name = "branch_added") 41 | private Timestamp createdDate; 42 | 43 | @UpdateTimestamp 44 | @Column(name = "branch_updated") 45 | private Timestamp updatedDate; 46 | 47 | @ManyToOne 48 | @JoinColumn(name = "admin_id") 49 | private Admin admin; 50 | 51 | public BranchDto toDto() { 52 | return new BranchDto( 53 | id, 54 | name, 55 | location, 56 | mobile, 57 | email, 58 | createdDate, 59 | updatedDate, 60 | admin.toDto() 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/entity/Member.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.entity; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.dto.TransactionDto; 5 | import lk.ijse.library_management.embedded.NameIdentifier; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import org.hibernate.annotations.CreationTimestamp; 10 | import org.hibernate.annotations.UpdateTimestamp; 11 | 12 | import javax.persistence.*; 13 | import java.sql.Timestamp; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @Data 20 | 21 | @Entity 22 | @Table(name = "member") 23 | public class Member { 24 | 25 | @Id 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | @Column(name = "member_id") 28 | private int id; 29 | 30 | @Column(name = "member_name", nullable = false) 31 | private String name; 32 | 33 | @Column(name = "member_mobile", nullable = false, unique = true) 34 | private String mobile; 35 | 36 | @Column(name = "member_email", nullable = false, unique = true) 37 | private String email; 38 | 39 | @Column(name = "member_username", nullable = false, unique = true) 40 | private String username; 41 | 42 | @Column(name = "member_password", nullable = false) 43 | private String password; 44 | 45 | @CreationTimestamp 46 | @Column(name = "member_added") 47 | private Timestamp addedDate; 48 | 49 | @UpdateTimestamp 50 | @Column(name = "member_updated") 51 | private Timestamp updatedDate; 52 | 53 | @OneToMany( 54 | cascade = CascadeType.ALL, 55 | fetch = FetchType.LAZY, 56 | mappedBy = "member" 57 | ) 58 | private List transactions = new ArrayList<>(); 59 | 60 | public MemberDto toDto() { 61 | return new MemberDto( 62 | id, 63 | name, 64 | mobile, 65 | email, 66 | username, 67 | password, 68 | addedDate, 69 | updatedDate 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/entity/Transaction.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.entity; 2 | 3 | import lk.ijse.library_management.dto.TransactionDto; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | 9 | import javax.persistence.*; 10 | import java.sql.Date; 11 | import java.sql.Timestamp; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Data 18 | 19 | @Entity 20 | @Table(name = "transaction") 21 | public class Transaction { 22 | 23 | @Id 24 | @GeneratedValue(strategy = GenerationType.IDENTITY) 25 | @Column(name = "transaction_id") 26 | private int id; 27 | 28 | @Column(name = "book_qty", nullable = false) 29 | private int qty; 30 | 31 | @Column(name = "due_date", nullable = false) 32 | private Date dueDate; 33 | 34 | @Column(name = "transaction_status", nullable = false) 35 | private String status; 36 | 37 | @CreationTimestamp 38 | @Column(name = "transaction_added") 39 | private Timestamp addedDate; 40 | 41 | @ManyToOne 42 | @JoinColumn(name = "member_id") 43 | private Member member; 44 | 45 | @OneToMany( 46 | cascade = CascadeType.ALL, 47 | fetch = FetchType.EAGER, 48 | mappedBy = "transaction" 49 | ) 50 | private List transactionDetails = new ArrayList<>(); 51 | 52 | public TransactionDto toDto() { 53 | return new TransactionDto( 54 | id, 55 | qty, 56 | dueDate, 57 | status, 58 | addedDate, 59 | member.toDto() 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/entity/TransactionDetails.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.entity; 2 | 3 | import lk.ijse.library_management.dto.TransactionDetailsDto; 4 | import lk.ijse.library_management.embedded.TransactionDetailPK; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import javax.persistence.*; 10 | 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @Data 14 | 15 | @Entity 16 | @Table(name = "transaction_details") 17 | public class TransactionDetails { 18 | 19 | @EmbeddedId 20 | private TransactionDetailPK id; 21 | 22 | @ManyToOne(cascade = CascadeType.ALL) 23 | @JoinColumn( 24 | name = "transaction_id", 25 | insertable = false, 26 | updatable = false 27 | ) 28 | private Transaction transaction; 29 | 30 | @ManyToOne(cascade = CascadeType.ALL) 31 | @JoinColumn( 32 | name = "book_id", 33 | insertable = false, 34 | updatable = false 35 | ) 36 | private Book book; 37 | 38 | public TransactionDetailsDto toDto() { 39 | return new TransactionDetailsDto( 40 | id, 41 | transaction.toDto(), 42 | book.toDto() 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/projection/AdminTransactionProjection.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.projection; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.Date; 8 | 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | @Data 12 | public class AdminTransactionProjection { 13 | 14 | private int id; 15 | 16 | private int qty; 17 | 18 | private Date dueDate; 19 | 20 | private Date addedDate; 21 | 22 | private int mId; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/projection/MemberTransactionProjection.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.projection; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.Date; 8 | 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | @Data 12 | public class MemberTransactionProjection { 13 | 14 | private int id; 15 | 16 | private int qty; 17 | 18 | private Date dueDate; 19 | 20 | private Date addedDate; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/RepositoryFactory.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository; 2 | 3 | import lk.ijse.library_management.repository.custom.impl.*; 4 | 5 | public class RepositoryFactory { 6 | public static RepositoryFactory factory; 7 | 8 | public RepositoryFactory () { 9 | 10 | } 11 | 12 | public static RepositoryFactory getInstance() { 13 | return (factory == null) ? factory = new RepositoryFactory() : factory; 14 | } 15 | 16 | public enum RepositoryType { 17 | BRANCH, ADMIN, BOOK, MEMBER, TRANSACTION, TRANSACTIONDETAILS 18 | } 19 | 20 | public SuperRepository getRepository (RepositoryType type) { 21 | switch (type) { 22 | case BRANCH: 23 | return new BranchRepositoryImpl(); 24 | case ADMIN: 25 | return new AdminRepositoryImpl(); 26 | case BOOK: 27 | return new BookRepositoryImpl(); 28 | case MEMBER: 29 | return new MemberRepositoryImpl(); 30 | case TRANSACTION: 31 | return new TransactionRepositoryImpl(); 32 | case TRANSACTIONDETAILS: 33 | return new TransactionDetailRepositoryImpl(); 34 | default: 35 | return null; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/SuperRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository; 2 | 3 | import org.hibernate.Session; 4 | 5 | public interface SuperRepository { 6 | void setSession(Session session); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/AdminRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.entity.Admin; 5 | import lk.ijse.library_management.repository.SuperRepository; 6 | import lk.ijse.library_management.util.CrudUtil; 7 | 8 | public interface AdminRepository extends CrudUtil { 9 | 10 | int getIdFormUsernamePassword(String username, String password); 11 | 12 | int getIdFormUsername(String username); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/BookRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom; 2 | 3 | import lk.ijse.library_management.entity.Book; 4 | import lk.ijse.library_management.repository.SuperRepository; 5 | import lk.ijse.library_management.util.CrudUtil; 6 | 7 | import java.util.List; 8 | 9 | public interface BookRepository extends CrudUtil { 10 | 11 | List getAllTitles(); 12 | 13 | Book getBookFormTitle(String title); 14 | 15 | String getAuthorFormTitle(String title); 16 | 17 | int getIdFormTitle(String title); 18 | 19 | int getCount(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/BranchRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom; 2 | 3 | import lk.ijse.library_management.entity.Branch; 4 | import lk.ijse.library_management.repository.SuperRepository; 5 | import lk.ijse.library_management.util.CrudUtil; 6 | import org.hibernate.Session; 7 | 8 | import java.util.List; 9 | 10 | public interface BranchRepository extends CrudUtil { 11 | void setSession(Session session); 12 | 13 | List getAllId(); 14 | 15 | int getIdFormLocation(String location); 16 | 17 | int getCount(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/MemberRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom; 2 | 3 | import lk.ijse.library_management.entity.Member; 4 | import lk.ijse.library_management.repository.SuperRepository; 5 | import lk.ijse.library_management.util.CrudUtil; 6 | 7 | import java.util.List; 8 | 9 | public interface MemberRepository extends CrudUtil { 10 | 11 | int getIdFormUsername(String username); 12 | 13 | int getIdFormUsernamePassword(String username, String password); 14 | 15 | int getIdFormMobile(String mobile); 16 | 17 | int getCount(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/TransactionDetailRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom; 2 | 3 | import lk.ijse.library_management.embedded.TransactionDetailPK; 4 | import lk.ijse.library_management.entity.TransactionDetails; 5 | import lk.ijse.library_management.repository.SuperRepository; 6 | 7 | public interface TransactionDetailRepository extends SuperRepository { 8 | TransactionDetailPK save(TransactionDetails entity); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/TransactionRepository.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom; 2 | 3 | import lk.ijse.library_management.entity.Member; 4 | import lk.ijse.library_management.entity.Transaction; 5 | import lk.ijse.library_management.entity.TransactionDetails; 6 | import lk.ijse.library_management.projection.AdminTransactionProjection; 7 | import lk.ijse.library_management.projection.MemberTransactionProjection; 8 | import lk.ijse.library_management.util.CrudUtil; 9 | 10 | import java.util.List; 11 | 12 | public interface TransactionRepository extends CrudUtil { 13 | 14 | List getTransactionDetails(Transaction entity); 15 | 16 | List getAllToMember(Member member); 17 | 18 | int getDueCount(); 19 | 20 | List getAllTransactionProjection(); 21 | 22 | int getReturnBookCountOfMember(Member entity); 23 | 24 | int getReturnedCountOfMember(Member entity); 25 | 26 | int getDueCountOfMember(Member entity); 27 | 28 | List getAllTransactionProjectionOfMember(Member entity); 29 | 30 | int getBorrowBookCountOfMember(Member entity); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/impl/AdminRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom.impl; 2 | 3 | import lk.ijse.library_management.entity.Admin; 4 | import lk.ijse.library_management.repository.custom.AdminRepository; 5 | import org.hibernate.Session; 6 | import org.hibernate.query.Query; 7 | 8 | import java.util.List; 9 | 10 | public class AdminRepositoryImpl implements AdminRepository { 11 | 12 | private Session session; 13 | 14 | @Override 15 | public int save(Admin entity) { 16 | return (int) session.save(entity); 17 | } 18 | 19 | @Override 20 | public Admin get(int id) { 21 | return session.get(Admin.class, id); 22 | } 23 | 24 | @Override 25 | public List getAll() { 26 | return null; 27 | } 28 | 29 | @Override 30 | public int getIdFormUsernamePassword(String username, String password) { 31 | String hql = "SELECT a.id FROM Admin a WHERE a.username = :username AND a.password = :password"; 32 | 33 | Query query = session.createQuery(hql, Integer.class); 34 | query.setParameter("username", username); 35 | query.setParameter("password", password); 36 | 37 | Integer id = query.uniqueResult(); 38 | return (id != null) ? id : -1; 39 | } 40 | 41 | @Override 42 | public void delete(Admin entity) { 43 | session.delete(entity); 44 | } 45 | 46 | @Override 47 | public int getIdFormUsername(String username) { 48 | String hql = "SELECT a.id FROM Admin a WHERE a.username = :username"; 49 | 50 | Query query = session.createQuery(hql, Integer.class); 51 | query.setParameter("username", username); 52 | 53 | Integer id = query.uniqueResult(); 54 | return id; 55 | } 56 | 57 | @Override 58 | public void update(Admin entity) { 59 | session.update(entity); 60 | } 61 | 62 | @Override 63 | public void setSession(Session session) { 64 | this.session = session; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/impl/BookRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom.impl; 2 | 3 | import lk.ijse.library_management.entity.Book; 4 | import lk.ijse.library_management.repository.custom.BookRepository; 5 | import org.hibernate.Session; 6 | import org.hibernate.query.Query; 7 | 8 | import java.util.List; 9 | 10 | public class BookRepositoryImpl implements BookRepository { 11 | 12 | private Session session; 13 | 14 | @Override 15 | public void setSession(Session session) { 16 | this.session = session; 17 | } 18 | 19 | @Override 20 | public List getAll() { 21 | String hql = "SELECT b FROM Book b"; 22 | 23 | Query query = session.createQuery(hql, Book.class); 24 | 25 | List list = query.list(); 26 | 27 | return list; 28 | } 29 | 30 | @Override 31 | public int save(Book entity) { 32 | return (int) session.save(entity); 33 | } 34 | 35 | @Override 36 | public Book get(int id) { 37 | return session.get(Book.class, id); 38 | } 39 | 40 | @Override 41 | public void delete(Book book) { 42 | session.update(book); 43 | } 44 | 45 | @Override 46 | public void update(Book entity) { 47 | session.update(entity); 48 | } 49 | 50 | @Override 51 | public List getAllTitles() { 52 | String status = "Available"; 53 | String hql = "SELECT b.title FROM Book b WHERE b.availability = :availability"; 54 | 55 | Query query = session.createQuery(hql); 56 | query.setParameter("availability", status); 57 | 58 | return query.list(); 59 | } 60 | 61 | @Override 62 | public Book getBookFormTitle(String title) { 63 | String status = "Available"; 64 | String hql = "SELECT b FROM Book b WHERE b.title = :title AND b.availability = :availability"; 65 | 66 | Query query = session.createQuery(hql, Book.class); 67 | query.setParameter("title", title); 68 | query.setParameter("availability", status); 69 | 70 | return query.uniqueResult(); 71 | } 72 | 73 | @Override 74 | public String getAuthorFormTitle(String title) { 75 | String hql = "SELECT b.author FROM Book b WHERE b.title = :title"; 76 | 77 | Query query = session.createQuery(hql); 78 | query.setParameter("title", title); 79 | 80 | return (String) query.uniqueResult(); 81 | } 82 | 83 | @Override 84 | public int getIdFormTitle(String title) { 85 | String hql = "SELECT b.id FROM Book b WHERE b.title = :title"; 86 | 87 | Query query = session.createQuery(hql); 88 | query.setParameter("title", title); 89 | 90 | Object id = query.uniqueResult(); 91 | 92 | if (id == null) return -1; 93 | 94 | return (int) id; 95 | } 96 | 97 | @Override 98 | public int getCount() { 99 | String hql = "SELECT COUNT (b) FROM Book b WHERE b.availability = 'Available' OR b.availability = 'Not Available'"; 100 | 101 | Query query = session.createQuery(hql); 102 | 103 | Long count = (Long) query.uniqueResult(); 104 | 105 | return Math.toIntExact(count); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/impl/BranchRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom.impl; 2 | 3 | import lk.ijse.library_management.entity.Branch; 4 | import lk.ijse.library_management.repository.custom.BranchRepository; 5 | import org.hibernate.Session; 6 | import org.hibernate.query.Query; 7 | 8 | import java.util.List; 9 | 10 | public class BranchRepositoryImpl implements BranchRepository { 11 | private Session session; 12 | 13 | @Override 14 | public void setSession(Session session) { 15 | this.session = session; 16 | } 17 | 18 | @Override 19 | public int save(Branch branch) { 20 | return (int) session.save(branch); 21 | } 22 | 23 | @Override 24 | public Branch get(int id) { 25 | return session.get(Branch.class, id); 26 | } 27 | 28 | @Override 29 | public List getAll() { 30 | return null; 31 | } 32 | 33 | @Override 34 | public void update(Branch entity) { 35 | session.update(entity); 36 | } 37 | 38 | @Override 39 | public void delete(Branch entity) { 40 | session.delete(entity); 41 | } 42 | 43 | @Override 44 | public List getAllId() { 45 | String hql = "SELECT b FROM Branch b"; 46 | 47 | Query query = session.createQuery(hql, Branch.class); 48 | 49 | List list = query.list(); 50 | 51 | return list; 52 | } 53 | 54 | @Override 55 | public int getIdFormLocation(String location) { 56 | try { 57 | String hql = "SELECT b.id FROM Branch b WHERE b.location = :location"; 58 | 59 | Query query = session.createQuery(hql); 60 | query.setParameter("location", location); 61 | 62 | return (int) query.uniqueResult(); 63 | 64 | } catch (Exception e) { 65 | return -1; 66 | } 67 | } 68 | 69 | @Override 70 | public int getCount() { 71 | String hql = "SELECT COUNT (b) FROM Branch b"; 72 | 73 | Query query = session.createQuery(hql); 74 | 75 | Long count = (Long) query.uniqueResult(); 76 | 77 | return Math.toIntExact(count); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/impl/MemberRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom.impl; 2 | 3 | import lk.ijse.library_management.entity.Member; 4 | import lk.ijse.library_management.repository.custom.MemberRepository; 5 | import org.hibernate.Session; 6 | import org.hibernate.query.Query; 7 | 8 | import java.util.List; 9 | 10 | public class MemberRepositoryImpl implements MemberRepository { 11 | 12 | private Session session; 13 | 14 | @Override 15 | public void setSession(Session session) { 16 | this.session = session; 17 | } 18 | 19 | @Override 20 | public Member get(int id) { 21 | return session.get(Member.class, id); 22 | } 23 | 24 | @Override 25 | public List getAll() { 26 | String hql = "SELECT m FROM Member m"; 27 | 28 | Query query = session.createQuery(hql, Member.class); 29 | 30 | return query.list(); 31 | } 32 | 33 | @Override 34 | public void delete(Member entity) { 35 | session.delete(entity); 36 | } 37 | 38 | @Override 39 | public int getIdFormUsername(String username) { 40 | String hql = "SELECT m.id FROM Member m WHERE m.username = :username"; 41 | 42 | Query query = session.createQuery(hql, Integer.class); 43 | query.setParameter("username", username); 44 | 45 | Integer id = query.uniqueResult(); 46 | return (id != null) ? id : -1; 47 | } 48 | 49 | @Override 50 | public int save(Member entity) { 51 | return (int) session.save(entity); 52 | } 53 | 54 | @Override 55 | public int getIdFormUsernamePassword(String username, String password) { 56 | String hql = "SELECT m.id FROM Member m WHERE m.username = :username AND m.password = :password"; 57 | 58 | Query query = session.createQuery(hql, Integer.class); 59 | query.setParameter("username", username); 60 | query.setParameter("password", password); 61 | 62 | Integer id = query.uniqueResult(); 63 | return (id != null) ? id : -1; 64 | } 65 | 66 | @Override 67 | public void update(Member entity) { 68 | session.update(entity); 69 | } 70 | 71 | @Override 72 | public int getIdFormMobile(String mobile) { 73 | String hql = "SELECT m.id FROM Member m WHERE m.mobile = :mobile"; 74 | 75 | Query query = session.createQuery(hql, Integer.class); 76 | query.setParameter("mobile", mobile); 77 | 78 | Integer id = query.uniqueResult(); 79 | return (id != null) ? id : -1; 80 | } 81 | 82 | @Override 83 | public int getCount() { 84 | String hql = "SELECT COUNT (m) FROM Member m"; 85 | 86 | Query query = session.createQuery(hql); 87 | 88 | Long count = (Long) query.uniqueResult(); 89 | 90 | return Math.toIntExact(count); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/repository/custom/impl/TransactionDetailRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.repository.custom.impl; 2 | 3 | import lk.ijse.library_management.embedded.TransactionDetailPK; 4 | import lk.ijse.library_management.entity.TransactionDetails; 5 | import lk.ijse.library_management.repository.custom.TransactionDetailRepository; 6 | import org.hibernate.Session; 7 | 8 | public class TransactionDetailRepositoryImpl implements TransactionDetailRepository { 9 | 10 | private Session session; 11 | 12 | @Override 13 | public void setSession(Session session) { 14 | this.session = session; 15 | } 16 | 17 | @Override 18 | public TransactionDetailPK save(TransactionDetails entity) { 19 | return (TransactionDetailPK) session.save(entity); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/ServiceFactory.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service; 2 | 3 | import lk.ijse.library_management.service.custom.impl.*; 4 | 5 | public class ServiceFactory { 6 | public static ServiceFactory factory; 7 | 8 | public ServiceFactory () { 9 | 10 | } 11 | 12 | public static ServiceFactory getInstance() { 13 | return (factory == null) ? factory = new ServiceFactory() : factory; 14 | } 15 | 16 | public enum ServiceType { 17 | BRANCH, SIGNIN, SIGNUP, ADMINPROFILE, BOOK, MEMBER, MEMBERPROFILE, MEMBERSIGNUP, MEMBERSIGNIN, TRANSACTION, DASHBOARD 18 | } 19 | 20 | public SuperService getService (ServiceType type) { 21 | switch (type) { 22 | case BRANCH: 23 | return new BranchServiceImpl(); 24 | case SIGNUP: 25 | return new AdminSignUpServiceImpl(); 26 | case ADMINPROFILE: 27 | return new AdminProfileServiceImpl(); 28 | case SIGNIN: 29 | return new AdminSignInServiceImpl(); 30 | case BOOK: 31 | return new BookServiceImpl(); 32 | case MEMBER: 33 | return new MemberServiceImpl(); 34 | case MEMBERPROFILE: 35 | return new MemberProfileServiceImpl(); 36 | case MEMBERSIGNUP: 37 | return new MemberSignUpServiceImpl(); 38 | case MEMBERSIGNIN: 39 | return new MemberSignInServiceImpl(); 40 | case TRANSACTION: 41 | return new TransactionServiceImpl(); 42 | case DASHBOARD: 43 | return new DashboardServiceImpl(); 44 | default: 45 | return null; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/SuperService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service; 2 | 3 | public interface SuperService { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/AdminProfileService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.service.SuperService; 5 | 6 | public interface AdminProfileService extends SuperService { 7 | AdminDto getAdminData(int id); 8 | 9 | int getIdFromUsernamePassword(String username, String password); 10 | 11 | int getIdFromUsername(String username); 12 | 13 | void deleteAdmin(int id); 14 | 15 | boolean updateAdminPassword(int id, String oldPassword, String newPassword); 16 | 17 | void sendAccountDeletionEmail(String email); 18 | 19 | void sendPasswordChangeEmail(String email); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/AdminSignInService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.service.SuperService; 5 | 6 | public interface AdminSignInService extends SuperService { 7 | int getIdFromUsernamePassword(String username, String password); 8 | 9 | int getIdFormUsername(String username); 10 | 11 | AdminDto getAdminData(int id); 12 | 13 | void sendEmail(String... data); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/AdminSignUpService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.service.SuperService; 5 | 6 | import java.sql.SQLException; 7 | 8 | public interface AdminSignUpService extends SuperService { 9 | void sendEmail ( String... data); 10 | 11 | boolean saveAdmin(AdminDto adminDto) throws SQLException; 12 | 13 | boolean updateAdmin(AdminDto dto); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/BookService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.dto.BookDto; 5 | import lk.ijse.library_management.service.SuperService; 6 | 7 | import java.util.List; 8 | 9 | public interface BookService extends SuperService { 10 | List getAllBookData(); 11 | 12 | int getIdFromUsername(String username); 13 | 14 | AdminDto getAdminData(int id); 15 | 16 | boolean saveBook(BookDto dto); 17 | 18 | BookDto getBookData(int id); 19 | 20 | boolean deleteBook(int id); 21 | 22 | boolean updateBook(BookDto dto); 23 | 24 | int getBookIdFormTitle(String title); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/BranchService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.dto.BranchDto; 5 | import lk.ijse.library_management.service.SuperService; 6 | 7 | import java.util.List; 8 | 9 | public interface BranchService extends SuperService { 10 | boolean saveBranch(BranchDto branchDto); 11 | 12 | int getIdFromUsername(String username); 13 | 14 | AdminDto getAdminData(int id); 15 | 16 | BranchDto getBranchData(int id); 17 | 18 | boolean updateBranch(BranchDto branchDto); 19 | 20 | void deleteBranch(int id); 21 | 22 | List getAllBranchData(); 23 | 24 | int getIdFormLocation(String location); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/DashboardService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.projection.AdminTransactionProjection; 5 | import lk.ijse.library_management.projection.MemberTransactionProjection; 6 | import lk.ijse.library_management.service.SuperService; 7 | 8 | import java.util.List; 9 | 10 | public interface DashboardService extends SuperService { 11 | int getMemberCount(); 12 | 13 | int getBookCount(); 14 | 15 | int getDueTransactionCount(); 16 | 17 | int getBranchCount(); 18 | 19 | List getAllTransactions(); 20 | 21 | int getMemberIdFormMobile(String mobile); 22 | 23 | int getMemberIdFormUsername(String username); 24 | 25 | MemberDto getMemberData(int id); 26 | 27 | int getMemberReadBookCount(MemberDto dto); 28 | 29 | int getMemberReturnedCount(MemberDto dto); 30 | 31 | int getMemberDueCount(MemberDto dto); 32 | 33 | List getAllTransactionsOfMember(MemberDto dto); 34 | 35 | int getMemberBorrowBookCount(MemberDto dto); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/MemberProfileService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.service.SuperService; 5 | 6 | public interface MemberProfileService extends SuperService { 7 | int getIdFromUsername(String username); 8 | 9 | MemberDto getMemberData(int id); 10 | 11 | int getIdFromUsernamePassword(String username, String password); 12 | 13 | void deleteMember(int id); 14 | 15 | boolean updateMemberPassword(int id, String currentPass, String newPass); 16 | 17 | void sendAccountDeletionEmail(String email); 18 | 19 | void sendPasswordChangeEmail(String email); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/MemberService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.entity.Member; 5 | import lk.ijse.library_management.service.SuperService; 6 | 7 | import java.util.List; 8 | 9 | public interface MemberService extends SuperService { 10 | MemberDto getMemberData(int id); 11 | 12 | List getAllMemberData(); 13 | 14 | boolean deleteTransactionsOfMember(Member member); 15 | 16 | boolean deleteMember(int id); 17 | 18 | int getMemberIdFormMobile(String mobile); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/MemberSignInService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.service.SuperService; 5 | 6 | public interface MemberSignInService extends SuperService { 7 | int getIdFromUsernamePassword(String username, String password); 8 | 9 | int getIdFormUsername(String username); 10 | 11 | MemberDto getMemberData(int id); 12 | 13 | void sendEmail(String... data); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/MemberSignUpService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.service.SuperService; 5 | 6 | import java.sql.SQLException; 7 | 8 | public interface MemberSignUpService extends SuperService { 9 | boolean saveMember(MemberDto memberDto) throws SQLException; 10 | 11 | boolean updateMember(MemberDto dto); 12 | 13 | void sendEmail(String... data); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/TransactionService.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom; 2 | 3 | import lk.ijse.library_management.dto.BookDto; 4 | import lk.ijse.library_management.dto.MemberDto; 5 | import lk.ijse.library_management.dto.TransactionDetailsDto; 6 | import lk.ijse.library_management.dto.TransactionDto; 7 | import lk.ijse.library_management.service.SuperService; 8 | 9 | import java.util.List; 10 | 11 | public interface TransactionService extends SuperService { 12 | List getAllBookTitles(); 13 | 14 | BookDto getBookDataFromTitle(String title); 15 | 16 | boolean saveTransaction(TransactionDto dto, MemberDto member, List books); 17 | 18 | MemberDto getMemberFromUsername(String username); 19 | 20 | String getBookAuthorFromTitle(String title); 21 | 22 | List getAllTransactionData(); 23 | 24 | TransactionDto getTransactionData(int id); 25 | 26 | List getTransactionDetails(TransactionDto dto); 27 | 28 | boolean updateTransaction(int id); 29 | 30 | List getAllTransactionDataToUsername(String username); 31 | 32 | void updateTransactionStatus(List updateList); 33 | 34 | MemberDto getMemberData(int id); 35 | 36 | List getAllTransactionDataToId(int id); 37 | 38 | int getMemberIdFormMobile(String mobile); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/impl/AdminSignInServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom.impl; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.entity.Admin; 5 | import lk.ijse.library_management.repository.RepositoryFactory; 6 | import lk.ijse.library_management.repository.custom.AdminRepository; 7 | import lk.ijse.library_management.repository.custom.impl.AdminRepositoryImpl; 8 | import lk.ijse.library_management.service.custom.AdminSignInService; 9 | import lk.ijse.library_management.util.SendEmail; 10 | import lk.ijse.library_management.util.SessionFactoryConfig; 11 | import org.hibernate.Session; 12 | 13 | import javax.mail.MessagingException; 14 | 15 | public class AdminSignInServiceImpl implements AdminSignInService { 16 | 17 | private Session session; 18 | 19 | private final AdminRepository adminRepository = 20 | (AdminRepositoryImpl) RepositoryFactory.getInstance().getRepository(RepositoryFactory.RepositoryType.ADMIN); 21 | 22 | @Override 23 | public int getIdFromUsernamePassword(String username, String password) { 24 | 25 | session = SessionFactoryConfig.getInstance().getSession(); 26 | 27 | try { 28 | 29 | adminRepository.setSession(session); 30 | int id = adminRepository.getIdFormUsernamePassword(username, password); 31 | return id; 32 | 33 | } catch (Exception e) { 34 | 35 | e.printStackTrace(); 36 | return -1; 37 | 38 | } finally { 39 | session.close(); 40 | } 41 | } 42 | 43 | @Override 44 | public int getIdFormUsername(String username) { 45 | session = SessionFactoryConfig.getInstance().getSession(); 46 | 47 | try { 48 | 49 | adminRepository.setSession(session); 50 | int id = adminRepository.getIdFormUsername(username); 51 | return id; 52 | 53 | } catch (Exception e) { 54 | 55 | e.printStackTrace(); 56 | return -1; 57 | 58 | } finally { 59 | session.close(); 60 | } 61 | } 62 | 63 | @Override 64 | public AdminDto getAdminData(int id) { 65 | session = SessionFactoryConfig.getInstance().getSession(); 66 | 67 | try { 68 | 69 | adminRepository.setSession(session); 70 | Admin admin = adminRepository.get(id); 71 | return admin.toDto(); 72 | 73 | } catch (Exception e) { 74 | 75 | e.printStackTrace(); 76 | return null; 77 | 78 | } finally { 79 | session.close(); 80 | } 81 | } 82 | 83 | @Override 84 | public void sendEmail(String... data) { 85 | SendEmail sendEmail = new SendEmail (); 86 | new Thread(()->{ 87 | try { 88 | sendEmail.sendEmail(data[0], data[1], data[2], data[3]); 89 | } catch ( MessagingException e) { 90 | throw new RuntimeException(e); 91 | } 92 | }).start(); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/impl/AdminSignUpServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom.impl; 2 | 3 | import lk.ijse.library_management.dto.AdminDto; 4 | import lk.ijse.library_management.repository.RepositoryFactory; 5 | import lk.ijse.library_management.repository.custom.AdminRepository; 6 | import lk.ijse.library_management.service.custom.AdminSignUpService; 7 | import lk.ijse.library_management.util.SendEmail; 8 | import lk.ijse.library_management.util.SessionFactoryConfig; 9 | import org.hibernate.Session; 10 | import org.hibernate.Transaction; 11 | 12 | import javax.mail.MessagingException; 13 | import java.sql.SQLException; 14 | 15 | public class AdminSignUpServiceImpl implements AdminSignUpService { 16 | 17 | private Session session; 18 | 19 | private final AdminRepository adminRepository = 20 | (AdminRepository) RepositoryFactory.getInstance().getRepository(RepositoryFactory.RepositoryType.ADMIN); 21 | 22 | @Override 23 | public void sendEmail(String... data) { 24 | SendEmail sendEmail = new SendEmail (); 25 | new Thread(()->{ 26 | try { 27 | sendEmail.sendEmail(data[0], data[1], data[2], data[3]); 28 | } catch ( MessagingException e) { 29 | throw new RuntimeException(e); 30 | } 31 | }).start(); 32 | } 33 | 34 | @Override 35 | public boolean saveAdmin(AdminDto adminDto) throws SQLException { 36 | session = SessionFactoryConfig.getInstance().getSession(); 37 | 38 | Transaction transaction = session.beginTransaction(); 39 | 40 | try { 41 | 42 | adminRepository.setSession(session); 43 | int id = adminRepository.save(adminDto.toEntity()); 44 | transaction.commit(); 45 | return id > 0; 46 | 47 | } catch (Exception e) { 48 | 49 | transaction.rollback(); 50 | throw e; 51 | 52 | } finally { 53 | session.close(); 54 | } 55 | } 56 | 57 | @Override 58 | public boolean updateAdmin(AdminDto dto) { 59 | session = SessionFactoryConfig.getInstance().getSession(); 60 | 61 | Transaction transaction = session.beginTransaction(); 62 | 63 | try { 64 | 65 | adminRepository.setSession(session); 66 | adminRepository.update(dto.toEntity()); 67 | transaction.commit(); 68 | return true; 69 | 70 | } catch (Exception e) { 71 | 72 | transaction.rollback(); 73 | e.printStackTrace(); 74 | return false; 75 | 76 | } finally { 77 | session.close(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/impl/MemberSignInServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom.impl; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.entity.Member; 5 | import lk.ijse.library_management.repository.RepositoryFactory; 6 | import lk.ijse.library_management.repository.custom.MemberRepository; 7 | import lk.ijse.library_management.repository.custom.impl.MemberRepositoryImpl; 8 | import lk.ijse.library_management.service.custom.MemberSignInService; 9 | import lk.ijse.library_management.util.SendEmail; 10 | import lk.ijse.library_management.util.SessionFactoryConfig; 11 | import org.hibernate.Session; 12 | import org.hibernate.Transaction; 13 | 14 | import javax.mail.MessagingException; 15 | 16 | public class MemberSignInServiceImpl implements MemberSignInService { 17 | 18 | private Session session; 19 | 20 | private final MemberRepository memberRepository = 21 | (MemberRepositoryImpl) RepositoryFactory.getInstance().getRepository(RepositoryFactory.RepositoryType.MEMBER); 22 | 23 | @Override 24 | public int getIdFromUsernamePassword(String username, String password) { 25 | session = SessionFactoryConfig.getInstance().getSession(); 26 | 27 | Transaction transaction = session.beginTransaction(); 28 | 29 | try { 30 | 31 | memberRepository.setSession(session); 32 | int id = memberRepository.getIdFormUsernamePassword(username, password); 33 | transaction.commit(); 34 | return id; 35 | 36 | } catch (Exception e) { 37 | 38 | transaction.rollback(); 39 | e.printStackTrace(); 40 | return -1; 41 | 42 | } finally { 43 | session.close(); 44 | } 45 | } 46 | 47 | @Override 48 | public int getIdFormUsername(String username) { 49 | session = SessionFactoryConfig.getInstance().getSession(); 50 | 51 | try { 52 | 53 | memberRepository.setSession(session); 54 | int id = memberRepository.getIdFormUsername(username); 55 | return id; 56 | 57 | } catch (Exception e) { 58 | 59 | e.printStackTrace(); 60 | return -1; 61 | 62 | } finally { 63 | session.close(); 64 | } 65 | } 66 | 67 | @Override 68 | public MemberDto getMemberData(int id) { 69 | session = SessionFactoryConfig.getInstance().getSession(); 70 | 71 | try { 72 | 73 | memberRepository.setSession(session); 74 | Member member = memberRepository.get(id); 75 | return member.toDto(); 76 | 77 | } catch (Exception e) { 78 | 79 | e.printStackTrace(); 80 | return null; 81 | 82 | } finally { 83 | session.close(); 84 | } 85 | } 86 | 87 | @Override 88 | public void sendEmail(String... data) { 89 | SendEmail sendEmail = new SendEmail (); 90 | new Thread(()->{ 91 | try { 92 | sendEmail.sendEmail(data[0], data[1], data[2], data[3]); 93 | } catch ( MessagingException e) { 94 | throw new RuntimeException(e); 95 | } 96 | }).start(); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/service/custom/impl/MemberSignUpServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.service.custom.impl; 2 | 3 | import lk.ijse.library_management.dto.MemberDto; 4 | import lk.ijse.library_management.repository.RepositoryFactory; 5 | import lk.ijse.library_management.repository.custom.MemberRepository; 6 | import lk.ijse.library_management.repository.custom.impl.MemberRepositoryImpl; 7 | import lk.ijse.library_management.service.custom.MemberSignUpService; 8 | import lk.ijse.library_management.util.SendEmail; 9 | import lk.ijse.library_management.util.SessionFactoryConfig; 10 | import org.hibernate.Session; 11 | import org.hibernate.Transaction; 12 | 13 | import javax.mail.MessagingException; 14 | import java.sql.SQLException; 15 | 16 | public class MemberSignUpServiceImpl implements MemberSignUpService { 17 | 18 | private Session session; 19 | 20 | private final MemberRepository memberRepository = 21 | (MemberRepositoryImpl) RepositoryFactory.getInstance().getRepository(RepositoryFactory.RepositoryType.MEMBER); 22 | 23 | @Override 24 | public boolean saveMember(MemberDto memberDto) throws SQLException { 25 | session = SessionFactoryConfig.getInstance().getSession(); 26 | 27 | Transaction transaction = session.beginTransaction(); 28 | 29 | try { 30 | 31 | memberRepository.setSession(session); 32 | int id = memberRepository.save(memberDto.toEntity()); 33 | transaction.commit(); 34 | return id > 0; 35 | 36 | } catch (Exception e) { 37 | 38 | transaction.rollback(); 39 | throw e; 40 | 41 | } finally { 42 | session.close(); 43 | } 44 | } 45 | 46 | @Override 47 | public boolean updateMember(MemberDto dto) { 48 | session = SessionFactoryConfig.getInstance().getSession(); 49 | 50 | Transaction transaction = session.beginTransaction(); 51 | 52 | try { 53 | 54 | memberRepository.setSession(session); 55 | memberRepository.update(dto.toEntity()); 56 | transaction.commit(); 57 | return true; 58 | 59 | } catch (Exception e) { 60 | 61 | transaction.rollback(); 62 | e.printStackTrace(); 63 | return false; 64 | 65 | } finally { 66 | session.close(); 67 | } 68 | } 69 | 70 | @Override 71 | public void sendEmail(String... data) { 72 | SendEmail sendEmail = new SendEmail (); 73 | new Thread(()->{ 74 | try { 75 | sendEmail.sendEmail(data[0], data[1], data[2], data[3]); 76 | } catch ( MessagingException e) { 77 | throw new RuntimeException(e); 78 | } 79 | }).start(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/CrudUtil.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util; 2 | 3 | import lk.ijse.library_management.entity.Member; 4 | import lk.ijse.library_management.repository.SuperRepository; 5 | 6 | import java.sql.SQLException; 7 | import java.util.List; 8 | 9 | public interface CrudUtil extends SuperRepository { 10 | int save(final T entity) throws SQLException; 11 | 12 | void delete(final T id) throws SQLException; 13 | 14 | void update(final T entity) throws SQLException; 15 | 16 | T get(final int id) throws SQLException; 17 | 18 | List getAll(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/OTPGenerator.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util; 2 | 3 | import java.util.Random; 4 | 5 | public class OTPGenerator { 6 | public static String generateOTP() { 7 | int length = 6; 8 | 9 | String numbers = "0123456789"; 10 | 11 | Random rndm_method = new Random(); 12 | 13 | char[] otp = new char[length]; 14 | 15 | for (int i = 0; i < length; i++) { 16 | otp[i] = numbers.charAt(rndm_method.nextInt(numbers.length())); 17 | } 18 | 19 | return new String(otp); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/Regex.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | public class Regex { 6 | public static boolean fullName(String name) { 7 | return !Pattern.matches("([A-Za-z\\s]{3,})", name); 8 | } 9 | 10 | public static boolean genre(String genre) { 11 | return !Pattern.matches("([A-Za-z\\s]{3,})", genre); 12 | } 13 | 14 | public static boolean name(String name) { 15 | return !Pattern.matches("([A-Za-z]{3,})", name); 16 | } 17 | 18 | public static boolean mobile(String mobile) { 19 | return !Pattern.matches("(0\\d{1,9})", mobile); 20 | } 21 | 22 | public static boolean email(String email) { 23 | return !Pattern.matches("([A-Za-z0-9]{3,}@[A-Za-z]{3,}\\.[A-Za-z]+)", email); 24 | } 25 | 26 | public static boolean address(String address) { 27 | return !Pattern.matches("([A-Za-z0-9/\",\\s]{3,})", address); 28 | } 29 | 30 | public static boolean userName(String user) { 31 | return !Pattern.matches("[A-Za-z]+", user); 32 | } 33 | 34 | public static boolean title(String desc) { 35 | return !Pattern.matches("[A-Z][A-Za-z\\s]{2,}", desc); 36 | } 37 | 38 | public static boolean password(String password) { 39 | return !Pattern.matches("([ -~]{6,20})", password); 40 | } 41 | 42 | public static boolean otp(String otp) { 43 | return !Pattern.matches("\\d{6}", otp); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/SessionFactoryConfig.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util; 2 | 3 | import lk.ijse.library_management.entity.*; 4 | import org.hibernate.HibernateException; 5 | import org.hibernate.Session; 6 | import org.hibernate.SessionFactory; 7 | import org.hibernate.cfg.Configuration; 8 | 9 | public class SessionFactoryConfig { 10 | 11 | private static SessionFactoryConfig factoryConfiguration; 12 | private final SessionFactory sessionFactory; 13 | 14 | private SessionFactoryConfig() { 15 | sessionFactory = new Configuration() 16 | .mergeProperties(Utility.getProperties()) 17 | .addAnnotatedClass(Branch.class) 18 | .addAnnotatedClass(Admin.class) 19 | .addAnnotatedClass(Book.class) 20 | .addAnnotatedClass(Member.class) 21 | .addAnnotatedClass(Transaction.class) 22 | .addAnnotatedClass(TransactionDetails.class) 23 | .buildSessionFactory(); 24 | } 25 | 26 | public static SessionFactoryConfig getInstance() { 27 | return (null == factoryConfiguration) 28 | ? factoryConfiguration = new SessionFactoryConfig() 29 | : factoryConfiguration; 30 | } 31 | 32 | public Session getSession() throws HibernateException { 33 | return sessionFactory.openSession(); 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/Utility.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util; 2 | 3 | import java.io.IOException; 4 | import java.util.Properties; 5 | 6 | public class Utility { 7 | 8 | public static Properties getProperties() { 9 | Properties properties = new Properties(); 10 | try { 11 | properties.load(ClassLoader 12 | .getSystemClassLoader() 13 | .getResourceAsStream("hibernate.properties")); 14 | } catch (IOException e) { 15 | System.out.println("Property file not found!"); 16 | e.printStackTrace(); 17 | } 18 | return properties; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/navigation/AdminNavigation.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util.navigation; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Parent; 6 | import javafx.scene.Scene; 7 | import javafx.scene.layout.AnchorPane; 8 | import javafx.stage.Stage; 9 | import javafx.scene.Node; 10 | import javafx.stage.StageStyle; 11 | import lk.ijse.library_management.controller.admin.AdminGlobalFormController; 12 | import lk.ijse.library_management.controller.admin.AdminGlobalLoginFormController; 13 | import lk.ijse.library_management.controller.admin.SignInFormController; 14 | 15 | 16 | import java.io.IOException; 17 | 18 | public class AdminNavigation { 19 | 20 | private static Parent parent; 21 | private static Stage stage; 22 | private static Scene scene; 23 | 24 | public static void switchNavigation(String path, ActionEvent event) throws IOException { 25 | parent = FXMLLoader.load(AdminNavigation.class.getResource("/view/admin/" + path)); 26 | stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); 27 | SignInFormController.stage = stage; 28 | scene = new Scene(parent); 29 | stage.setScene(scene); 30 | stage.centerOnScreen(); 31 | stage.show(); 32 | } 33 | 34 | public static void switchPaging(String path) throws IOException { 35 | AdminGlobalFormController.getInstance().pagingPane.getChildren().clear(); 36 | FXMLLoader loader = new FXMLLoader(AdminNavigation.class.getResource("/view/admin/"+path)); 37 | Parent root = loader.load(); 38 | AdminGlobalFormController.getInstance().pagingPane.getChildren().add(root); 39 | } 40 | 41 | public static void popupPane(String path) throws IOException { 42 | 43 | AdminGlobalFormController.getInstance().popUpPane.setVisible(true); 44 | AdminGlobalFormController.getInstance().imgGreyBack.setVisible(true); 45 | 46 | AnchorPane root = FXMLLoader.load(AdminNavigation.class.getResource("/view/admin/" + path)); 47 | 48 | Stage popupStage = new Stage(); 49 | AdminGlobalFormController.getInstance().setPopupStage(popupStage); 50 | popupStage.setScene(new Scene(root)); 51 | popupStage.centerOnScreen(); 52 | popupStage.initOwner(AdminGlobalFormController.getInstance().popUpPane.getScene().getWindow()); 53 | popupStage.initStyle(StageStyle.UNDECORATED); 54 | popupStage.show(); 55 | } 56 | 57 | public static void switchLoginPage(String path) throws IOException { 58 | AdminGlobalLoginFormController.getInstance().loginPane.getChildren().clear(); 59 | FXMLLoader loader = new FXMLLoader(AdminNavigation.class.getResource("/view/admin/"+path)); 60 | Parent root = loader.load(); 61 | AdminGlobalLoginFormController.getInstance().loginPane.getChildren().add(root); 62 | } 63 | 64 | public static void closePane(){ 65 | AdminGlobalFormController.getInstance().popUpPane.getChildren().clear(); 66 | AdminGlobalFormController.getInstance().popupStage.close(); 67 | AdminGlobalFormController.getInstance().popUpPane.setVisible(false); 68 | AdminGlobalFormController.getInstance().imgGreyBack.setVisible(false); 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /src/main/java/lk/ijse/library_management/util/navigation/MemberNavigation.java: -------------------------------------------------------------------------------- 1 | package lk.ijse.library_management.util.navigation; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Parent; 6 | import javafx.scene.Scene; 7 | import javafx.scene.layout.AnchorPane; 8 | import javafx.stage.Stage; 9 | import javafx.scene.Node; 10 | import javafx.stage.StageStyle; 11 | import lk.ijse.library_management.controller.admin.AdminGlobalLoginFormController; 12 | import lk.ijse.library_management.controller.admin.SignInFormController; 13 | import lk.ijse.library_management.controller.member.MemberGlobalFormController; 14 | import lk.ijse.library_management.controller.member.MemberGlobalLoginFormController; 15 | 16 | 17 | import java.io.IOException; 18 | 19 | public class MemberNavigation { 20 | 21 | private static Parent parent; 22 | private static Stage stage; 23 | private static Scene scene; 24 | 25 | public static void switchNavigation(String path, ActionEvent event) throws IOException { 26 | parent = FXMLLoader.load(MemberNavigation.class.getResource("/view/member/" + path)); 27 | stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); 28 | SignInFormController.stage = stage; 29 | scene = new Scene(parent); 30 | stage.setScene(scene); 31 | stage.centerOnScreen(); 32 | stage.show(); 33 | } 34 | 35 | public static void switchPaging(String path) throws IOException { 36 | MemberGlobalFormController.getInstance().pagingPane.getChildren().clear(); 37 | FXMLLoader loader = new FXMLLoader(MemberNavigation.class.getResource("/view/member/"+path)); 38 | Parent root = loader.load(); 39 | MemberGlobalFormController.getInstance().pagingPane.getChildren().add(root); 40 | } 41 | 42 | public static void popupPane(String path) throws IOException { 43 | 44 | MemberGlobalFormController.getInstance().popUpPane.setVisible(true); 45 | MemberGlobalFormController.getInstance().imgGreyBack.setVisible(true); 46 | 47 | AnchorPane root = FXMLLoader.load(MemberNavigation.class.getResource("/view/member/" + path)); 48 | 49 | Stage popupStage = new Stage(); 50 | MemberGlobalFormController.getInstance().setPopupStage(popupStage); 51 | popupStage.setScene(new Scene(root)); 52 | popupStage.centerOnScreen(); 53 | popupStage.initOwner(MemberGlobalFormController.getInstance().popUpPane.getScene().getWindow()); 54 | popupStage.initStyle(StageStyle.UNDECORATED); 55 | popupStage.show(); 56 | } 57 | 58 | public static void switchLoginPage(String path) throws IOException { 59 | MemberGlobalLoginFormController.getInstance().loginPane.getChildren().clear(); 60 | FXMLLoader loader = new FXMLLoader(MemberNavigation.class.getResource("/view/member/"+path)); 61 | Parent root = loader.load(); 62 | MemberGlobalLoginFormController.getInstance().loginPane.getChildren().add(root); 63 | } 64 | 65 | public static void closePane(){ 66 | MemberGlobalFormController.getInstance().popUpPane.getChildren().clear(); 67 | MemberGlobalFormController.getInstance().popupStage.close(); 68 | MemberGlobalFormController.getInstance().popUpPane.setVisible(false); 69 | MemberGlobalFormController.getInstance().imgGreyBack.setVisible(false); 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /src/main/resources - Shortcut.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources - Shortcut.lnk -------------------------------------------------------------------------------- /src/main/resources/assests/icon/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/add.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/book.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/book_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/book_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/book_shortcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/book_shortcut.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/borrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/borrow.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/borrow_book_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/borrow_book_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/borrow_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/borrow_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/branch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/branch.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/branch_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/branch_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/branch_shortcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/branch_shortcut.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/close.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/dashboard.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/dashboard_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/dashboard_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/delete.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/due_transations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/due_transations.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/eye_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/eye_close.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/eye_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/eye_open.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/logout.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/logout_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/logout_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/member.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/member_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/member_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/profile.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/profile_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/profile_color.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/profile_shortcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/profile_shortcut.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/redo.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/return.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/returned_transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/returned_transaction.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/update.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/view.png -------------------------------------------------------------------------------- /src/main/resources/assests/icon/waving_hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/icon/waving_hand.png -------------------------------------------------------------------------------- /src/main/resources/assests/img/dashboard_book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/img/dashboard_book.png -------------------------------------------------------------------------------- /src/main/resources/assests/img/dashbord_book 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/img/dashbord_book 1.png -------------------------------------------------------------------------------- /src/main/resources/assests/img/grey_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/img/grey_background.png -------------------------------------------------------------------------------- /src/main/resources/assests/img/login_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/img/login_background.png -------------------------------------------------------------------------------- /src/main/resources/assests/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlokitha/Library-Management-System/e964fe12d0a4a58ebc25dd3353032ce1c4545bba/src/main/resources/assests/img/logo.png -------------------------------------------------------------------------------- /src/main/resources/email/ChangePasswordEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Password Change Confirmation 8 | 9 | 10 |

Dear User,

11 |

Your password has been successfully changed. If you did not initiate this change, please contact our support team immediately.

12 |

If you have any further questions or concerns, feel free to reach out to us.

13 |

Best regards,
Alokagreen Support Team

14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/email/DeleteUserEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Account Deletion Confirmation 8 | 9 | 10 |

Dear User,

11 |

We regret to inform you that your account has been deleted successfully. If you did not request this action or have any concerns, please contact our support team immediately.

12 |

If you have any further questions or need assistance, feel free to reach out to us.

13 |

Thank you for being a part of our community.

14 |

Best regards,
Alokagreen Support Team

15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/email/ForgotPasswordEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Password Reset 8 | 9 | 10 |

Dear User,

11 |

You have requested to reset your password. Please use the following verification code to proceed with the password reset process:

12 |

Verification Code: {verificationCode}

13 |

If you did not initiate this request, please disregard this email.

14 |

Best regards,
Alokagreen Support Team

15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/email/SignUpEmail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Verify Your Email 8 | 9 | 10 |

Dear User,

11 |

A new account has been created.

12 |

To activate your account, please use the following OTP:

13 |

Verification Code: {verificationCode}

14 |

If you recognize this registration, kindly proceed with the verification using the provided OTP. If you are not aware of this registration, please disregard this email.

15 |

Thank you for your attention.

16 |

Best regards,
BookWorm Support Team

17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/hibernate.properties: -------------------------------------------------------------------------------- 1 | hibernate.dialect=org.hibernate.dialect.MySQL8Dialect 2 | hibernate.connection.driver_class=com.mysql.cj.jdbc.Driver 3 | hibernate.connection.url=jdbc:mysql://localhost:3306/BookWorm 4 | hibernate.connection.username=root 5 | hibernate.connection.password=lokitha2003 6 | hibernate.show_sql=true 7 | hibernate.hbm2ddl.auto=update -------------------------------------------------------------------------------- /src/main/resources/view/admin/AdminGlobalLoginForm.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/view/admin/BookBorrowManageRowForm.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 28 | 33 | 38 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/main/resources/view/admin/BookBorrowViewRowForm.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 18 | 23 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/view/admin/BookViewForm.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |