Skip to content

lando-tech/yaj-product-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

yaj-product-db (Yet Another Java Product Database)

A Spring Boot web application designed for managing products and vendors in a secure database environment. This application provides a comprehensive solution for product catalog management with features for adding, viewing, and managing products and their associated vendors.

πŸš€ Features

Product Management

  • Add Products: Create new products with detailed information including:
    • Product name, part number, and manufacturer part number
    • Price and category classification
    • Manufacturer selection from predefined options
    • Detailed product descriptions (facts, installation notes, general description)
  • View Products: Browse all products with filtering capabilities
  • Update Products: Edit existing product information
  • Delete Products: Remove products from the catalog
  • Filter Products: Filter by category and manufacturer
  • Search Products: Find products by keyword

Vendor Management

  • Add Vendors: Register new vendors with contact information
  • View Vendors: Display all registered vendors
  • Vendor-Product Association: Link vendors with products they supply

Product Filters

  • Filters are handled via enum class objects
  • New filters can easily be added

πŸ› οΈ Technology Stack

  • Framework: Spring Boot 3.5.3
  • Language: Java 21
  • Database: H2 Database (file-based persistence)
  • Web Framework: Spring MVC
  • Template Engine: Thymeleaf
  • ORM: Spring Data JPA with Hibernate
  • Validation: Jakarta Bean Validation
  • Build Tool: Gradle (Kotlin DSL)
  • Frontend: Bootstrap 5.1.3

πŸ“‹ Prerequisites

  • Java 21 or higher
  • Gradle 7.0 or higher (wrapper included)

πŸš€ Getting Started

Clone the Repository

git clone https://github.com/lando-tech/product-db-webapp.git
cd product-db-webapp

Build and Run

# Using Gradle wrapper (recommended)
./gradlew bootRun

# Or build first, then run
./gradlew build
java -jar build/libs/db_secure-0.0.1-SNAPSHOT.jar

Access the Application (Dev env only)

πŸ“ Project Structure

src/
β”œβ”€β”€ main/
β”‚   β”œβ”€β”€ java/com/easyrok/db_secure/
β”‚   β”‚   β”œβ”€β”€ Main.java                          # Application entry point
β”‚   β”‚   β”œβ”€β”€ controllers/                       # MVC Controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ AddProductFormController.java
β”‚   β”‚   β”‚   β”œβ”€β”€ AddVendorFormController.java
β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardController.java
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductViewController.java
β”‚   β”‚   β”‚   β”œβ”€β”€ VendorViewController.java
β”‚   β”‚   β”‚   └── SiteSurveyController.java
β”‚   β”‚   β”œβ”€β”€ models/                           # Entity classes
β”‚   β”‚   β”‚   β”œβ”€β”€ Product.java                  # Abstract base class
β”‚   β”‚   β”‚   β”œβ”€β”€ GenericProduct.java           # Concrete product implementation
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductDescription.java       # Product details
β”‚   β”‚   β”‚   β”œβ”€β”€ Vendor.java                   # Vendor entity
β”‚   β”‚   β”‚   β”œβ”€β”€ User.java                     # User entity
β”‚   β”‚   β”‚   β”œβ”€β”€ Auditor.java                  # Audit tracking
β”‚   β”‚   β”‚   └── ProductAuditor.java           # Product-specific auditing
β”‚   β”‚   β”œβ”€β”€ repositories/                     # Data access layer
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductRepo.java
β”‚   β”‚   β”‚   β”œβ”€β”€ VendorRepo.java
β”‚   β”‚   β”‚   └── ProductDescriptionRepo.java
β”‚   β”‚   β”œβ”€β”€ services/                         # Business logic layer
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductService.java
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductServiceImpl.java
β”‚   β”‚   β”‚   β”œβ”€β”€ VendorService.java
β”‚   β”‚   β”‚   β”œβ”€β”€ VendorServiceImpl.java
β”‚   β”‚   β”‚   └── ProductFilterServiceImpl.java
β”‚   β”‚   β”œβ”€β”€ filters/                          # Enums and filters
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductCategory.java
β”‚   β”‚   β”‚   β”œβ”€β”€ Manufacturer.java
β”‚   β”‚   β”‚   └── ProductFilter.java
β”‚   β”‚   └── validators/                       # Custom validators
β”‚   └── resources/
β”‚       β”œβ”€β”€ application.properties            # Application configuration
β”‚       β”œβ”€β”€ static/                          # Static resources
β”‚       └── templates/                       # Thymeleaf templates
β”‚           β”œβ”€β”€ dashboard.html
β”‚           β”œβ”€β”€ productForm.html
β”‚           β”œβ”€β”€ productView.html
β”‚           β”œβ”€β”€ vendorForm.html
β”‚           β”œβ”€β”€ vendorView.html
β”‚           └── fragments/
└── test/                                    # Test classes

πŸ”§ Configuration

Database Configuration

The application uses H2 database with file-based persistence. Configuration in application.properties:

# H2 Database
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.datasource.url=jdbc:h2:file:~/spring-boot-h2-db102-v3
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver

# JPA/Hibernate
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

🌐 API Endpoints

Product Endpoints

  • GET /dashboard - Application dashboard
  • GET /productForm - Add new product form
  • POST /productForm - Submit new product
  • GET /productView - View all products (with filtering)
  • GET /showProductUpdateForm/{id} - Edit product form
  • POST /deleteProduct/{id} - Delete product

Vendor Endpoints

  • GET /vendorForm - Add new vendor form
  • POST /vendorForm - Submit new vendor
  • GET /vendorView - View all vendors

Other Endpoints

  • GET /siteSurveyForm - Site survey form
  • GET /h2-console - Database console

πŸ“Š Database Schema

Key Entities

Product

  • id (Primary Key)
  • name (Product name)
  • partNumber (Internal part number)
  • manufacturerNumber (Manufacturer's part number)
  • price (Product price)
  • productCategory (Category enum)
  • manufacturer (Manufacturer enum)
  • auditor (Audit information)

Vendor

  • id (Primary Key)
  • name (Vendor name)
  • pocEmail (Point of contact email)
  • pocPhoneNumber (Contact phone)
  • cageCode (Commercial and Government Entity Code)

ProductDescription

  • id (Primary Key)
  • productFacts (Product specifications)
  • installationDescription (Installation notes)
  • generalDescription (General description)
  • product (One-to-one relationship with Product)

πŸ”’ Security Features

  • Input validation using Jakarta Bean Validation
  • SQL injection protection through JPA/Hibernate
  • XSS protection through Thymeleaf templating
  • Audit trail for product changes

πŸ§ͺ Testing

Run the test suite:

./gradlew test

🚧 Current Development Status

This project is actively under development. See TODO.md for current development priorities and planned features.

Recently Completed

  • βœ… Core product CRUD operations
  • βœ… Vendor management system
  • βœ… Product filtering and search
  • βœ… Audit trail implementation
  • βœ… Form validation

In Progress

  • πŸ”„ UI/UX improvements
  • πŸ”„ Advanced search functionality
  • πŸ”„ Inventory tracking features

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

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

πŸ“ž Support

For support and questions, please contact the development team or create an issue in the repository.

πŸ—οΈ Build Information

  • Group: com.demo
  • Artifact: db_secure
  • Version: 0.0.1-SNAPSHOT
  • Java Version: 21
  • Spring Boot Version: 3.5.3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published