Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
cc4399e
Add initial .editorconfig and pom.xml files for project configuration
Codespilot May 28, 2026
cd2091a
Add core and osba modules to the parent POM and update compiler settings
Codespilot May 28, 2026
d9c938f
Add PriorityValueFinder utility class for searching values in a prior…
Codespilot May 28, 2026
2b169a1
Add SnowflakeId class for generating distributed unique IDs based on …
Codespilot May 28, 2026
4cd4c25
Add TypeHelper class for value coercion and type conversion utilities
Codespilot May 28, 2026
d3e5a73
Add HTTP status exception classes for error handling
Codespilot May 28, 2026
aa12dc4
Add security exception classes for authentication and authorization h…
Codespilot May 28, 2026
f17ed13
Add ObjectId and ULID classes for unique identifier generation
Codespilot May 28, 2026
08c1343
Add initial POM file for Maven project configuration
Codespilot Jun 4, 2026
2626e63
Add Singleton class for managing shared instances
Codespilot Jun 4, 2026
300e8ba
Add ObjectFactory interface and BusinessObjectFactory implementation …
Codespilot Jun 4, 2026
25b4d5e
Add custom exceptions for method reflection handling and implement Ob…
Codespilot Jun 4, 2026
9acb6f8
Add ObjectEditState enum to represent the state of objects in the system
Codespilot Jun 4, 2026
b191c57
Add BusinessContext and UseBusinessContext interfaces for service res…
Codespilot Jun 4, 2026
385a9ad
Update version in pom.xml to use a dynamic revision property
Codespilot Jun 4, 2026
70d2465
Update version in pom.xml to use a dynamic revision property
Codespilot Jun 4, 2026
b3f07a7
Add FieldData, FieldDataManager, PropertyInfo, and related classes fo…
Codespilot Jun 4, 2026
40e2832
Add Savable interface for objects that can be saved to persistent sto…
Codespilot Jun 4, 2026
4dbb28e
Update pom.xml to use dynamic revision property for parent version
Codespilot Jun 5, 2026
f3b9f12
Refactor BusinessObjectFactory to improve readability and maintainabi…
Codespilot Jun 5, 2026
41a3da5
Rename UseBusinessContext class and update package structure for bett…
Codespilot Jun 5, 2026
7ab5f2a
Add interfaces for property management and rule checking
Codespilot Jun 5, 2026
110ff81
Add Rule interface and base implementation for rule management
Codespilot Jun 5, 2026
17e351c
Add RuleSeverity enum to define severity levels for rule violations
Codespilot Jun 5, 2026
344a501
Add RuleResult class to represent the outcome of rule executions
Codespilot Jun 5, 2026
63442d4
Initialize Spring Boot application with Maven wrapper and basic struc…
Codespilot Jun 5, 2026
5be9cac
Add BrokenRule and BrokenRuleCollection classes to manage rule violat…
Codespilot Jun 5, 2026
71f5618
Add RuleManager class to manage rules for specific types with thread-…
Codespilot Jun 5, 2026
ae11ec4
Add BusinessObject class to manage business context and rule checking
Codespilot Jun 5, 2026
853f3b8
Add property registration methods to BusinessObject class
Codespilot Jun 5, 2026
c2ffcd3
Enhance OperableProperty interface with generic property methods and …
Codespilot Jun 6, 2026
a3fb512
Remove priority management from Rule interface and RuleBase class
Codespilot Jun 6, 2026
82ec8d9
Add RuleCheckException class to handle validation errors during rule …
Codespilot Jun 6, 2026
b188935
Implement isBusy method in FieldData and FieldDataManager; update reg…
Codespilot Jun 6, 2026
5d68e10
Refactor BusinessObjectFactory to use ObservableObject; update save m…
Codespilot Jun 6, 2026
8d433e3
Add DisplayName annotation for user-friendly field names; implement G…
Codespilot Jun 6, 2026
079d9ee
Refactor ObjectId and TypeHelper for improved type handling; update c…
Codespilot Jun 6, 2026
7abc8e6
Update Maven compiler source version to 17 for compatibility
Codespilot Jun 6, 2026
21482f1
Update Maven compiler source and target versions to 17 for compatibility
Codespilot Jun 6, 2026
08aef16
Add getName method to RuleBase for name retrieval
Codespilot Jun 6, 2026
67e09e1
Enhance BusinessContext to support ObjectFactory and instance creation
Codespilot Jun 6, 2026
876087a
Refactor registerProperty methods in BusinessObject for enhanced flex…
Codespilot Jun 6, 2026
c465ac0
Refactor BusinessObjectFactory and ObjectReflector for improved clari…
Codespilot Jun 6, 2026
dc1b6a5
Add unit tests for tuple classes and update pom.xml for JUnit 5 support
Codespilot Jun 7, 2026
8425d0f
Refactor Trio class to improve method naming and add documentation
Codespilot Jun 7, 2026
2e55356
Enhance test classes with descriptive display names for improved clar…
Codespilot Jun 7, 2026
0ebbbc4
Add Pair class to represent key-value pairs and remove unused suppres…
Codespilot Jun 7, 2026
6666a4e
Add Required annotation and its validator for field validation
Codespilot Jun 7, 2026
d2cc18c
Refactor factory method handling in BusinessObjectFactory and ObjectR…
Codespilot Jun 7, 2026
5eaa163
Update Maven compiler properties to use release version for improved …
Codespilot Jun 7, 2026
1f3454e
Implement PriorityQueue class and update PriorityValueFinder to suppo…
Codespilot Jun 7, 2026
af270be
Enhance BusinessObjectFactory with additional factory method implemen…
Codespilot Jun 7, 2026
c6647e7
Refactor PropertyInfo to use Supplier for default values and simplify…
Codespilot Jun 7, 2026
37a1953
Refactor PropertyInfoManager and PropertyInfoList to use ConcurrentMa…
Codespilot Jun 7, 2026
83f4b5e
Refactor FieldData and FieldDataManager for improved null handling an…
Codespilot Jun 7, 2026
6b3dc5d
Refactor bypassRuleChecks method to improve type safety with generic …
Codespilot Jun 7, 2026
fd65d12
Add EditableObject class for enhanced object persistence and event ha…
Codespilot Jun 7, 2026
1510927
Add ExecutableObject and ObservableObject classes for enhanced busine…
Codespilot Jun 7, 2026
fc686d7
Add ReadOnlyObject class for immutable business objects and SavedEven…
Codespilot Jun 7, 2026
2069ac1
Add Rules class for rule validation and asynchronous rule checking
Codespilot Jun 7, 2026
9720c0a
Add DataAnnotationRule class for annotation-based rule validation and…
Codespilot Jun 7, 2026
78f85ed
Enhance Rules class with detailed Javadoc comments for better documen…
Codespilot Jun 7, 2026
eae06a4
Add LambdaRule, RegularRule, and RequiredRule classes for flexible va…
Codespilot Jun 7, 2026
e3e3039
Refactor rule classes to call super constructor and add HTTP status c…
Codespilot Jun 7, 2026
1ddc7eb
Add auditing framework with Audited annotation, AuditRecord class, an…
Codespilot Jun 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{xml,yml,yaml,json}]
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ buildNumber.properties
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

