Skip to main content

SureInk Model Library (sureink-model)

Type: Library (not a runnable microservice)

Overview

The sureink-model module is a crucial shared Java library within the SureInk Platform. It defines the core, persistent domain entities and related data structures that represent the fundamental business concepts of the platform. Unlike sureink-common-model (which focuses on generic DTOs and value objects), sureink-model provides richer, domain-specific models, primarily intended for use as JPA entities.

This library groups models based on business domains or the microservices that primarily own them (e.g., cloudmsa for core licensing, customer for customer data). While it's a library, it includes Spring Data JPA and other Spring dependencies, indicating that its models are designed to be Spring-aware JPA entities.

Key Features & Provided Components

  • Core Domain Entity Definitions:
    • Contains JPA (@Entity) class definitions for the central business objects of the SureInk Platform. Based on project context, these likely include:
      • License
      • Product
      • Customer
      • Subscription
      • Order
      • Payment
      • And other entities related to the "Cloud Master Subscription Agreement" (cloudmsa package).
  • Domain-Specific Models: Organizes models into packages corresponding to major business domains or services:
    • com.sureink.cloudmsa: Core licensing, subscription, product, and order entities.
    • com.sureink.customer: Customer-related entities.
    • com.sureink.connector: Models specific to third-party integrations.
    • com.sureink.usermanagement: Models relevant to user management.
  • JPA Integration: Entities are designed for use with Spring Data JPA and are likely annotated with standard JPA and Hibernate annotations (e.g., @Entity, @Table, @Id, relationships like @ManyToOne, @OneToMany).
  • Auditing: Likely leverages Hibernate Envers (due to its presence in the POM) for auditing changes to these core domain entities.
  • Validation: Entities probably use jakarta.validation-api annotations for field-level validation.
  • Shared Business Logic (Potentially): While primarily for models, the inclusion of Spring dependencies might mean some very closely-tied, reusable business logic or utility functions related to these entities could also reside here.

Dependencies

This library includes dependencies necessary for defining and using Spring-managed JPA entities:

  • Spring Boot starters (core, data-jpa, security)
  • Hibernate Envers (for entity auditing)
  • Jakarta Persistence API (implicitly via Spring Data JPA)
  • Lombok (for reducing boilerplate in entity classes)
  • Jakarta Validation API
  • Jackson Datatypes (JSR310)
  • Dependencies on sureink-common-model and sureink-common for foundational models and utilities.

The spring-boot-maven-plugin is present, but the module is not intended to be run as a standalone service.

Usage

Other microservices in the SureInk Platform that need to interact with the core persistent domain entities will include sureink-model as a Maven dependency:

<dependency>
<groupId>com.sureink</groupId>
<artifactId>sureink-model</artifactId>
<version>1.0-SNAPSHOT</version> <!-- Or the relevant version -->
</dependency>

Services can then use these entities with their own JPA repositories, pass them in service layers, and map them to/from DTOs for API responses or Kafka messages.

Building

As a library, sureink-model is built as part of the overall SureInk Platform build process:

# From the root project directory
mvn clean install

This compiles its code and installs the resulting JAR into the local Maven repository, making it available to other modules.