Welcome to StaffDataManager, a desktop application for managing employee records using XML files as a lightweight data store.
This project was built entirely with Java SE, focusing on file-based persistence (without JDBC or JAXB) and a straightforward Swing-based GUI interface.
StaffDataManager provides CRUD (Create, Read, Update, Delete) operations on employee data, stored as individual XML files.
The goal of this project was to build a self-contained personnel management system using only Java SE — no frameworks, no databases.
Employees are separated into two categories:
INTERNAL— in-house employees.EXTERNAL— external contractors.
Each employee record is stored in an XML file located under one of the following directories:
data/
├── INTERNAL/
│ ├── 1.xml
│ ├── 2.xml
│ └── ...
└── EXTERNAL/
├── 3.xml
├── 4.xml
└── ...
Defined in the model package, the Person class represents a single employee entry:
package model;
public class Person {
private String personId;
private String firstName;
private String lastName;
private String mobile;
private String email;
private String pesel;
private Type type;
public Person(String personId, String firstName, String lastName, String mobile,
String email, String pesel, Type type) {
this.personId = personId;
this.firstName = firstName;
this.lastName = lastName;
this.mobile = mobile;
this.email = email;
this.pesel = pesel;
this.type = type;
}
// Getters, setters, and toString()
}Located in the repository package, PersonRepository handles all XML file I/O operations using the DOM API.
It provides the following key methods:
Optional<Person> find(String personId, String firstName, String lastName,
String mobile, String pesel, Type type);
void create(Person person);
boolean remove(String personId);
void modify(Person person);A minimal GUI built with Swing (EmployeeManagerGUI.java), featuring form fields and buttons for:
- Adding a new employee
- Searching employees by any combination of fields
- Modifying employee data
- Removing an employee
- Java 17+
- Any IDE (IntelliJ / Eclipse / NetBeans)
1️⃣ Clone or download the repository
git clone https://github.com/YourUsername/StaffDataManager.git
cd StaffDataManagerIf you downloaded the .zip file manually, extract it and navigate into the project folder:
cd path/to/StaffDataManager2️⃣ Compile the project
Make sure you have Java 17 or newer installed. You can check your version with:
java -versionThen compile all source files:
javac -d out src/main/java/**/*.javaThis command creates the out/ directory containing all compiled .class files.
3️⃣ Run the application
Start the GUI directly from the compiled classes:
java -cp out app.EmployeeManagerGUIIf you prefer to run the console version:
java -cp out app.Main4️⃣ Verify data directory
On first launch, the program will automatically create the necessary folder structure if it doesn’t exist:
data/
├── INTERNAL/
└── EXTERNAL/
Each employee will be stored as a separate XML file inside one of these directories.
5️⃣ (Optional) Run unit tests
If you want to verify repository logic, make sure you have JUnit 5 on the classpath and run:
javac -cp .;lib/junit-platform-console-standalone-1.10.0.jar -d out test/**/*.java
java -jar lib/junit-platform-console-standalone-1.10.0.jar -cp out --scan-class-pathExample usage from Main.java:
PersonRepository repo = new PersonRepository("data");
Person p = new Person("1", "Anna", "Nowak", "555123456",
"anna@firma.pl", "90010112345", Type.INTERNAL);
repo.create(p);
repo.find("1", null, null, null, null, null)
.ifPresent(System.out::println);
- 💡 Working with XML via DOM API in Java SE
- 🧠 Designing CRUD logic without databases or external libraries
- 🪟 Building a GUI with Swing components (JFrame, JPanel, JTextField, JComboBox, JButton)
- 🧩 Organizing a Java project using clean package structure (
model,repository,service,app) - ✅ Writing simple unit tests with JUnit 5 for repository operations
- 🗃️ Managing file-based persistence and directory structure dynamically
This project is licensed under the MIT License. See the LICENSE file for details.