.idea/
*.iml
*.iws
*.ipr
*.log
*.tmp
*.bak
*.swp
*.swo
*.DS_Store
.air/
36 changes: 36 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.euonia</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
</parent>

<artifactId>core</artifactId>
<name>euonia core module</name>

<description>Core module of the Euonia framework</description>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.12.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.3</version>
</plugin>
</plugins>
</build>

</project>
15 changes: 15 additions & 0 deletions core/src/main/java/com/euonia/annotation/Required.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.euonia.annotation;

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Validation(validator = RequiredValidator.class)
public @interface Required {

boolean allowEmpty() default false;

String message() default "";

Class<? extends Annotation> annotation() default Required.class;
}
18 changes: 18 additions & 0 deletions core/src/main/java/com/euonia/annotation/RequiredValidator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.euonia.annotation;

import com.euonia.tuple.Duet;

public class RequiredValidator implements Validator<Required> {
@Override
public Duet<Boolean, String> validate(Required annotation, Object value) {
Duet<Boolean, String> result;
if (value == null) {
result = new Duet<>(false, annotation.message().isEmpty() ? "Value is required" : annotation.message());
} else if (!annotation.allowEmpty() && value instanceof String string && string.isEmpty()) {
result = new Duet<>(false, annotation.message().isEmpty() ? "Value must not be empty" : annotation.message());
} else {
result = new Duet<>(true, "");
}
return result;
}
}
12 changes: 12 additions & 0 deletions core/src/main/java/com/euonia/annotation/Validation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.euonia.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Validation {
Class<? extends Validator<?>> validator();
}
9 changes: 9 additions & 0 deletions core/src/main/java/com/euonia/annotation/Validator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.euonia.annotation;

import com.euonia.tuple.Duet;

import java.lang.annotation.Annotation;

public interface Validator<A extends Annotation> {
Duet<Boolean, String> validate(A annotation, Object value);
}
149 changes: 149 additions & 0 deletions core/src/main/java/com/euonia/core/ObjectId.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
package com.euonia.core;

import java.util.UUID;

