Skip to content

StaffDataManager is a lightweight Java SE desktop app for managing employee records without external databases. It stores data in simple XML files (one per employee), demonstrating basic file-based persistence, CRUD operations, and clean object-oriented design.

License

Notifications You must be signed in to change notification settings

PejperO/StaffDataManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧾 StaffDataManager

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.


Table of Contents

  1. Project Overview
  2. Architecture
  3. Getting Started
  4. Code Samples
  5. Screenshots
  6. What I Learned
  7. License

Project Overview

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
      └── ...

Architecture

🧱 Data Model

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()
}

📂 Repository Layer

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);

💻 User Interface

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

Getting Started

Prerequisites

  • Java 17+
  • Any IDE (IntelliJ / Eclipse / NetBeans)

Installation & Run

1️⃣ Clone or download the repository

git clone https://github.com/YourUsername/StaffDataManager.git
cd StaffDataManager

If you downloaded the .zip file manually, extract it and navigate into the project folder:

cd path/to/StaffDataManager

2️⃣ Compile the project

Make sure you have Java 17 or newer installed. You can check your version with:

java -version

Then compile all source files:

javac -d out src/main/java/**/*.java

This 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.EmployeeManagerGUI

If you prefer to run the console version:

java -cp out app.Main

4️⃣ 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-path

Code Samples

Example 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);

Screenshots

1 2 3 4

What I Learned

  • 💡 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

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


About

StaffDataManager is a lightweight Java SE desktop app for managing employee records without external databases. It stores data in simple XML files (one per employee), demonstrating basic file-based persistence, CRUD operations, and clean object-oriented design.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages