This is an automated email from the ASF dual-hosted git repository.
yasithdev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/master by this push:
new 36cff7403e refactor: move JsonMapConverter into the shared db package
(#634)
36cff7403e is described below
commit 36cff7403e2a47b7fa22ded3625000fb9241e6b1
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Sun Jun 7 19:12:00 2026 -0400
refactor: move JsonMapConverter into the shared db package (#634)
The compute-service and storage-service each carried a byte-identical copy
of this JPA JSON-map AttributeConverter; this keeps a single copy in
org.apache.airavata.db alongside JsonListConverter and points the two @Convert
references (ComputeJobSubmissionEntity, StorageDataMovementEntity) at it.
Behavior-preserving and the reactor builds green.
---
.../compute/model/ComputeJobSubmissionEntity.java | 1 +
.../org/apache/airavata/db}/JsonMapConverter.java | 2 +-
.../airavata/storage/model/JsonMapConverter.java | 51 ----------------------
.../storage/model/StorageDataMovementEntity.java | 1 +
4 files changed, 3 insertions(+), 52 deletions(-)
diff --git
a/airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/ComputeJobSubmissionEntity.java
b/airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/ComputeJobSubmissionEntity.java
index bc4931c6c2..7dcac61c95 100644
---
a/airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/ComputeJobSubmissionEntity.java
+++
b/airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/ComputeJobSubmissionEntity.java
@@ -23,6 +23,7 @@ import jakarta.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Map;
+import org.apache.airavata.db.JsonMapConverter;
import org.apache.airavata.model.data.movement.proto.SecurityProtocol;
import org.apache.airavata.util.AiravataUtils;
diff --git
a/airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/JsonMapConverter.java
b/airavata-api/src/main/java/org/apache/airavata/db/JsonMapConverter.java
similarity index 97%
rename from
airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/JsonMapConverter.java
rename to
airavata-api/src/main/java/org/apache/airavata/db/JsonMapConverter.java
index 7c60956ee2..1c859d4a8a 100644
---
a/airavata-api/compute-service/src/main/java/org/apache/airavata/compute/model/JsonMapConverter.java
+++ b/airavata-api/src/main/java/org/apache/airavata/db/JsonMapConverter.java
@@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.airavata.compute.model;
+package org.apache.airavata.db;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git
a/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/JsonMapConverter.java
b/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/JsonMapConverter.java
deleted file mode 100644
index 247da03deb..0000000000
---
a/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/JsonMapConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.storage.model;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import jakarta.persistence.AttributeConverter;
-import jakarta.persistence.Converter;
-import java.util.Map;
-
-@Converter
-public class JsonMapConverter implements AttributeConverter<Map<String,
Object>, String> {
- private static final ObjectMapper MAPPER = new ObjectMapper();
-
- @Override
- public String convertToDatabaseColumn(Map<String, Object> attribute) {
- if (attribute == null) return null;
- try {
- return MAPPER.writeValueAsString(attribute);
- } catch (Exception e) {
- throw new IllegalArgumentException("JSON serialization failed", e);
- }
- }
-
- @Override
- public Map<String, Object> convertToEntityAttribute(String dbData) {
- if (dbData == null) return null;
- try {
- return MAPPER.readValue(dbData, new TypeReference<>() {});
- } catch (Exception e) {
- throw new IllegalArgumentException("JSON deserialization failed",
e);
- }
- }
-}
diff --git
a/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/StorageDataMovementEntity.java
b/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/StorageDataMovementEntity.java
index 0cd7f920cf..2cd4909f05 100644
---
a/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/StorageDataMovementEntity.java
+++
b/airavata-api/storage-service/src/main/java/org/apache/airavata/storage/model/StorageDataMovementEntity.java
@@ -23,6 +23,7 @@ import jakarta.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Map;
+import org.apache.airavata.db.JsonMapConverter;
import org.apache.airavata.model.data.movement.proto.SecurityProtocol;
/**