/**
* ObjectId is a class that represents a unique identifier for an object.
* It can be generated using different algorithms such as Snowflake, GUID,
* Random, and ULID.
* The value of the ObjectId can be of type long, String, UUID, or Integer.
* The class provides methods to generate ObjectIds using different algorithms
* and overrides the hashCode, equals, and toString methods for proper
* functionality.
* The ObjectId class is immutable, meaning that once an ObjectId is created,
* its value cannot be changed.
* This ensures that the uniqueness of the identifier is maintained throughout
* its lifecycle.
*/
public final class ObjectId {
private final Object value;

/**
* Gets the value of the ObjectId.
*
* @return the value of the ObjectId
*/
public Object getValue() {
return value;
}

/**
* Constructs an ObjectId with the specified value.
*
* @param value the value of the ObjectId
*/
public ObjectId(long value) {
this.value = value;
}

/**
* Constructs an ObjectId with the specified value.
*
* @param value the value of the ObjectId
*/
public ObjectId(String value) {
this.value = value;
}

/**
* Constructs an ObjectId with the specified value.
*
* @param value the value of the ObjectId
*/
public ObjectId(UUID value) {
this.value = value;
}

/**
* Constructs an ObjectId with the specified value.
*
* @param value the value of the ObjectId
*/
public ObjectId(Integer value) {
this.value = value;
}

/**
* Generates a new ObjectId using the Snowflake algorithm.
*
* @return a new ObjectId
*/
public static ObjectId snowflake() {
return new ObjectId(SnowflakeId.getInstance().nextId());
}

/**
* Generates a new ObjectId using the GUID algorithm.
*
* @return a new ObjectId
*/
public static ObjectId guid() {
return new ObjectId(UUID.randomUUID());
}

/**
* Generates a new ObjectId using the Random algorithm.
*
* @return a new ObjectId
*/
public static ObjectId random() {
return new ObjectId(UUID.randomUUID());
}

/**
* Generates a new ObjectId using the ULID algorithm.
*
* @return a new ObjectId
*/
public static ObjectId ulid() {
return new ObjectId(ULID.generate());
}

public <T> T getValue(Class<T> type) {
if (type.isInstance(value)) {
return type.cast(value);
}
return null;
}

@Override
public int hashCode() {
return value.hashCode();
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
ObjectId objectId = (ObjectId) obj;
return value.equals(objectId.value);
}

@Override
public String toString() {

if (value instanceof UUID target) {
return target.toString();
}

if (value instanceof Integer target) {
return target.toString();
}

if (value instanceof Long target) {
return target.toString();
}

if (value instanceof String target) {
return target;
}

if (value instanceof ULID target) {
return target.toString();
}

return value.toString();
Comment on lines +143 to +147
}
}
18 changes: 18 additions & 0 deletions core/src/main/java/com/euonia/core/Pair.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.euonia.core;

/**
* A generic class that represents a pair of key and value. The key must be comparable to ensure that pairs can be sorted based on their keys.
*
* @param key the key of the pair
* @param value the value associated with the key
* @param <K> the type of the key
* @param <V> the type of the value
*/
public record Pair<K extends Comparable<K>, V>(K key, V value) {
public static <K extends Comparable<K>, V> Pair<K, V> of(K key, V value) {
if (key == null) {
throw new IllegalArgumentException("key is null");
}
return new Pair<>(key, value);
}
}
53 changes: 53 additions & 0 deletions core/src/main/java/com/euonia/core/PriorityQueue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.euonia.core;

import java.util.Comparator;

public class PriorityQueue<E, K extends Comparable<K>> {
private final java.util.PriorityQueue<Pair<K, E>> queue;

public PriorityQueue() {
this.queue = new java.util.PriorityQueue<>(Comparator.comparing(Pair::key));
}

/**
* Inserts the specified element into this priority queue with the given priority.
*
* @param value the element to be added
* @param priority the priority of the element
*/
public void add(E value, K priority) {
queue.add(new Pair<>(priority, value));
}
Comment on lines +18 to +20

/**
* Retrieves and removes the head of this queue, or returns null if this queue is empty.
*
* @return the value of the highest priority element, or null if the queue is empty
*/
public E poll() {
Pair<K, E> pair = queue.poll();
return pair != null ? pair.value() : null;
}

/**
* Retrieves, but does not remove, the head of this queue. This method differs from peek only in that it throws an exception if this queue is empty.
*
* @return the value of the highest priority element, or null if the queue is empty
*/
public E peek() {
Pair<K, E> pair = queue.peek();
return pair != null ? pair.value() : null;
}

public void clear() {
queue.clear();
}

public int size() {
return queue.size();
}

public boolean isEmpty() {
return queue.isEmpty();
}
}
Loading