This project is the final project for the university course:
CITB408 Java Programming - Spring Semester 2020/2021.
The Print House Management System is a Java-based console application designed to manage printing operations within multiple print houses. It supports CRUD operations for print houses, employees, printing presses, and editions, along with calculating printing costs, revenues, and managing paper loads. The system adheres to a specification requiring robust exception handling, serialization for data persistence, and comprehensive unit testing.
- Features
- Architecture
- UML Class Diagram
- Technologies used
- Installation
- Usage
- Dependencies
- Tests
- Logging
- Contributing
- License
- Acknowledgments
- Repository
- Print Houses: Manage multiple print houses with configurable salary increments (e.g., 15% for managers), paper costs, base salaries, and discount policies.
- Employees: Add Operators and Managers identified by ЕГН, with salaries derived from
PrintHouseand conditional bonuses based on revenue targets. - Printing Presses: Configure presses with paper capacity, color capability, and print speed; load paper and print editions.
- Editions: Manage books (e.g., "Lord of the Rings") with titles, page counts, and sizes (A1–A5).
- Cost and Revenue: Calculate print costs (size-based paper pricing) and revenues (volume discounts after 10 copies).
- Persistence: Save/load data using serialization.
- Exception Handling: Custom exceptions (e.g.,
InvalidEmployeeException,InvalidPrintHouseException). - Unit Tests: Comprehensive tests with JUnit 5 and Mockito for service-layer validation.
The project is organized into several packages:
data.models: Core entities (PrintHouse,Employee,PrintingPress,Edition,PrintedItem) and enums (PaperType,Size,EmployeeType).services: Business logic implementations (PrintHouseService,EmployeeService,PrintingPressService,EditionService,SerializationService).services.contracts: Service interfaces (IPrintHouseService,IEmployeeService,IPrintingPressService,IEditionService) defining APIs.UI.controllers: Console UI classes (PrintHouseController,EmployeeController,PrintingPressController,EditionController).utilities: Utility classes (e.g.,ExceptionMessages).utilities.exceptions: Custom exceptions (e.g.,InvalidEmployeeException).services(test directory): JUnit 5 tests (e.g.,EmployeeServiceTests) with Mockito.
Below is a simplified UML class diagram illustrating the key entities and their relationships in the Print House Management System:
UML Class diagram PlantUML link
- Java: Core language (JDK 21 recommended, can be downgraded to JDK 17+ for some methods like
.getFirst()instead of.get(0)). - SLF4J: Logging framework for debugging and error tracking.
- JUnit 5: Unit testing framework.
- Mockito: Mocking framework for tests.
- Gradle: Build tool for dependency management and compilation.
- PlantUML: Tool for generating UML diagrams from text-based descriptions.
- Serialization: Built-in Java serialization for persistence.
Follow these steps to set up the Print House Management System locally:
- Java Development Kit (JDK) 21 or higher.
- Gradle (for building the project).
-
Clone the Repository:
git clone <repository-url> cd print-house-management-system
-
Build the Project Using the Gradle wrapper:
./gradlew clean build
Or with an installed Gradle:
gradle clean build
This compiles the code and runs tests.
-
Run the Application
./gradlew run
Or, if built manually:
java -cp build/libs/print-house-management-system.jar UI.Main
The application features a console-based interface. Upon launch, a main menu provides options to manage print houses, employees, printing presses, editions.
Start the application from the main menu:
=== Print House Management System ===
1. Manage Print Houses
2. Manage Employees
3. Manage Printing Presses
4. Manage Editions
0. Exit
Enter your choice:
-
Create a Print House:
Enter your choice: 1 --- Print House Management --- Enter your choice: 1 Salary increment %: 15 Paper increment %: 20 Base salary: 2000 Increment eligible roles (comma-separated, e.g., OPERATOR,MANAGER): MANAGER Revenue target: 10000 Discount count: 10 Discount %: 10 Print house created successfully at index 0 -
Add a Printing Press:
Enter your choice: 3 --- Printing Press Management --- Enter your choice: 1 Select print house number: 1 Max paper load: 5000 Current paper load: 4000 Color capable (true/false): true Max pages per minute: 300 Printing press added successfully. -
Add an Edition:
Enter your choice: 4 --- Edition Management --- Enter your choice: 2 Select print house number: 1 Title: Lord of the Rings Number of pages: 1300 Size (A5/A4/A3/A2/A1): A4 Edition added successfully. -
Print an Item:
Enter your choice: 3 Enter your choice: 5 Select print house number: 1 Select printing press number: 1 Select edition number: 1 Paper type (STANDARD/GLOSSY/NEWSPAPER): STANDARD Price per copy: 60 Number of copies: 5 Color print (true/false): true Item printed successfully. -
Calculate Revenue:
Enter your choice: 7 Select print house number: 1 Total Revenue: 300.00 -
Save Data:
Enter your choice: 1 Enter your choice: 3 Enter file path: print_houses.ser Print houses saved successfully.
For more detailed usage see the USAGE.md
- SLF4J: For logging.
- Logback: As the logging implementation.
The project includes extensive unit tests using JUnit 5 and Mockito, covering the service layer, and serialization functionality. To run the tests:
./gradlew testLogging is implemented using SLF4J with Logback. Logs are output to the console by default and can be customized via the logback.xml file located in src/main/resources.
As this is a university course project contribuiting is generally not required.
The project is licensed under MIT License. See the LICENSE file for details.
- This project was developed as part of the CITB408 Java Programming course at New Bulgarian University.
- Special thanks to the course instructor for creating the project requirements.
GitHub Repository: https://github.com/StefanYankov/PrintHouseManagementSystem/
