From 363e301c0b2dd65c85fb768fe6d553860bf1e3f3 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:42:56 +0400 Subject: [PATCH 001/115] Create HistoryRecord entity class --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java new file mode 100644 index 0000000..72d192f --- /dev/null +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -0,0 +1,4 @@ +package com.oraclequantapi.oraclequantapi.model; + +public class HistoryRecord { +} \ No newline at end of file From af3b81c2d9a63ba1aaa439d50d929692a633b2aa Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:45:23 +0400 Subject: [PATCH 002/115] Add JPA entity and table mapping --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 72d192f..2a5ef96 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -1,4 +1,9 @@ package com.oraclequantapi.oraclequantapi.model; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + +@Entity +@Table(name = "CONVERSION_HISTORY") public class HistoryRecord { } \ No newline at end of file From 270f70fc7cdeb215c5684aad95b8a65041e391eb Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:47:01 +0400 Subject: [PATCH 003/115] Add primary key field --- .../oraclequantapi/model/HistoryRecord.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 2a5ef96..a65393c 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -1,9 +1,13 @@ package com.oraclequantapi.oraclequantapi.model; -import jakarta.persistence.Entity; -import jakarta.persistence.Table; +import jakarta.persistence.*; @Entity @Table(name = "CONVERSION_HISTORY") public class HistoryRecord { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "ID") + private Long id; } \ No newline at end of file From 6b29c3496956786568df06d447c86d4b79b218a2 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:48:27 +0400 Subject: [PATCH 004/115] Add timestamp field with database column mapping --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index a65393c..f35e01f 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -2,6 +2,8 @@ import jakarta.persistence.*; +import java.time.Instant; + @Entity @Table(name = "CONVERSION_HISTORY") public class HistoryRecord { @@ -10,4 +12,8 @@ public class HistoryRecord { @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private Long id; + + @Column(name = "CREATED_AT", nullable = false) + private Instant timestamp; + } \ No newline at end of file From 0a3f3bb517eb85335ac14d2b8d04ac7f9da4b595 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:49:47 +0400 Subject: [PATCH 005/115] Add source IP address JSON mapping --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index f35e01f..029a68b 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -1,5 +1,7 @@ package com.oraclequantapi.oraclequantapi.model; +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.persistence.*; import java.time.Instant; @@ -16,4 +18,9 @@ public class HistoryRecord { @Column(name = "CREATED_AT", nullable = false) private Instant timestamp; + @Column(name = "SOURCE_IP_ADDRESS", nullable = false, length = 128) + @JsonProperty("source_ip_address") + @JsonAlias("sourceIpAddress") + private String sourceIpAddress; + } \ No newline at end of file From 0321606ee03135324323e4a5e9b3b8847fa2e164 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:50:26 +0400 Subject: [PATCH 006/115] Add input and output large text fields --- .../oraclequantapi/model/HistoryRecord.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 029a68b..0ab556a 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -23,4 +23,12 @@ public class HistoryRecord { @JsonAlias("sourceIpAddress") private String sourceIpAddress; + @Lob + @Column(name = "INPUT") + private String input; + + @Lob + @Column(name = "OUTPUT", nullable = false) + private String output; + } \ No newline at end of file From 221faff03b056310d48cb5374a5942994bf587aa Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:51:09 +0400 Subject: [PATCH 007/115] Add constructors for JPA and object creation --- .../oraclequantapi/model/HistoryRecord.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 0ab556a..39d7862 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -31,4 +31,13 @@ public class HistoryRecord { @Column(name = "OUTPUT", nullable = false) private String output; + protected HistoryRecord() { + } + + public HistoryRecord(String sourceIpAddress, String input, String output) { + this.sourceIpAddress = sourceIpAddress; + this.input = input; + this.output = output; + } + } \ No newline at end of file From 81e6397cedc0549a393480268f790f00016787d8 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:51:52 +0400 Subject: [PATCH 008/115] Set timestamp automatically before saving --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 39d7862..2eb4945 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -40,4 +40,11 @@ public HistoryRecord(String sourceIpAddress, String input, String output) { this.output = output; } + @PrePersist + void onCreate() { + if (timestamp == null) { + timestamp = Instant.now(); + } + } + } \ No newline at end of file From 9b48343ed6c125f71ebdd5bb9b19c76183083540 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:55:42 +0400 Subject: [PATCH 009/115] Add getId method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 2eb4945..cb52098 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -47,4 +47,8 @@ void onCreate() { } } + public Long getId() { + return id; + } + } \ No newline at end of file From 1ed122bff340e8361e1caa6a9be210ad4c273c42 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:56:02 +0400 Subject: [PATCH 010/115] Add getTimestamp method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index cb52098..b163a4d 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -51,4 +51,8 @@ public Long getId() { return id; } + public Instant getTimestamp() { + return timestamp; + } + } \ No newline at end of file From 7636132892e3cf85e658b5172acb828432088c33 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:56:34 +0400 Subject: [PATCH 011/115] Add setTimestamp method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index b163a4d..4878bd9 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -55,4 +55,8 @@ public Instant getTimestamp() { return timestamp; } + public void setTimestamp(Instant timestamp) { + this.timestamp = timestamp; + } + } \ No newline at end of file From 489d050825648e1598cc352a22e3ba3329b445dd Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:57:05 +0400 Subject: [PATCH 012/115] Add getSourceIpAddress method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 4878bd9..e22cafc 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -59,4 +59,8 @@ public void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } + public String getSourceIpAddress() { + return sourceIpAddress; + } + } \ No newline at end of file From 087ddb38eafc4a7eca3e1d15b68bdb2d8b155188 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:57:24 +0400 Subject: [PATCH 013/115] Add setSourceIpAddress method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index e22cafc..3081ef0 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -63,4 +63,8 @@ public String getSourceIpAddress() { return sourceIpAddress; } + public void setSourceIpAddress(String sourceIpAddress) { + this.sourceIpAddress = sourceIpAddress; + } + } \ No newline at end of file From 63979df5b9c7a60c217fec291aa23a508a7e1c8d Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:57:49 +0400 Subject: [PATCH 014/115] Add getInput method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 3081ef0..c3810b8 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -67,4 +67,8 @@ public void setSourceIpAddress(String sourceIpAddress) { this.sourceIpAddress = sourceIpAddress; } + public String getInput() { + return input; + } + } \ No newline at end of file From 73d0c56d363422a9afd9e0af961875c5d6c11799 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:58:11 +0400 Subject: [PATCH 015/115] Add setInput method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index c3810b8..034a1f9 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -71,4 +71,8 @@ public String getInput() { return input; } + public void setInput(String input) { + this.input = input; + } + } \ No newline at end of file From df3c1e23971a9f4d2e566a80e51ecfe4b0824798 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:58:42 +0400 Subject: [PATCH 016/115] Add getOutput method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 034a1f9..579183c 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -75,4 +75,8 @@ public void setInput(String input) { this.input = input; } + public String getOutput() { + return output; + } + } \ No newline at end of file From 1711e1af88aa9a4a73ad44a4d2604e4c9d0f9e7e Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 19:59:16 +0400 Subject: [PATCH 017/115] Add setOutput method --- .../oraclequantapi/oraclequantapi/model/HistoryRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 579183c..97df945 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -79,4 +79,8 @@ public String getOutput() { return output; } + public void setOutput(String output) { + this.output = output; + } + } \ No newline at end of file From 69a64ee7a17afca143c171a1b164615e83c2d7a1 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 20:08:16 +0400 Subject: [PATCH 018/115] Complete HistoryRecord entity implementation --- .../oraclequantapi/model/HistoryRecord.java | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 97df945..3452e63 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -6,81 +6,99 @@ import java.time.Instant; -@Entity -@Table(name = "CONVERSION_HISTORY") +@Entity // Marks this class as a database entity +@Table(name = "CONVERSION_HISTORY") // Maps this entity to the CONVERSION_HISTORY table public class HistoryRecord { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "ID") + @Id // Primary key of the table + @GeneratedValue(strategy = GenerationType.IDENTITY) // Auto generate ID values + + @Column(name = "ID") // Maps the field to the ID column private Long id; - @Column(name = "CREATED_AT", nullable = false) + @Column(name = "CREATED_AT", nullable = false) // Stores the record creation timestamp + private Instant timestamp; - @Column(name = "SOURCE_IP_ADDRESS", nullable = false, length = 128) - @JsonProperty("source_ip_address") - @JsonAlias("sourceIpAddress") + @Column(name = "SOURCE_IP_ADDRESS", nullable = false, length = 128) // Stores the source IP address + + @JsonProperty("source_ip_address") // JSON property name when sending response + + @JsonAlias("sourceIpAddress") // Accept alternative JSON field name private String sourceIpAddress; + // Stores request input as large text @Lob @Column(name = "INPUT") private String input; + // Stores generated output as large text @Lob @Column(name = "OUTPUT", nullable = false) private String output; + // Default constructor required by JPA protected HistoryRecord() { } + // Constructor used to create a new history record public HistoryRecord(String sourceIpAddress, String input, String output) { this.sourceIpAddress = sourceIpAddress; this.input = input; this.output = output; } + // Automatically runs before saving the entity @PrePersist void onCreate() { + // Set current timestamp if it is empty if (timestamp == null) { timestamp = Instant.now(); } } + // Returns the database ID public Long getId() { return id; } + // Returns the creation timestamp public Instant getTimestamp() { return timestamp; } + // Updates the timestamp public void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } + // Returns the source IP address public String getSourceIpAddress() { return sourceIpAddress; } + // Updates the source IP address public void setSourceIpAddress(String sourceIpAddress) { this.sourceIpAddress = sourceIpAddress; } + // Returns the input value public String getInput() { return input; } + // Updates the input value public void setInput(String input) { this.input = input; } + // Returns the output value public String getOutput() { return output; } + // Updates the output value public void setOutput(String output) { this.output = output; } - } \ No newline at end of file From d1b8405a7b2b118914d94341f11d37ffd0e50dd9 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 20:12:10 +0400 Subject: [PATCH 019/115] Create HistoryRepository interface --- .../oraclequantapi/repository/HistoryRepository.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java new file mode 100644 index 0000000..0a6ebb0 --- /dev/null +++ b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java @@ -0,0 +1,4 @@ +package com.oraclequantapi.oraclequantapi.repository; + +public interface HistoryRepository { +} \ No newline at end of file From 754af3925682c7a0b380227a99d95407643ba4c6 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 20:12:54 +0400 Subject: [PATCH 020/115] Import HistoryRecord entity into repository --- .../oraclequantapi/repository/HistoryRepository.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java index 0a6ebb0..b57e752 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java @@ -1,4 +1,6 @@ package com.oraclequantapi.oraclequantapi.repository; +import com.oraclequantapi.oraclequantapi.model.HistoryRecord; + public interface HistoryRepository { } \ No newline at end of file From c48439cdc939e63df98c92cf7dcb3b3f8a190bf0 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 20:13:19 +0400 Subject: [PATCH 021/115] Import JpaRepository from Spring Data JPA --- .../oraclequantapi/repository/HistoryRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java index b57e752..d3ba1c2 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java @@ -1,6 +1,7 @@ package com.oraclequantapi.oraclequantapi.repository; import com.oraclequantapi.oraclequantapi.model.HistoryRecord; +import org.springframework.data.jpa.repository.JpaRepository; public interface HistoryRepository { } \ No newline at end of file From b0c983b21278a4cc02763a493c9125f33aad172a Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 20:14:24 +0400 Subject: [PATCH 022/115] Extend JpaRepository for HistoryRecord entity --- .../oraclequantapi/repository/HistoryRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java index d3ba1c2..3835440 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java @@ -3,5 +3,5 @@ import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import org.springframework.data.jpa.repository.JpaRepository; -public interface HistoryRepository { +public interface HistoryRepository extends JpaRepository { } \ No newline at end of file From b1fa964e0c8ab1de0eab8d90425f1ca0288b1034 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 20:17:02 +0400 Subject: [PATCH 023/115] Complete HistoryRepository implementation --- .../oraclequantapi/repository/HistoryRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java index 3835440..ca8e43f 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/repository/HistoryRepository.java @@ -3,5 +3,6 @@ import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import org.springframework.data.jpa.repository.JpaRepository; +// Repository interface used for database operations public interface HistoryRepository extends JpaRepository { } \ No newline at end of file From ae4a187e3ffa8e410e3d63be156b24470f6cc759 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:14:21 +0400 Subject: [PATCH 024/115] Create MeasurementService class --- .../oraclequantapi/service/MeasurementService.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java new file mode 100644 index 0000000..0555a7d --- /dev/null +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -0,0 +1,4 @@ +package com.oraclequantapi.oraclequantapi.service; + +public class MeasurementService { +} \ No newline at end of file From fe349002a86831648fe792349480dd79d0a6a48b Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:15:12 +0400 Subject: [PATCH 025/115] Add Spring service annotation --- .../oraclequantapi/service/MeasurementService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 0555a7d..af9209b 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -1,4 +1,7 @@ package com.oraclequantapi.oraclequantapi.service; +import org.springframework.stereotype.Service; + +@Service public class MeasurementService { } \ No newline at end of file From b5aaa132dcd90a2a5b89bb0ff3a918f66d7590b4 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:16:06 +0400 Subject: [PATCH 026/115] Add convert method structure --- .../oraclequantapi/service/MeasurementService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index af9209b..86c50a8 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -2,6 +2,12 @@ import org.springframework.stereotype.Service; +import java.util.List; + @Service public class MeasurementService { + + public List convert(String input) { + return List.of(); + } } \ No newline at end of file From 7f055030a50c2345869b46843b066ffab20979e1 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:17:44 +0400 Subject: [PATCH 027/115] Handle null input in convert method --- .../oraclequantapi/service/MeasurementService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 86c50a8..6e41497 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -8,6 +8,8 @@ public class MeasurementService { public List convert(String input) { - return List.of(); + if (input == null) { + return List.of(); + } } } \ No newline at end of file From fa596fd53ebc5b9457bc124288bf1a2bb8af1845 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:18:56 +0400 Subject: [PATCH 028/115] Initialize totals list and index counter --- .../oraclequantapi/service/MeasurementService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 6e41497..1473edb 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -2,6 +2,7 @@ import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; @Service @@ -11,5 +12,8 @@ public List convert(String input) { if (input == null) { return List.of(); } + + List totals = new ArrayList<>(); + int index = 0; } } \ No newline at end of file From c09bc0706ea42a27512392fb51455128a3223bc7 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:19:53 +0400 Subject: [PATCH 029/115] Add parsing loop for input processing --- .../oraclequantapi/service/MeasurementService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 1473edb..e8d795b 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -15,5 +15,9 @@ public List convert(String input) { List totals = new ArrayList<>(); int index = 0; + + while (index < input.length()) { + + } } } \ No newline at end of file From d8ebed3ef18cab557a0ac09ebc5ae5338bb561f3 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:21:17 +0400 Subject: [PATCH 030/115] Read count values from encoded input --- .../oraclequantapi/service/MeasurementService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index e8d795b..013182a 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -17,6 +17,8 @@ public List convert(String input) { int index = 0; while (index < input.length()) { + ParsedNumber count = readNumber(input, index); + index = count.nextIndex(); } } From f7b46245172cce032b17dc6b6e90210f44946420 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:22:08 +0400 Subject: [PATCH 031/115] Add measurement accumulation logic --- .../oraclequantapi/service/MeasurementService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 013182a..a5f48b9 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -21,5 +21,15 @@ public List convert(String input) { index = count.nextIndex(); } + + int total = 0; + for (int valueIndex = 0; valueIndex < count.value(); valueIndex++) { + if (index >= input.length()) { + continue; + } + ParsedNumber measurement = readNumber(input, index); + total += measurement.value(); + index = measurement.nextIndex(); + } } } \ No newline at end of file From 92eb283748acaef80e40c7f477f4b24ddaed4120 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:22:44 +0400 Subject: [PATCH 032/115] Store calculated totals in result list --- .../oraclequantapi/service/MeasurementService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index a5f48b9..e7bb0ec 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -31,5 +31,6 @@ public List convert(String input) { total += measurement.value(); index = measurement.nextIndex(); } + totals.add(total); } } \ No newline at end of file From 0a2c4ab4d8b57aa2e29e35a740d0a89e26829ca3 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:25:04 +0400 Subject: [PATCH 033/115] Return converted totals list --- .../service/MeasurementService.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index e7bb0ec..1d0e4fa 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -20,17 +20,18 @@ public List convert(String input) { ParsedNumber count = readNumber(input, index); index = count.nextIndex(); - } - int total = 0; - for (int valueIndex = 0; valueIndex < count.value(); valueIndex++) { - if (index >= input.length()) { - continue; + int total = 0; + for (int valueIndex = 0; valueIndex < count.value(); valueIndex++) { + if (index >= input.length()) { + continue; + } + ParsedNumber measurement = readNumber(input, index); + total += measurement.value(); + index = measurement.nextIndex(); } - ParsedNumber measurement = readNumber(input, index); - total += measurement.value(); - index = measurement.nextIndex(); + totals.add(total); } - totals.add(total); + return totals; } } \ No newline at end of file From 4ad80126c8d9c5e29fc89ca57ee7d3cf26668ddc Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:26:17 +0400 Subject: [PATCH 034/115] Add readNumber helper method --- .../oraclequantapi/service/MeasurementService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 1d0e4fa..9913479 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -34,4 +34,9 @@ public List convert(String input) { } return totals; } + + private ParsedNumber readNumber(String input, int startIndex) { + + } + } \ No newline at end of file From 5c7503521591a7eb2db54b4a5a906a6fdee29b2a Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:27:01 +0400 Subject: [PATCH 035/115] Handle single character number parsing --- .../oraclequantapi/service/MeasurementService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 9913479..e48d657 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -36,7 +36,11 @@ public List convert(String input) { } private ParsedNumber readNumber(String input, int startIndex) { + char first = input.charAt(startIndex); + if (first != 'z') { + return new ParsedNumber(symbolValue(first), startIndex + 1); + } } } \ No newline at end of file From 0d757e6d75aa03875e1e6915104eed287e6d0bb0 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:27:40 +0400 Subject: [PATCH 036/115] Add multi character z-based number parsing --- .../oraclequantapi/service/MeasurementService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index e48d657..2541c41 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -41,6 +41,15 @@ private ParsedNumber readNumber(String input, int startIndex) { if (first != 'z') { return new ParsedNumber(symbolValue(first), startIndex + 1); } + + int index = startIndex; + int value = 0; + + while (index < input.length() && input.charAt(index) == 'z') { + value += 26; + index++; + } + } } \ No newline at end of file From 3f68800cc6547a1bd262203effebd722c0d75f65 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:28:10 +0400 Subject: [PATCH 037/115] Add terminator symbol parsing logic --- .../oraclequantapi/service/MeasurementService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 2541c41..3b4f05e 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -50,6 +50,12 @@ private ParsedNumber readNumber(String input, int startIndex) { index++; } + if (index < input.length()) { + char terminator = input.charAt(index); + value += symbolValue(terminator); + index++; + } + } } \ No newline at end of file From 7847be384af9dc399e07918be25273ebce0dc658 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:29:07 +0400 Subject: [PATCH 038/115] Return parsed number object --- .../oraclequantapi/service/MeasurementService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 3b4f05e..5a977c2 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -55,6 +55,7 @@ private ParsedNumber readNumber(String input, int startIndex) { value += symbolValue(terminator); index++; } + return new ParsedNumber(value, index); } From deae72c11619a97e61647daefa7c80d77ba3ece9 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:29:53 +0400 Subject: [PATCH 039/115] Add symbolValue helper method --- .../oraclequantapi/service/MeasurementService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 5a977c2..9a32866 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -56,6 +56,9 @@ private ParsedNumber readNumber(String input, int startIndex) { index++; } return new ParsedNumber(value, index); + } + + private int symbolValue(char symbol) { } From 6971d8973a75180aa6e66f16d995bec8bdacaefe Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:30:24 +0400 Subject: [PATCH 040/115] Handle underscore symbol as zero --- .../oraclequantapi/service/MeasurementService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 9a32866..e44d4de 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -59,6 +59,9 @@ private ParsedNumber readNumber(String input, int startIndex) { } private int symbolValue(char symbol) { + if (symbol == '_') { + return 0; + } } From 4f6ff1ca0d38492c502dad1171c5906690cc59a1 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:31:05 +0400 Subject: [PATCH 041/115] Validate symbol range before conversion --- .../oraclequantapi/service/MeasurementService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index e44d4de..61fb154 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -62,7 +62,9 @@ private int symbolValue(char symbol) { if (symbol == '_') { return 0; } - + if (symbol < 'a' || symbol > 'z') { + return 0; + } } } \ No newline at end of file From f8fdeff630ff0f0ded9e433677c5fa7535442f00 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:31:37 +0400 Subject: [PATCH 042/115] Convert alphabet symbol to numeric value --- .../oraclequantapi/service/MeasurementService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 61fb154..cb0a9f2 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -65,6 +65,7 @@ private int symbolValue(char symbol) { if (symbol < 'a' || symbol > 'z') { return 0; } + return symbol - 'a' + 1; } } \ No newline at end of file From 770605d0eb87e3ed17a15e3ca353be5b71c4f3d8 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:32:24 +0400 Subject: [PATCH 043/115] Add ParsedNumber record structure --- .../oraclequantapi/service/MeasurementService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index cb0a9f2..0681c27 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -68,4 +68,6 @@ private int symbolValue(char symbol) { return symbol - 'a' + 1; } + private record ParsedNumber(int value, int nextIndex) { + } } \ No newline at end of file From b014a9618ae0de1516b04956ed6fb02ed30874de Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Sun, 24 May 2026 23:39:53 +0400 Subject: [PATCH 044/115] Complete MeasurementService implementation --- .../service/MeasurementService.java | 51 ++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java index 0681c27..f5eefe9 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/MeasurementService.java @@ -5,69 +5,86 @@ import java.util.ArrayList; import java.util.List; -@Service +@Service // Marks this class as a Spring service component public class MeasurementService { + // Converts encoded input into list of totals public List convert(String input) { + + // Return empty list if input is null if (input == null) { return List.of(); } - List totals = new ArrayList<>(); - int index = 0; + List totals = new ArrayList<>(); // Store calculated totals + int index = 0; // Current reading position in the input string + // Continue while there are remaining characters while (index < input.length()) { - ParsedNumber count = readNumber(input, index); - index = count.nextIndex(); - + ParsedNumber count = readNumber(input, index); // Read how many measurements should be processed + index = count.nextIndex(); // Move to the next unread position + int total = 0; // Store total for current group - int total = 0; + // Loop through measurements for (int valueIndex = 0; valueIndex < count.value(); valueIndex++) { + // Skip if end of string is reached if (index >= input.length()) { continue; } - ParsedNumber measurement = readNumber(input, index); - total += measurement.value(); - index = measurement.nextIndex(); + + ParsedNumber measurement = readNumber(input, index); // Read next measurement value + total += measurement.value(); // Add measurement value to total + index = measurement.nextIndex(); // Move to next unread position } - totals.add(total); + totals.add(total); // Save total into result list } - return totals; + return totals; // Return all totals } + // Reads encoded numbers from the input string private ParsedNumber readNumber(String input, int startIndex) { - char first = input.charAt(startIndex); + char first = input.charAt(startIndex); // Get current character + // Single character number handling if (first != 'z') { return new ParsedNumber(symbolValue(first), startIndex + 1); } + // Start reading z-based values int index = startIndex; int value = 0; + // Every z adds 26 while (index < input.length() && input.charAt(index) == 'z') { value += 26; index++; } + // Read final terminating character if (index < input.length()) { char terminator = input.charAt(index); - value += symbolValue(terminator); - index++; + value += symbolValue(terminator); // Add remaining value + index++; // Move to next character } - return new ParsedNumber(value, index); + return new ParsedNumber(value, index); // Return parsed value and next position } + // Converts alphabet symbols into numeric values private int symbolValue(char symbol) { + + // Underscore means zero if (symbol == '_') { return 0; } + + // Reject invalid characters if (symbol < 'a' || symbol > 'z') { return 0; } - return symbol - 'a' + 1; + return symbol - 'a' + 1; // Convert a-z into 1-26 } + // Stores parsed number value and next index private record ParsedNumber(int value, int nextIndex) { } } \ No newline at end of file From a3f0b0250ccffcd3e517a318a5c658e5e66305f5 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:11:49 +0400 Subject: [PATCH 045/115] Create HistoryService class --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java new file mode 100644 index 0000000..5c7bca4 --- /dev/null +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -0,0 +1,4 @@ +package com.oraclequantapi.oraclequantapi.service; + +public class HistoryService { +} \ No newline at end of file From d0e5c245238de493a6cca16b2d59c04b68a697d7 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:13:51 +0400 Subject: [PATCH 046/115] Add Spring service annotation --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 5c7bca4..9d05282 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -1,4 +1,7 @@ package com.oraclequantapi.oraclequantapi.service; +import org.springframework.stereotype.Service; + +@Service public class HistoryService { } \ No newline at end of file From 9e466de2a488a51abfe9ec2e5da689d837e629ee Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:15:14 +0400 Subject: [PATCH 047/115] Add repository and object mapper dependencies --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 9d05282..1379f2c 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -1,7 +1,11 @@ package com.oraclequantapi.oraclequantapi.service; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.oraclequantapi.oraclequantapi.repository.HistoryRepository; import org.springframework.stereotype.Service; @Service public class HistoryService { + private final HistoryRepository repository; + private final ObjectMapper objectMapper; } \ No newline at end of file From 72f1ab17b025a61e2e6c616d2802adca0da98c7f Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:15:47 +0400 Subject: [PATCH 048/115] Add constructor dependency injection --- .../oraclequantapi/service/HistoryService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 1379f2c..a17fdaf 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -8,4 +8,10 @@ public class HistoryService { private final HistoryRepository repository; private final ObjectMapper objectMapper; + + public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { + this.repository = repository; + this.objectMapper = objectMapper; + } + } \ No newline at end of file From 679f1c8f46e0bc48cf60e30dfc5b6005eff8d653 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:17:54 +0400 Subject: [PATCH 049/115] Add record method for storing history --- .../oraclequantapi/service/HistoryService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index a17fdaf..5e622ab 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -1,8 +1,12 @@ package com.oraclequantapi.oraclequantapi.service; import com.fasterxml.jackson.databind.ObjectMapper; +import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import com.oraclequantapi.oraclequantapi.repository.HistoryRepository; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; @Service public class HistoryService { @@ -14,4 +18,9 @@ public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { this.objectMapper = objectMapper; } + @Transactional + public HistoryRecord record(String input, List output, String sourceIpAddress) { + + } + } \ No newline at end of file From 6f47ad37f6d894cb25bcb9ed618b35a880c99193 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:19:19 +0400 Subject: [PATCH 050/115] Serialize output list into JSON format --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 5e622ab..7993ab8 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -21,6 +21,8 @@ public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { @Transactional public HistoryRecord record(String input, List output, String sourceIpAddress) { + String outputJson = objectMapper.writeValueAsString(output); + } } \ No newline at end of file From c99704a4df17c0f08e942b0fd2fe737acb584fbd Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:20:00 +0400 Subject: [PATCH 051/115] Save history record into database --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 7993ab8..5c25084 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -22,7 +22,7 @@ public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { public HistoryRecord record(String input, List output, String sourceIpAddress) { String outputJson = objectMapper.writeValueAsString(output); - + return repository.save(new HistoryRecord(sourceIpAddress, input, outputJson)); } } \ No newline at end of file From 4fcec0bbb9111db07524e8b81a742457f7192c33 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:20:57 +0400 Subject: [PATCH 052/115] Handle JSON serialization exceptions --- .../oraclequantapi/service/HistoryService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 5c25084..50dbf46 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -1,5 +1,6 @@ package com.oraclequantapi.oraclequantapi.service; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import com.oraclequantapi.oraclequantapi.repository.HistoryRepository; @@ -21,8 +22,13 @@ public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { @Transactional public HistoryRecord record(String input, List output, String sourceIpAddress) { - String outputJson = objectMapper.writeValueAsString(output); - return repository.save(new HistoryRecord(sourceIpAddress, input, outputJson)); + try { + String outputJson = objectMapper.writeValueAsString(output); + return repository.save(new HistoryRecord(sourceIpAddress, input, outputJson)); + } + catch (JsonProcessingException exception) { + throw new IllegalStateException("Unable to serialize conversion output", exception); + } } } \ No newline at end of file From 3891978806ffb4f13b88c8e6dc067b4bd1a7a3f9 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:22:20 +0400 Subject: [PATCH 053/115] Add findAll method with sorting support --- .../oraclequantapi/service/HistoryService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 50dbf46..215012c 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import com.oraclequantapi.oraclequantapi.repository.HistoryRepository; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,4 +32,9 @@ public HistoryRecord record(String input, List output, String sourceIpA } } + @Transactional(readOnly = true) + public List findAll() { + return repository.findAll(Sort.by(Sort.Direction.ASC, "id")); + } + } \ No newline at end of file From 7716221c66a2b7624ea74104fc9409943232459b Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:23:20 +0400 Subject: [PATCH 054/115] Add findById method with exception handling --- .../oraclequantapi/service/HistoryService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 215012c..4ba791e 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -37,4 +37,9 @@ public List findAll() { return repository.findAll(Sort.by(Sort.Direction.ASC, "id")); } + @Transactional(readOnly = true) + public HistoryRecord findById(Long id) { + return repository.findById(id).orElseThrow(() -> new HistoryRecordNotFoundException(id)); + } + } \ No newline at end of file From e60b1494a79bfe4117de8f14b7a0fa549159a94a Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:24:26 +0400 Subject: [PATCH 055/115] Add update method for history records --- .../oraclequantapi/service/HistoryService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 4ba791e..dc73afa 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.Instant; import java.util.List; @Service @@ -42,4 +43,10 @@ public HistoryRecord findById(Long id) { return repository.findById(id).orElseThrow(() -> new HistoryRecordNotFoundException(id)); } + @Transactional + public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, String input, String output) { + HistoryRecord record = findById(id); + return repository.save(record); + } + } \ No newline at end of file From 6bd757f513dfa724de2c3a929715bd78c391a9a4 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:24:58 +0400 Subject: [PATCH 056/115] Add timestamp update validation --- .../oraclequantapi/service/HistoryService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index dc73afa..7f62a05 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -46,6 +46,11 @@ public HistoryRecord findById(Long id) { @Transactional public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, String input, String output) { HistoryRecord record = findById(id); + + if (timestamp != null) { + record.setTimestamp(timestamp); + } + return repository.save(record); } From 21b329f0c6f4a1b8da7e69329a13c7750aa19f36 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:25:18 +0400 Subject: [PATCH 057/115] Add source IP address update validation --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 7f62a05..20f964b 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -51,6 +51,10 @@ public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, record.setTimestamp(timestamp); } + if (sourceIpAddress != null) { + record.setSourceIpAddress(sourceIpAddress); + } + return repository.save(record); } From 3a5c8970aeaafbb20ab3cbdce3981bd6cb97ada2 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:25:42 +0400 Subject: [PATCH 058/115] Add input update validation --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 20f964b..9d755cd 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -55,6 +55,10 @@ public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, record.setSourceIpAddress(sourceIpAddress); } + if (input != null) { + record.setInput(input); + } + return repository.save(record); } From 146366417443aa705fcb5bace673bfb1a959c70d Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:26:12 +0400 Subject: [PATCH 059/115] Add output update validation --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 9d755cd..749c804 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -59,6 +59,10 @@ public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, record.setInput(input); } + if (output != null) { + record.setOutput(output); + } + return repository.save(record); } From 5d80022dfe5e674cbee17054d269a627d480bc35 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:27:29 +0400 Subject: [PATCH 060/115] Add deleteAll method --- .../oraclequantapi/service/HistoryService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 749c804..4d81227 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -66,4 +66,9 @@ public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, return repository.save(record); } + @Transactional + public void deleteAll() { + repository.deleteAllInBatch(); + } + } \ No newline at end of file From 58d89eca5aa49ccbe0e93857e6869042d6f54dac Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:28:07 +0400 Subject: [PATCH 061/115] Add deleteById method --- .../oraclequantapi/service/HistoryService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 4d81227..1a30c2d 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -71,4 +71,9 @@ public void deleteAll() { repository.deleteAllInBatch(); } + @Transactional + public void deleteById(Long id) { + + } + } \ No newline at end of file From bf579f50bbdb81b8661c5d78f2047cb97ac57525 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:28:38 +0400 Subject: [PATCH 062/115] Validate history record existence before deletion --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 1a30c2d..e636113 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -73,6 +73,9 @@ public void deleteAll() { @Transactional public void deleteById(Long id) { + if (!repository.existsById(id)) { + throw new HistoryRecordNotFoundException(id); + } } From 74168b2d5fa2b2e083657f8bd5e37f5a32a394d8 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:29:01 +0400 Subject: [PATCH 063/115] Delete history record by ID --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index e636113..edc9410 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -76,6 +76,7 @@ public void deleteById(Long id) { if (!repository.existsById(id)) { throw new HistoryRecordNotFoundException(id); } + repository.deleteById(id); } From 29d9b6f36b4bca7cc1dad5b7dc6e124871f82ded Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:29:47 +0400 Subject: [PATCH 064/115] Add HistoryRecordNotFoundException class --- .../oraclequantapi/oraclequantapi/service/HistoryService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index edc9410..c447ac6 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -80,4 +80,8 @@ public void deleteById(Long id) { } + public static class HistoryRecordNotFoundException extends RuntimeException { + + } + } \ No newline at end of file From cdc379820f63e58229ca15585fd73daa653f424a Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:30:24 +0400 Subject: [PATCH 065/115] Add exception constructor with custom message --- .../oraclequantapi/service/HistoryService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index c447ac6..dab5c59 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -77,11 +77,12 @@ public void deleteById(Long id) { throw new HistoryRecordNotFoundException(id); } repository.deleteById(id); - } public static class HistoryRecordNotFoundException extends RuntimeException { - + public HistoryRecordNotFoundException(Long id) { + super("History record not found: " + id); + } } } \ No newline at end of file From 563ccef83a3adb80db314c6f5e2299766462e212 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:34:02 +0400 Subject: [PATCH 066/115] Complete HistoryService implementation --- .../service/HistoryService.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index dab5c59..7b9756e 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -11,16 +11,18 @@ import java.time.Instant; import java.util.List; -@Service +@Service // Marks this class as a Spring service public class HistoryService { - private final HistoryRepository repository; - private final ObjectMapper objectMapper; + private final HistoryRepository repository; // Repository used for database operations + private final ObjectMapper objectMapper; // ObjectMapper used to convert Java objects into JSON + // Constructor dependency injection public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { this.repository = repository; this.objectMapper = objectMapper; } + // Saves conversion history into the database @Transactional public HistoryRecord record(String input, List output, String sourceIpAddress) { @@ -33,44 +35,44 @@ public HistoryRecord record(String input, List output, String sourceIpA } } + // Returns all history records sorted by ID @Transactional(readOnly = true) public List findAll() { return repository.findAll(Sort.by(Sort.Direction.ASC, "id")); } + // Finds history record using ID @Transactional(readOnly = true) public HistoryRecord findById(Long id) { return repository.findById(id).orElseThrow(() -> new HistoryRecordNotFoundException(id)); } + // Updates existing history record @Transactional public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, String input, String output) { HistoryRecord record = findById(id); - if (timestamp != null) { record.setTimestamp(timestamp); } - if (sourceIpAddress != null) { record.setSourceIpAddress(sourceIpAddress); } - if (input != null) { record.setInput(input); } - if (output != null) { record.setOutput(output); } - return repository.save(record); } + // Deletes all history records @Transactional public void deleteAll() { repository.deleteAllInBatch(); } + // Deletes history record using ID @Transactional public void deleteById(Long id) { if (!repository.existsById(id)) { @@ -79,10 +81,10 @@ public void deleteById(Long id) { repository.deleteById(id); } + // Custom exception for missing history records public static class HistoryRecordNotFoundException extends RuntimeException { public HistoryRecordNotFoundException(Long id) { super("History record not found: " + id); } } - } \ No newline at end of file From 4e5ab44bd955bb8c85dad6432f43ae47ebbd8501 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:38:40 +0400 Subject: [PATCH 067/115] Create MeasurementController class --- .../oraclequantapi/controller/MeasurementController.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java new file mode 100644 index 0000000..59d5322 --- /dev/null +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -0,0 +1,4 @@ +package com.oraclequantapi.oraclequantapi.controller; + +public class MeasurementController { +} \ No newline at end of file From f7605f4d9a8065a7377723acd4be85f3a88d4280 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:39:21 +0400 Subject: [PATCH 068/115] Add REST controller annotation --- .../oraclequantapi/controller/MeasurementController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 59d5322..063e5e0 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -1,4 +1,7 @@ package com.oraclequantapi.oraclequantapi.controller; +import org.springframework.web.bind.annotation.RestController; + +@RestController public class MeasurementController { } \ No newline at end of file From d4ebfbb69d158acc24950079c4dadbdc60408c77 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:41:32 +0400 Subject: [PATCH 069/115] Initialize controller logger --- .../oraclequantapi/controller/MeasurementController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 063e5e0..eddada7 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -1,7 +1,10 @@ package com.oraclequantapi.oraclequantapi.controller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RestController; @RestController public class MeasurementController { + private static final Logger log = LoggerFactory.getLogger(MeasurementController.class); } \ No newline at end of file From 1292d8375bdbd49686d450ad1583fe7d13e322ef Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:42:14 +0400 Subject: [PATCH 070/115] Add service dependencies to controller --- .../oraclequantapi/controller/MeasurementController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index eddada7..2bce719 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -1,5 +1,7 @@ package com.oraclequantapi.oraclequantapi.controller; +import com.oraclequantapi.oraclequantapi.service.HistoryService; +import com.oraclequantapi.oraclequantapi.service.MeasurementService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RestController; @@ -7,4 +9,8 @@ @RestController public class MeasurementController { private static final Logger log = LoggerFactory.getLogger(MeasurementController.class); + + private final MeasurementService measurementService; + private final HistoryService historyService; + } \ No newline at end of file From 1349e112ae40682b59e9983d066e7fb0c9b8e530 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:42:51 +0400 Subject: [PATCH 071/115] Add constructor dependency injection --- .../oraclequantapi/controller/MeasurementController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 2bce719..8cda424 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -13,4 +13,9 @@ public class MeasurementController { private final MeasurementService measurementService; private final HistoryService historyService; + public MeasurementController(MeasurementService measurementService, HistoryService historyService) { + this.measurementService = measurementService; + this.historyService = historyService; + } + } \ No newline at end of file From cf27895818581e73d1ac295dc936c1e2d4bb3fd8 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:44:13 +0400 Subject: [PATCH 072/115] Add convert endpoint method --- .../controller/MeasurementController.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 8cda424..00616d2 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -2,10 +2,15 @@ import com.oraclequantapi.oraclequantapi.service.HistoryService; import com.oraclequantapi.oraclequantapi.service.MeasurementService; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @RestController public class MeasurementController { private static final Logger log = LoggerFactory.getLogger(MeasurementController.class); @@ -18,4 +23,10 @@ public MeasurementController(MeasurementService measurementService, HistoryServi this.historyService = historyService; } + @GetMapping("/convert-measurements") + public List convert(@RequestParam(required = false) String input, HttpServletRequest request) { + + return List.of(); + } + } \ No newline at end of file From f8f8ff44f6cad5972d9f56f1a200848d280a3fd3 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:47:55 +0400 Subject: [PATCH 073/115] Handle null input safely --- .../oraclequantapi/controller/MeasurementController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 00616d2..119a638 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -26,6 +26,15 @@ public MeasurementController(MeasurementService measurementService, HistoryServi @GetMapping("/convert-measurements") public List convert(@RequestParam(required = false) String input, HttpServletRequest request) { + String safeInput; + if (input == null) { + safeInput = ""; + } + else { + safeInput = input; + } + + return List.of(); } From 58184b2dc0728571b3bcbc6316e9a3dfafd16ded Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:48:19 +0400 Subject: [PATCH 074/115] Log received request input --- .../oraclequantapi/controller/MeasurementController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 119a638..8ccd786 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -34,6 +34,7 @@ public List convert(@RequestParam(required = false) String input, HttpS safeInput = input; } + log.info("Received input: {}", safeInput); return List.of(); } From cd4cc1673370230bea3030ba9203c6042fdead34 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:48:49 +0400 Subject: [PATCH 075/115] Convert measurement input using service --- .../oraclequantapi/controller/MeasurementController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 8ccd786..d84495f 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -36,6 +36,8 @@ public List convert(@RequestParam(required = false) String input, HttpS log.info("Received input: {}", safeInput); + List output = measurementService.convert(safeInput); + return List.of(); } From b74466c431496e9d9852b43d04874505e644e32b Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:49:26 +0400 Subject: [PATCH 076/115] Log conversion result --- .../oraclequantapi/controller/MeasurementController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index d84495f..a66b818 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -38,6 +38,8 @@ public List convert(@RequestParam(required = false) String input, HttpS List output = measurementService.convert(safeInput); + log.info("Conversion result: {}", output); + return List.of(); } From 8aa914fa87748eb2868e8ed1e60127f9c6f5346b Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:50:18 +0400 Subject: [PATCH 077/115] Save conversion request history --- .../oraclequantapi/controller/MeasurementController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index a66b818..8e92783 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -40,6 +40,8 @@ public List convert(@RequestParam(required = false) String input, HttpS log.info("Conversion result: {}", output); + historyService.record(safeInput, output, clientIp(request)); + return List.of(); } From 0fcb1bc05b5e1325d23728941bf27833354af806 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:50:58 +0400 Subject: [PATCH 078/115] Log client IP address after saving request --- .../oraclequantapi/controller/MeasurementController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 8e92783..a80c64c 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -42,6 +42,8 @@ public List convert(@RequestParam(required = false) String input, HttpS historyService.record(safeInput, output, clientIp(request)); + log.info("Request saved from IP: {}", clientIp(request)); + return List.of(); } From c3074e0c9c28177158cb60d033edd3e641a394fe Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:52:17 +0400 Subject: [PATCH 079/115] Return conversion output response --- .../oraclequantapi/controller/MeasurementController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index a80c64c..110182f 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -44,7 +44,7 @@ public List convert(@RequestParam(required = false) String input, HttpS log.info("Request saved from IP: {}", clientIp(request)); - return List.of(); + return output; } } \ No newline at end of file From 1a326cda8406d9a1ac575ed9d8ccf1e777fa7b01 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:52:44 +0400 Subject: [PATCH 080/115] Add client IP extraction helper method --- .../oraclequantapi/controller/MeasurementController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 110182f..5c49bc5 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -47,4 +47,8 @@ public List convert(@RequestParam(required = false) String input, HttpS return output; } + private String clientIp(HttpServletRequest request) { + + } + } \ No newline at end of file From 9407e242fcc9416568637e116758e525af048ee0 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:53:48 +0400 Subject: [PATCH 081/115] Read forwarded IP address from request headers --- .../oraclequantapi/controller/MeasurementController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index 5c49bc5..fe2cb74 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -48,7 +48,7 @@ public List convert(@RequestParam(required = false) String input, HttpS } private String clientIp(HttpServletRequest request) { - + String forwardedFor = request.getHeader("X-Forwarded-For"); } } \ No newline at end of file From a6b5d82207a008d391fa405f41169d44cb755966 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:54:24 +0400 Subject: [PATCH 082/115] Handle proxy forwarded IP addresses --- .../oraclequantapi/controller/MeasurementController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index fe2cb74..c567cc6 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -49,6 +49,9 @@ public List convert(@RequestParam(required = false) String input, HttpS private String clientIp(HttpServletRequest request) { String forwardedFor = request.getHeader("X-Forwarded-For"); + if (forwardedFor != null && !forwardedFor.isBlank()) { + return forwardedFor.split(",")[0].trim(); + } } } \ No newline at end of file From d842e7a9618d59016982d75d84c45e226c3c763a Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:55:01 +0400 Subject: [PATCH 083/115] Fallback to remote client address --- .../oraclequantapi/controller/MeasurementController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index c567cc6..bdf32ab 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -52,6 +52,7 @@ private String clientIp(HttpServletRequest request) { if (forwardedFor != null && !forwardedFor.isBlank()) { return forwardedFor.split(",")[0].trim(); } + return request.getRemoteAddr(); } } \ No newline at end of file From 54bebd9543162484cab0b79fa1693d18235bc621 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 00:59:11 +0400 Subject: [PATCH 084/115] Complete MeasurementController implementation --- .../controller/MeasurementController.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java index bdf32ab..03ad6ba 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/MeasurementController.java @@ -11,21 +11,28 @@ import java.util.List; -@RestController +@RestController // Marks this class as a REST controller public class MeasurementController { + // Logger used for request and response logging private static final Logger log = LoggerFactory.getLogger(MeasurementController.class); + // Service responsible for conversion logic private final MeasurementService measurementService; + + // Service responsible for history storage private final HistoryService historyService; + // Constructor dependency injection public MeasurementController(MeasurementService measurementService, HistoryService historyService) { this.measurementService = measurementService; this.historyService = historyService; } + // HTTP GET endpoint for measurement conversion @GetMapping("/convert-measurements") public List convert(@RequestParam(required = false) String input, HttpServletRequest request) { + // Prevent null input values String safeInput; if (input == null) { safeInput = ""; @@ -34,25 +41,30 @@ public List convert(@RequestParam(required = false) String input, HttpS safeInput = input; } + // Log received input log.info("Received input: {}", safeInput); + // Convert encoded input into totals List output = measurementService.convert(safeInput); + // Log conversion output log.info("Conversion result: {}", output); + // Save request history into database historyService.record(safeInput, output, clientIp(request)); + // Log client IP address log.info("Request saved from IP: {}", clientIp(request)); - return output; + return output; // Return conversion result } + // Extract client IP address from request private String clientIp(HttpServletRequest request) { String forwardedFor = request.getHeader("X-Forwarded-For"); if (forwardedFor != null && !forwardedFor.isBlank()) { return forwardedFor.split(",")[0].trim(); } - return request.getRemoteAddr(); + return request.getRemoteAddr(); // Fallback to direct remote address } - } \ No newline at end of file From 49a5f38fd78539fb320219430f14c98d3f016e76 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:00:59 +0400 Subject: [PATCH 085/115] Create HistoryController class --- .../oraclequantapi/controller/HistoryController.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java new file mode 100644 index 0000000..ca4834b --- /dev/null +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -0,0 +1,4 @@ +package com.oraclequantapi.oraclequantapi.controller; + +public class HistoryController { +} \ No newline at end of file From fc26d7631a733d7861b5cf43dba55524f125efd6 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:02:24 +0400 Subject: [PATCH 086/115] Add REST controller and request mapping annotations --- .../oraclequantapi/controller/HistoryController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index ca4834b..f05d85b 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -1,4 +1,9 @@ package com.oraclequantapi.oraclequantapi.controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/history") public class HistoryController { } \ No newline at end of file From 1bb519f926efddd5ce95827fe929265eb13165a8 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:03:20 +0400 Subject: [PATCH 087/115] Initialize controller logger --- .../oraclequantapi/controller/HistoryController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index f05d85b..c71bd4d 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -1,9 +1,12 @@ package com.oraclequantapi.oraclequantapi.controller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/history") public class HistoryController { + private static final Logger log = LoggerFactory.getLogger(HistoryController.class); } \ No newline at end of file From 8b433f4f37b5e3e7b7ad7b9759bb5692d419aee8 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:03:47 +0400 Subject: [PATCH 088/115] Add HistoryService dependency --- .../oraclequantapi/controller/HistoryController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index c71bd4d..55d03e8 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -1,5 +1,6 @@ package com.oraclequantapi.oraclequantapi.controller; +import com.oraclequantapi.oraclequantapi.service.HistoryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RequestMapping; @@ -9,4 +10,5 @@ @RequestMapping("/history") public class HistoryController { private static final Logger log = LoggerFactory.getLogger(HistoryController.class); + private final HistoryService historyService; } \ No newline at end of file From bbd021e0f2f1ce683b061adca7d3c8bd8d6045d0 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:04:16 +0400 Subject: [PATCH 089/115] Add constructor dependency injection --- .../oraclequantapi/controller/HistoryController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 55d03e8..8aa0440 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -11,4 +11,9 @@ public class HistoryController { private static final Logger log = LoggerFactory.getLogger(HistoryController.class); private final HistoryService historyService; + + public HistoryController(HistoryService historyService) { + this.historyService = historyService; + } + } \ No newline at end of file From c4ca9797731d446d50eb30e831b5ab1cc6ece6a7 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:05:25 +0400 Subject: [PATCH 090/115] Add findAll history endpoint --- .../oraclequantapi/controller/HistoryController.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 8aa0440..05c1463 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -1,11 +1,15 @@ package com.oraclequantapi.oraclequantapi.controller; +import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import com.oraclequantapi.oraclequantapi.service.HistoryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @RestController @RequestMapping("/history") public class HistoryController { @@ -16,4 +20,10 @@ public HistoryController(HistoryService historyService) { this.historyService = historyService; } + @GetMapping + public List findAll() { + log.info("Fetching all history records"); + return historyService.findAll(); + } + } \ No newline at end of file From 8d5187cda9eb2461582013cde491897006b39788 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:08:35 +0400 Subject: [PATCH 091/115] Add findById history endpoint --- .../oraclequantapi/controller/HistoryController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 05c1463..c932953 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -26,4 +27,10 @@ public List findAll() { return historyService.findAll(); } + @GetMapping("/{id}") + public HistoryRecord findById(@PathVariable Long id) { + log.info("Fetching history record with id {}", id); + return historyService.findById(id); + } + } \ No newline at end of file From f06bba83afe9cf6f76b4501b835310915d4f31b0 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:09:49 +0400 Subject: [PATCH 092/115] Add PUT endpoint for history updates --- .../oraclequantapi/controller/HistoryController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index c932953..2dadf07 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -4,10 +4,7 @@ import com.oraclequantapi.oraclequantapi.service.HistoryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -33,4 +30,10 @@ public HistoryRecord findById(@PathVariable Long id) { return historyService.findById(id); } + @PutMapping("/{id}") + public HistoryRecord put(@PathVariable Long id, @RequestBody HistoryUpdateRequest request) { + log.info("PUT update request received for history record {}", id); + return update(id, request); + } + } \ No newline at end of file From e7e8461bf57f955bb26ab68af9db41037a13b2de Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:10:20 +0400 Subject: [PATCH 093/115] Add PATCH endpoint for partial updates --- .../oraclequantapi/controller/HistoryController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 2dadf07..5779000 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -36,4 +36,10 @@ public HistoryRecord put(@PathVariable Long id, @RequestBody HistoryUpdateReques return update(id, request); } + @PatchMapping("/{id}") + public HistoryRecord patch(@PathVariable Long id, @RequestBody HistoryUpdateRequest request) { + log.info("PATCH update request received for history record {}", id); + return update(id, request); + } + } \ No newline at end of file From 16fcaafde93a80b9c1857fe18976b45f172c7b5e Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:12:09 +0400 Subject: [PATCH 094/115] Add deleteAll history endpoint --- .../oraclequantapi/controller/HistoryController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 5779000..d27a88b 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -4,6 +4,7 @@ import com.oraclequantapi.oraclequantapi.service.HistoryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -42,4 +43,12 @@ public HistoryRecord patch(@PathVariable Long id, @RequestBody HistoryUpdateRequ return update(id, request); } + @DeleteMapping + public ResponseEntity deleteAll() { + log.warn("Deleting all history records"); + historyService.deleteAll(); + log.info("All history records deleted successfully"); + return ResponseEntity.noContent().build(); + } + } \ No newline at end of file From aaf1c6960293205c16dc062336c0d3dc2c8680ae Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:12:42 +0400 Subject: [PATCH 095/115] Add deleteById history endpoint --- .../oraclequantapi/controller/HistoryController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index d27a88b..5df8179 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -51,4 +51,12 @@ public ResponseEntity deleteAll() { return ResponseEntity.noContent().build(); } + @DeleteMapping("/{id}") + public ResponseEntity deleteById(@PathVariable Long id) { + log.warn("Deleting history record with id {}", id); + historyService.deleteById(id); + log.info("History record {} deleted successfully", id); + return ResponseEntity.noContent().build(); + } + } \ No newline at end of file From 6d7b007bd032d7491c408317cd2e121f78aa68e3 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:13:53 +0400 Subject: [PATCH 096/115] Add exception handler for missing history records --- .../oraclequantapi/controller/HistoryController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 5df8179..9f1c1b1 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -4,10 +4,12 @@ import com.oraclequantapi.oraclequantapi.service.HistoryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; @RestController @RequestMapping("/history") @@ -59,4 +61,11 @@ public ResponseEntity deleteById(@PathVariable Long id) { return ResponseEntity.noContent().build(); } + @ExceptionHandler(HistoryService.HistoryRecordNotFoundException.class) + public ResponseEntity> historyNotFound(HistoryService.HistoryRecordNotFoundException exception) { + log.warn("History record not found: {}", exception.getMessage()); + return error(HttpStatus.NOT_FOUND, exception.getMessage()); + } + + } \ No newline at end of file From 3435577fe67faf3468f56d3252cfa11cd328c6ab Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:15:47 +0400 Subject: [PATCH 097/115] Add shared update helper method --- .../oraclequantapi/controller/HistoryController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 9f1c1b1..1e418f3 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -67,5 +67,11 @@ public ResponseEntity> historyNotFound(HistoryService.Histor return error(HttpStatus.NOT_FOUND, exception.getMessage()); } + private HistoryRecord update(Long id, HistoryUpdateRequest request) { + HistoryRecord record = historyService.update(id, request.timestamp(), request.sourceIpAddress(), request.input(), request.output()); + log.info("History record {} updated successfully", id); + return record; + } + } \ No newline at end of file From 16995f04ed4e739e4e251129622d90c80b54bc0b Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:16:42 +0400 Subject: [PATCH 098/115] Add reusable error response builder --- .../oraclequantapi/controller/HistoryController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 1e418f3..e0b5d50 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -8,6 +8,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import java.time.Instant; import java.util.List; import java.util.Map; @@ -73,5 +74,9 @@ private HistoryRecord update(Long id, HistoryUpdateRequest request) { return record; } + private ResponseEntity> error(HttpStatus status, String message) { + return ResponseEntity.status(status).body(Map.of("timestamp", Instant.now().toString(), "status", status.value(), "error", status.getReasonPhrase(), "message", message)); + } + } \ No newline at end of file From e9af53b19de9c173a27e9ff3eea8a622e46726c1 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:18:40 +0400 Subject: [PATCH 099/115] Add HistoryUpdateRequest record --- .../oraclequantapi/controller/HistoryController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index e0b5d50..1b81f64 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -1,5 +1,7 @@ package com.oraclequantapi.oraclequantapi.controller; +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonProperty; import com.oraclequantapi.oraclequantapi.model.HistoryRecord; import com.oraclequantapi.oraclequantapi.service.HistoryService; import org.slf4j.Logger; @@ -78,5 +80,8 @@ private ResponseEntity> error(HttpStatus status, String mess return ResponseEntity.status(status).body(Map.of("timestamp", Instant.now().toString(), "status", status.value(), "error", status.getReasonPhrase(), "message", message)); } + public record HistoryUpdateRequest (Instant timestamp, @JsonProperty("source_ip_address") @JsonAlias("sourceIpAddress") String sourceIpAddress, String input, String output) { + } + } \ No newline at end of file From 5fbeb66ed514e3845cfd26e47587f435709c1bb2 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 01:24:07 +0400 Subject: [PATCH 100/115] Complete HistoryController implementation --- .../controller/HistoryController.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index 1b81f64..a3ad49c 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -14,40 +14,49 @@ import java.util.List; import java.util.Map; -@RestController -@RequestMapping("/history") +@RestController // Marks this class as a REST controller +@RequestMapping("/history") // Base URL path for all endpoints in this controller public class HistoryController { + // Logger used for tracking API requests and actions private static final Logger log = LoggerFactory.getLogger(HistoryController.class); + + // Service layer dependency private final HistoryService historyService; + // Constructor dependency injection public HistoryController(HistoryService historyService) { this.historyService = historyService; } + // GET endpoint to return all history records @GetMapping public List findAll() { log.info("Fetching all history records"); return historyService.findAll(); } + // GET endpoint to return history record by ID @GetMapping("/{id}") public HistoryRecord findById(@PathVariable Long id) { log.info("Fetching history record with id {}", id); return historyService.findById(id); } + // PUT endpoint for full update @PutMapping("/{id}") public HistoryRecord put(@PathVariable Long id, @RequestBody HistoryUpdateRequest request) { log.info("PUT update request received for history record {}", id); return update(id, request); } + // PATCH endpoint for partial update @PatchMapping("/{id}") public HistoryRecord patch(@PathVariable Long id, @RequestBody HistoryUpdateRequest request) { log.info("PATCH update request received for history record {}", id); return update(id, request); } + // DELETE endpoint to remove all history records @DeleteMapping public ResponseEntity deleteAll() { log.warn("Deleting all history records"); @@ -56,6 +65,7 @@ public ResponseEntity deleteAll() { return ResponseEntity.noContent().build(); } + // DELETE endpoint to remove a record by ID @DeleteMapping("/{id}") public ResponseEntity deleteById(@PathVariable Long id) { log.warn("Deleting history record with id {}", id); @@ -64,24 +74,26 @@ public ResponseEntity deleteById(@PathVariable Long id) { return ResponseEntity.noContent().build(); } + // Handles custom not found exceptions @ExceptionHandler(HistoryService.HistoryRecordNotFoundException.class) public ResponseEntity> historyNotFound(HistoryService.HistoryRecordNotFoundException exception) { log.warn("History record not found: {}", exception.getMessage()); return error(HttpStatus.NOT_FOUND, exception.getMessage()); } + // Shared method for updating records private HistoryRecord update(Long id, HistoryUpdateRequest request) { HistoryRecord record = historyService.update(id, request.timestamp(), request.sourceIpAddress(), request.input(), request.output()); log.info("History record {} updated successfully", id); return record; } + // Builds formatted error responses private ResponseEntity> error(HttpStatus status, String message) { return ResponseEntity.status(status).body(Map.of("timestamp", Instant.now().toString(), "status", status.value(), "error", status.getReasonPhrase(), "message", message)); } + // Request body model for updates public record HistoryUpdateRequest (Instant timestamp, @JsonProperty("source_ip_address") @JsonAlias("sourceIpAddress") String sourceIpAddress, String input, String output) { } - - } \ No newline at end of file From 914b2e2b9b9783c41877fb8ba4096d763c881804 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 14:27:57 +0400 Subject: [PATCH 101/115] Update HistoryRecord implementation --- .../oraclequantapi/model/HistoryRecord.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 3452e63..5a638ac 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -27,14 +27,12 @@ public class HistoryRecord { @JsonAlias("sourceIpAddress") // Accept alternative JSON field name private String sourceIpAddress; - // Stores request input as large text - @Lob - @Column(name = "INPUT") + // Stores request input text. Empty Oracle strings are treated as null by the database. + @Column(name = "INPUT", length = 4000) private String input; - // Stores generated output as large text - @Lob - @Column(name = "OUTPUT", nullable = false) + // Stores generated output JSON. + @Column(name = "OUTPUT", nullable = false, length = 4000) private String output; // Default constructor required by JPA From 01f12308ef5e48bcf11f97e944976ed0a98511af Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:05:14 +0400 Subject: [PATCH 102/115] Update HistoryRecord implementation --- .../oraclequantapi/model/HistoryRecord.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java index 5a638ac..546ddb1 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/model/HistoryRecord.java @@ -2,9 +2,10 @@ import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; + import jakarta.persistence.*; -import java.time.Instant; +import java.time.LocalDateTime; @Entity // Marks this class as a database entity @Table(name = "CONVERSION_HISTORY") // Maps this entity to the CONVERSION_HISTORY table @@ -12,26 +13,22 @@ public class HistoryRecord { @Id // Primary key of the table @GeneratedValue(strategy = GenerationType.IDENTITY) // Auto generate ID values - @Column(name = "ID") // Maps the field to the ID column private Long id; @Column(name = "CREATED_AT", nullable = false) // Stores the record creation timestamp - - private Instant timestamp; + private LocalDateTime timestamp; @Column(name = "SOURCE_IP_ADDRESS", nullable = false, length = 128) // Stores the source IP address - @JsonProperty("source_ip_address") // JSON property name when sending response - @JsonAlias("sourceIpAddress") // Accept alternative JSON field name private String sourceIpAddress; - // Stores request input text. Empty Oracle strings are treated as null by the database. + // Stores request input text @Column(name = "INPUT", length = 4000) private String input; - // Stores generated output JSON. + // Stores generated output JSON @Column(name = "OUTPUT", nullable = false, length = 4000) private String output; @@ -51,7 +48,7 @@ public HistoryRecord(String sourceIpAddress, String input, String output) { void onCreate() { // Set current timestamp if it is empty if (timestamp == null) { - timestamp = Instant.now(); + timestamp = LocalDateTime.now(); } } @@ -61,12 +58,12 @@ public Long getId() { } // Returns the creation timestamp - public Instant getTimestamp() { + public LocalDateTime getTimestamp() { return timestamp; } // Updates the timestamp - public void setTimestamp(Instant timestamp) { + public void setTimestamp(LocalDateTime timestamp) { this.timestamp = timestamp; } From 575994e92eeb7496bf951413e6e7be2fd623e6cc Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:12:14 +0400 Subject: [PATCH 103/115] Update HistoryService implementation --- .../service/HistoryService.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java index 7b9756e..7a88c3f 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/service/HistoryService.java @@ -8,11 +8,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.Instant; +import java.time.LocalDateTime; import java.util.List; @Service // Marks this class as a Spring service public class HistoryService { + private final HistoryRepository repository; // Repository used for database operations private final ObjectMapper objectMapper; // ObjectMapper used to convert Java objects into JSON @@ -25,12 +26,10 @@ public HistoryService(HistoryRepository repository, ObjectMapper objectMapper) { // Saves conversion history into the database @Transactional public HistoryRecord record(String input, List output, String sourceIpAddress) { - try { String outputJson = objectMapper.writeValueAsString(output); return repository.save(new HistoryRecord(sourceIpAddress, input, outputJson)); - } - catch (JsonProcessingException exception) { + } catch (JsonProcessingException exception) { throw new IllegalStateException("Unable to serialize conversion output", exception); } } @@ -44,25 +43,37 @@ public List findAll() { // Finds history record using ID @Transactional(readOnly = true) public HistoryRecord findById(Long id) { - return repository.findById(id).orElseThrow(() -> new HistoryRecordNotFoundException(id)); + return repository.findById(id) + .orElseThrow(() -> new HistoryRecordNotFoundException(id)); } // Updates existing history record @Transactional - public HistoryRecord update(Long id, Instant timestamp, String sourceIpAddress, String input, String output) { + public HistoryRecord update( + Long id, + LocalDateTime timestamp, + String sourceIpAddress, + String input, + String output + ) { HistoryRecord record = findById(id); + if (timestamp != null) { record.setTimestamp(timestamp); } + if (sourceIpAddress != null) { record.setSourceIpAddress(sourceIpAddress); } + if (input != null) { record.setInput(input); } + if (output != null) { record.setOutput(output); } + return repository.save(record); } @@ -78,6 +89,7 @@ public void deleteById(Long id) { if (!repository.existsById(id)) { throw new HistoryRecordNotFoundException(id); } + repository.deleteById(id); } From 46d61a0b708f579f11dc1db85971753edc6c7558 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:12:39 +0400 Subject: [PATCH 104/115] Update HistoryController implementation --- .../controller/HistoryController.java | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java index a3ad49c..4760b99 100644 --- a/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java +++ b/src/main/java/com/oraclequantapi/oraclequantapi/controller/HistoryController.java @@ -11,12 +11,14 @@ import org.springframework.web.bind.annotation.*; import java.time.Instant; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @RestController // Marks this class as a REST controller @RequestMapping("/history") // Base URL path for all endpoints in this controller public class HistoryController { + // Logger used for tracking API requests and actions private static final Logger log = LoggerFactory.getLogger(HistoryController.class); @@ -44,14 +46,20 @@ public HistoryRecord findById(@PathVariable Long id) { // PUT endpoint for full update @PutMapping("/{id}") - public HistoryRecord put(@PathVariable Long id, @RequestBody HistoryUpdateRequest request) { + public HistoryRecord put( + @PathVariable Long id, + @RequestBody HistoryUpdateRequest request + ) { log.info("PUT update request received for history record {}", id); return update(id, request); } // PATCH endpoint for partial update @PatchMapping("/{id}") - public HistoryRecord patch(@PathVariable Long id, @RequestBody HistoryUpdateRequest request) { + public HistoryRecord patch( + @PathVariable Long id, + @RequestBody HistoryUpdateRequest request + ) { log.info("PATCH update request received for history record {}", id); return update(id, request); } @@ -76,24 +84,42 @@ public ResponseEntity deleteById(@PathVariable Long id) { // Handles custom not found exceptions @ExceptionHandler(HistoryService.HistoryRecordNotFoundException.class) - public ResponseEntity> historyNotFound(HistoryService.HistoryRecordNotFoundException exception) { + public ResponseEntity> historyNotFound( + HistoryService.HistoryRecordNotFoundException exception + ) { log.warn("History record not found: {}", exception.getMessage()); return error(HttpStatus.NOT_FOUND, exception.getMessage()); } // Shared method for updating records private HistoryRecord update(Long id, HistoryUpdateRequest request) { - HistoryRecord record = historyService.update(id, request.timestamp(), request.sourceIpAddress(), request.input(), request.output()); + HistoryRecord record = historyService.update( + id, + request.timestamp(), + request.sourceIpAddress(), + request.input(), + request.output() + ); + log.info("History record {} updated successfully", id); return record; } // Builds formatted error responses private ResponseEntity> error(HttpStatus status, String message) { - return ResponseEntity.status(status).body(Map.of("timestamp", Instant.now().toString(), "status", status.value(), "error", status.getReasonPhrase(), "message", message)); + return ResponseEntity.status(status).body(Map.of( + "timestamp", Instant.now().toString(), + "status", status.value(), + "error", status.getReasonPhrase(), + "message", message + )); } // Request body model for updates - public record HistoryUpdateRequest (Instant timestamp, @JsonProperty("source_ip_address") @JsonAlias("sourceIpAddress") String sourceIpAddress, String input, String output) { + public record HistoryUpdateRequest( + LocalDateTime timestamp, + @JsonProperty("source_ip_address") + @JsonAlias("sourceIpAddress") + String sourceIpAddress, String input, String output) { } } \ No newline at end of file From a92d1405e41a28f7130ae253b4d169f502438101 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:35:02 +0400 Subject: [PATCH 105/115] Logback Spring --- src/main/resources/logback-spring.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/resources/logback-spring.xml diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..291ea44 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,26 @@ + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n + + + + + ${LOG_PATH}/oraclequantapi.log + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n + + + ${LOG_PATH}/oraclequantapi.%d{yyyy-MM-dd}.log + 7 + + + + + + + + From a49abc139d92e735214d2f9890d588cb100f999e Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:35:39 +0400 Subject: [PATCH 106/115] README --- README.md | 559 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 498 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index b1cccfd..8e53aea 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,498 @@ -## Submission Instructions - -To submit your Oracle JAVA Spring Boot Maven project as a solution, please follow these steps: - -### Step 1: Install git on your PC -- Install "git" as shown in this tutorial: [How to install git](https://youtu.be/iYkLrXobBbA?si=_l0haibv_X9NpIjJ) -- Open command prompt and run - ```bash - git version - ``` -- If you see the version, then git is successfully installed. - -### Step 2: Fork the Repository -- Navigate to [this repository](https://github.com/CodelineAtyab/oraclequantapi) provided by Codeline. -- Click on the "Fork" button at the top-right corner of the page to create a copy of the repository under your own GitHub account. - -### Step 3: Clone the Forked Repository -- Open your terminal or command prompt. -- Clone the forked repository to your local machine using the following command: - ```bash - git clone https://github.com/your-username/repo-name.git - ``` - -### Step 4: Create a new branch -- Navigate to the cloned repository directory - ```bash - cd repo-name - ``` -- Create a new branch for your code submissions (Replace your-name with your name in your-name-submission-branch): - ```bash - git checkout -b your-name-submission-branch - ``` - - -### Step 5: Add Your Code -- Implement the API - -### Step 6: Commit your changes -- Run the following commands in order to commit your changes: - ```bash - git add * - git commit -m "Meaningful commit message here" - ``` - -### Step 7: Push Your Branch to GitHub -- Run the following commands to upload the changes to the forked github repository (Replace your-name with your name in your-name-submission-branch): - ```bash - git push origin your-name-submission-branch - ``` - -### Step 8: Create a Pull Request -- Go to your forked repository on GitHub. -- You should see a prompt to create a pull request. Click on "Compare & pull request". -- Provide a title and description for your pull request, then click "Create pull request". - -### Step 9: Notify Codeline -- Notify on slack that you have created a PR for your solution. - -## Note: If you face any issues in the process above, Please do the following: -- Watch [this youtube tutorial](https://www.youtube.com/watch?v=a_FLqX3vGR4) -- Contact Ikhlas or Atyab. +# OracleQuant Package Measurement Conversion API + +Spring Boot REST API for converting package measurement strings into package totals and storing request history. + +## Requirements + +- Oracle OpenJDK 17 +- Maven 3.9+ or the included Maven wrapper +- Docker if running Oracle XE locally in a container +- Oracle XE Database for Oracle profile usage +- Oracle Linux host for final deployment + +## Build The Application + +Windows PowerShell: + +```powershell +.\mvnw.cmd clean package +``` + +Linux or macOS: + +```bash +./mvnw clean package +``` + +The runnable jar is created at: + +```text +target/oraclequantapi-0.0.1-SNAPSHOT.jar +``` + +## Running The Application + +The default configuration uses an in-memory H2 database. This is useful for local development and testing because Oracle XE is not required. + +Run with Maven on Windows: + +```powershell +.\mvnw.cmd spring-boot:run +``` + +Run the packaged jar on Windows: + +```powershell +java -jar target\oraclequantapi-0.0.1-SNAPSHOT.jar +``` + +Run with Maven on Linux: + +```bash +./mvnw spring-boot:run +``` + +Run the packaged jar on Linux: + +```bash +java -jar target/oraclequantapi-0.0.1-SNAPSHOT.jar +``` + +The API starts at: + +```text +http://localhost:8080 +``` + +The dashboard is available at: + +```text +http://localhost:8080/ +``` + +Run tests: + +```powershell +.\mvnw.cmd test +``` + +## Dashboard + +The application includes a built-in dashboard served by Spring Boot from: + +```text +src/main/resources/static +``` + +Dashboard files: + +```text +src/main/resources/static/index.html +src/main/resources/static/styles.css +src/main/resources/static/app.js +``` + +Dashboard features: + +- Convert package measurement strings from the browser. +- Show conversion results. +- Load request history from the active database. +- Refresh request history. +- Delete one history record. +- Delete all history records. +- Show a clear warning if the Oracle `/history` endpoint fails because of database user or table schema problems. + +The dashboard uses the same REST endpoints documented below. + +## Configuring The Database + +The application supports two database modes. + +Default local mode: + +- Uses H2 in-memory database. +- Does not require external database setup. +- Configured in `src/main/resources/application.properties`. +- Good for development and tests. + +Oracle XE mode: + +- Uses Oracle XE through the `oracle` Spring profile. +- Configured in `src/main/resources/application-oracle.properties`. +- Activated with `SPRING_PROFILES_ACTIVE=oracle`. +- Uses environment variables for database URL, username, and password. +- The dashboard works with Oracle as long as `/history` returns a successful JSON response. + +### Oracle XE With Docker + +Start Oracle XE in Docker: + +```powershell +docker run -d --name oracle-xe ` + -p 1521:1521 ` + -e ORACLE_PASSWORD=oracle ` + -e APP_USER=oraclequantapi ` + -e APP_USER_PASSWORD=oraclequantapi ` + -v oracle-xe-data:/opt/oracle/oradata ` + gvenzl/oracle-xe:21-slim +``` + +Wait until Oracle is ready: + +```powershell +docker logs -f oracle-xe +``` + +Wait for this message: + +```text +DATABASE IS READY TO USE! +``` + +Set Oracle profile variables on Windows PowerShell: + +```powershell +$env:SPRING_PROFILES_ACTIVE="oracle" +$env:ORACLE_DB_URL="jdbc:oracle:thin:@//localhost:1521/XEPDB1" +$env:ORACLE_DB_USERNAME="oraclequantapi" +$env:ORACLE_DB_PASSWORD="oraclequantapi" +``` + +Run the application: + +```powershell +.\mvnw.cmd spring-boot:run +``` + +Useful Docker commands: + +```powershell +docker ps +docker stop oracle-xe +docker start oracle-xe +``` + +### Oracle XE Without Docker + +If Oracle XE is installed directly on the machine, create the application user in Oracle: + +```sql +CREATE USER oraclequantapi IDENTIFIED BY "oraclequantapi"; +GRANT CREATE SESSION TO oraclequantapi; +GRANT CREATE TABLE TO oraclequantapi; +GRANT CREATE SEQUENCE TO oraclequantapi; +ALTER USER oraclequantapi QUOTA UNLIMITED ON USERS; +``` + +Use this JDBC URL for a common Oracle XE installation: + +```text +jdbc:oracle:thin:@//localhost:1521/XEPDB1 +``` + +Set Oracle profile variables on Linux: + +```bash +export SPRING_PROFILES_ACTIVE=oracle +export ORACLE_DB_URL='jdbc:oracle:thin:@//localhost:1521/XEPDB1' +export ORACLE_DB_USERNAME='oraclequantapi' +export ORACLE_DB_PASSWORD='oraclequantapi' +``` + +The application uses Hibernate `ddl-auto=update` by default for this assignment. Override it if needed: + +```bash +export ORACLE_DDL_AUTO=validate +``` + +If the dashboard shows a history warning, test the history endpoint directly: + +```text +http://localhost:8080/history +``` + +If `/history` returns `500`, verify that the Oracle user used by the app owns a compatible `CONVERSION_HISTORY` table. + +Expected table columns: + +```text +ID +CREATED_AT +SOURCE_IP_ADDRESS +INPUT +OUTPUT +``` + +If you do not need old history records, the simplest repair is to drop the old table and restart the app so Hibernate recreates it: + +```sql +DROP TABLE CONVERSION_HISTORY; +``` + +## REST API Endpoints + +### Convert Measurements + +Endpoint: + +```http +GET /convert-measurements?input={measurement-string} +``` + +Encoding rules: + +- `_` means `0`. +- `a` means `1`, `b` means `2`, through `z` meaning `26`. +- Values above `26` are encoded by adding characters together. +- A multi-character value starts with one or more `z` characters and ends at the first following non-`z` character. +- Each package starts with a count value, followed by that many measured values. +- Invalid characters are treated as `0`. +- Missing measured values are treated as `0`. +- Empty or missing `input` returns an empty list. + +Examples: + +```bash +curl 'http://localhost:8080/convert-measurements?input=aa' +# [1] + +curl 'http://localhost:8080/convert-measurements?input=abbcc' +# [2,6] + +curl 'http://localhost:8080/convert-measurements?input=dz_a_aazzaaa' +# [28,53,1] + +curl 'http://localhost:8080/convert-measurements?input=a_' +# [0] + +curl 'http://localhost:8080/convert-measurements?input=abcdabcdab' +# [2,7,7] + +curl 'http://localhost:8080/convert-measurements?input=abcdabcdab_' +# [2,7,7,0] + +curl 'http://localhost:8080/convert-measurements?input=caa' +# [2] + +curl 'http://localhost:8080/convert-measurements?input=a1' +# [0] +``` + +### History Endpoints + +History records include: + +- `id` +- `timestamp` +- `source_ip_address` +- `input` +- `output` + +Available endpoints: + +```http +GET /history +GET /history/{id} +PUT /history/{id} +PATCH /history/{id} +DELETE /history +DELETE /history/{id} +``` + +Get all history records: + +```bash +curl 'http://localhost:8080/history' +``` + +Get one history record: + +```bash +curl 'http://localhost:8080/history/1' +``` + +Patch one history record: + +```bash +curl -X PATCH 'http://localhost:8080/history/1' \ + -H 'Content-Type: application/json' \ + -d '{"input":"aa","output":"[1]","source_ip_address":"127.0.0.1"}' +``` + +Replace or update one history record: + +```bash +curl -X PUT 'http://localhost:8080/history/1' \ + -H 'Content-Type: application/json' \ + -d '{"timestamp":"2026-05-25T12:00:00Z","input":"abbcc","output":"[2,6]","source_ip_address":"127.0.0.1"}' +``` + +Delete one history record: + +```bash +curl -X DELETE 'http://localhost:8080/history/1' +``` + +Delete all history records: + +```bash +curl -X DELETE 'http://localhost:8080/history' +``` + +## Logging + +Logging is configured in: + +```text +src/main/resources/logback-spring.xml +``` + +The application writes logs to: + +- Console output +- `logs/oraclequantapi.log` + +Daily rolling log files are retained for seven days. + +Override the log path: + +```bash +export LOG_PATH=/var/log/oraclequantapi +``` + +## Deploy The Jar On Oracle Linux Via SSH + +Build the jar locally: + +```powershell +.\mvnw.cmd clean package +``` + +SSH to the Oracle Linux server: + +```bash +ssh opc@your-server-ip +``` + +Create the application directory on the server: + +```bash +sudo mkdir -p /opt/oraclequantapi +sudo chown opc:opc /opt/oraclequantapi +``` + +Exit the server and copy the jar from your local machine: + +```bash +scp target/oraclequantapi-0.0.1-SNAPSHOT.jar opc@your-server-ip:/opt/oraclequantapi/oraclequantapi.jar +``` + +SSH back to the server: + +```bash +ssh opc@your-server-ip +``` + +Install Oracle OpenJDK 17 if needed: + +```bash +sudo dnf install -y jdk-17 +java -version +``` + +Create a runtime environment file: + +```bash +sudo tee /etc/oraclequantapi.env >/dev/null <<'EOF' +SPRING_PROFILES_ACTIVE=oracle +ORACLE_DB_URL=jdbc:oracle:thin:@//localhost:1521/XEPDB1 +ORACLE_DB_USERNAME=oraclequantapi +ORACLE_DB_PASSWORD=oraclequantapi +LOG_PATH=/var/log/oraclequantapi +EOF +``` + +Create the log directory: + +```bash +sudo mkdir -p /var/log/oraclequantapi +sudo chown opc:opc /var/log/oraclequantapi +``` + +Run the jar manually: + +```bash +set -a +. /etc/oraclequantapi.env +set +a +java -jar /opt/oraclequantapi/oraclequantapi.jar +``` + +Test from another terminal or browser: + +```text +http://your-server-ip:8080/convert-measurements?input=abbcc +``` + +Optional systemd service file: + +```ini +[Unit] +Description=OracleQuant API +After=network.target + +[Service] +EnvironmentFile=/etc/oraclequantapi.env +ExecStart=/usr/bin/java -jar /opt/oraclequantapi/oraclequantapi.jar +Restart=always +User=opc + +[Install] +WantedBy=multi-user.target +``` + +Save the service file as: + +```text +/etc/systemd/system/oraclequantapi.service +``` + +Enable and start the service: + +```bash +sudo systemctl daemon-reload +sudo systemctl enable --now oraclequantapi +sudo systemctl status oraclequantapi +``` + +View application logs: + +```bash +journalctl -u oraclequantapi -f +tail -f /var/log/oraclequantapi/oraclequantapi.log +``` + +## Project Files + +Main application class: + +```text +src/main/java/com/oraclequantapi/oraclequantapi/OracleQuantApiApplication.java +``` + +Main packages: + +```text +controller +service +model +repository +``` + +Important configuration files: + +```text +src/main/resources/application.properties +src/main/resources/application-oracle.properties +src/main/resources/logback-spring.xml +``` From f97a3aafe050d64e85d793a434d6f140057e8e09 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:36:03 +0400 Subject: [PATCH 107/115] pom.xml --- pom.xml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 20909d2..1e5b7d1 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,8 @@ com.oraclequantapi oraclequantapi 0.0.1-SNAPSHOT - - + oraclequantapi + OracleQuant package measurement conversion API @@ -34,6 +34,20 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.oracle.database.jdbc + ojdbc11 + runtime + + + com.h2database + h2 + runtime + org.springframework.boot From 982beb43ad104489b8d9bbd3201cd320f9595f56 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:55:46 +0400 Subject: [PATCH 108/115] Create initial Spring Boot Maven project --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e50d0ff --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable project changes are documented in this file. + +## 0.0.1-SNAPSHOT - 2026-05-21 + +- Created the initial Spring Boot Maven project. +- Added the basic application entry point. +- Added the initial README file. + + From 00c6c1bf4c2685122e912d708a0e5002121075a4 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:56:28 +0400 Subject: [PATCH 109/115] Add package measurement conversion REST API --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e50d0ff..5fac5fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,4 +8,15 @@ All notable project changes are documented in this file. - Added the basic application entry point. - Added the initial README file. +## 0.0.2-SNAPSHOT - 2026-05-21 +- Added the package measurement conversion REST API. +- Implemented conversion logic for `_`, `a-z`, and multi-character `z` values. +- Added request history persistence with `id`, `timestamp`, `source_ip_address`, `input`, and `output` fields. +- Added history REST endpoints for `GET`, `PUT`, `PATCH`, and `DELETE` requests. +- Added Oracle XE database configuration through the `oracle` Spring profile. +- Added local H2 database support for development and automated tests. +- Added Logback configuration for console logging and daily rolling file logging. +- Configured application logs to write to `logs/oraclequantapi.log` by default. +- Configured rolling log retention for seven days. +- Added unit and integration tests for conversion and API behavior. From ad5329b20f1b9f1fb7af0b4adf9c9c8a94933756 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:56:59 +0400 Subject: [PATCH 110/115] Refactor source structure into layered packages --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fac5fd..d162483 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,3 +20,10 @@ All notable project changes are documented in this file. - Configured application logs to write to `logs/oraclequantapi.log` by default. - Configured rolling log retention for seven days. - Added unit and integration tests for conversion and API behavior. + +## 0.0.3-SNAPSHOT - 2026-05-21 + +- Refactored the Java source structure into `controller`, `service`, `model`, and `repository` packages. +- Renamed the main application class to `OracleQuantApiApplication`. +- Renamed service and repository classes to match the requested project structure. +- Updated unit and integration tests to match the new package structure. From 7c391205ebd16b98a7c1255ae8479c95614fa08b Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:57:26 +0400 Subject: [PATCH 111/115] Update conversion behavior for invalid and missing values --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d162483..d3cc59e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,3 +27,11 @@ All notable project changes are documented in this file. - Renamed the main application class to `OracleQuantApiApplication`. - Renamed service and repository classes to match the requested project structure. - Updated unit and integration tests to match the new package structure. + +## 0.0.4-SNAPSHOT - 2026-05-22 + +- Updated conversion behavior so invalid characters are treated as `0` instead of returning errors. +- Updated conversion behavior so missing measured values are treated as `0`. +- Added support for empty or missing `input` values, returning an empty list. +- Updated history persistence to support empty request input values. +- Updated tests for tolerant conversion behavior. \ No newline at end of file From 67a6fd1680f8a408264aa6ba5aa7e958cf1068b0 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:58:02 +0400 Subject: [PATCH 112/115] Add conversion history data model and repository --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3cc59e..afe8c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,4 +34,12 @@ All notable project changes are documented in this file. - Updated conversion behavior so missing measured values are treated as `0`. - Added support for empty or missing `input` values, returning an empty list. - Updated history persistence to support empty request input values. -- Updated tests for tolerant conversion behavior. \ No newline at end of file +- Updated tests for tolerant conversion behavior. + +## 0.0.5-SNAPSHOT - 2026-05-22 + +- Reviewed the current project structure and database-related files. +- Added `ConversionHistory` entity file for conversion history data modeling. +- Added `ConversionHistoryRepository` for conversion history database access. +- Kept the active API history flow using `HistoryRecord`, `HistoryRepository`, and `HistoryService`. +- Updated `CHANGELOG.md` and `version.txt` to match the current project state. \ No newline at end of file From d21d99187b3d6f94d321829f1696d38c6608c4b6 Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:58:34 +0400 Subject: [PATCH 113/115] Document Logback console and file logging --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afe8c1b..acdf85e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,4 +42,11 @@ All notable project changes are documented in this file. - Added `ConversionHistory` entity file for conversion history data modeling. - Added `ConversionHistoryRepository` for conversion history database access. - Kept the active API history flow using `HistoryRecord`, `HistoryRepository`, and `HistoryService`. -- Updated `CHANGELOG.md` and `version.txt` to match the current project state. \ No newline at end of file +- Updated `CHANGELOG.md` and `version.txt` to match the current project state. + +## 0.0.6-SNAPSHOT - 2026-05-23 + +- Updated logging documentation in `CHANGELOG.md` and `version.txt`. +- Documented that the application uses Logback for console and file logging. +- Documented that logs are written to `logs/oraclequantapi.log` by default. +- Documented that rolling log files are retained for seven days. \ No newline at end of file From 408f694fbdd1941e2ba9a46e8c10dce631f364ba Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 17:59:05 +0400 Subject: [PATCH 114/115] Document Oracle profile and logging configuration --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acdf85e..f2d6528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,4 +49,12 @@ All notable project changes are documented in this file. - Updated logging documentation in `CHANGELOG.md` and `version.txt`. - Documented that the application uses Logback for console and file logging. - Documented that logs are written to `logs/oraclequantapi.log` by default. -- Documented that rolling log files are retained for seven days. \ No newline at end of file +- Documented that rolling log files are retained for seven days. + +## 0.0.7-SNAPSHOT - 2026-05-25 + +- Updated documentation for `application-oracle.properties` and `logback-spring.xml`. +- Documented that `application-oracle.properties` stores Oracle XE profile database settings separately from local H2 settings. +- Documented that the Oracle profile can be activated with `SPRING_PROFILES_ACTIVE=oracle`. +- Documented that `logback-spring.xml` controls console logging, file logging, daily log rotation, and seven-day log retention. +- Clarified that logs are written to `logs/oraclequantapi.log` by default. \ No newline at end of file From bb1b39d5f3ffb10df08e488a3f0760fec30c876e Mon Sep 17 00:00:00 2001 From: Al-Jolanda Al-Handhali Date: Mon, 25 May 2026 18:02:47 +0400 Subject: [PATCH 115/115] Add project version history and documentation updates --- version.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 version.txt diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..64dbdb9 --- /dev/null +++ b/version.txt @@ -0,0 +1,58 @@ +Current Documentation Version: 0.0.11-SNAPSHOT +Maven Artifact Version: 0.0.1-SNAPSHOT +Last Updated: 2026-05-25 + +Version History: + +0.0.7-SNAPSHOT - 2026-05-25 +- application-oracle.properties documentation updated +- Oracle XE profile configuration documented +- SPRING_PROFILES_ACTIVE=oracle usage documented +- logback-spring.xml documentation updated +- Console logging, rolling file logging, and seven-day log retention documented +- Default log file path documented as logs/oraclequantapi.log + +0.0.6-SNAPSHOT - 2026-05-23 +- Logging documentation updated +- Logback console logging documented +- Logback rolling file logging documented +- Default log file path documented as logs/oraclequantapi.log +- Seven-day rolling log retention documented + +0.0.5-SNAPSHOT - 2026-05-22 +- Project reviewed after database model updates +- ConversionHistory entity added +- ConversionHistoryRepository added +- Active history API still uses HistoryRecord, HistoryRepository, and HistoryService +- CHANGELOG.md and version.txt updated + +0.0.4-SNAPSHOT - 2026-05-22 +- Invalid characters count as 0 +- Missing measured values count as 0 +- Empty or missing input returns an empty list +- History persistence supports empty request input values +- Tests updated for tolerant conversion behavior + +0.0.3-SNAPSHOT - 2026-05-21 +- Project refactored into controller, service, model, and repository packages +- Main application class renamed to OracleQuantApiApplication +- Services and repositories renamed to match the requested structure +- Tests updated for the new structure + +0.0.2-SNAPSHOT - 2026-05-21 +- Conversion REST API added +- Measurement conversion algorithm added +- Request history persistence added +- History REST endpoints added +- Oracle XE database profile added +- Local H2 development database added +- Logback console logging added +- Logback daily rolling file logging added +- Default log file path added as logs/oraclequantapi.log +- Seven-day rolling log retention added +- Unit and integration tests added + +0.0.1-SNAPSHOT - 2026-05-21 +- Initial Spring Boot Maven project created +- Basic application entry point added +- Initial README added