From 0c329e01a2a30d7cd602c9c9b4d2342d59171a78 Mon Sep 17 00:00:00 2001
From: Daniel Hornung <d.hornung@indiscale.com>
Date: Thu, 23 Jun 2022 13:53:45 +0200
Subject: [PATCH] MAINT: Remove pure debugging method, add cloning for
 encapsulation.

---
 .../java/org/caosdb/server/query/POV.java     | 29 ++++++++-----------
 .../java/org/caosdb/server/query/TestCQL.java |  3 +-
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/main/java/org/caosdb/server/query/POV.java b/src/main/java/org/caosdb/server/query/POV.java
index 61711b4d..62ad1aa7 100644
--- a/src/main/java/org/caosdb/server/query/POV.java
+++ b/src/main/java/org/caosdb/server/query/POV.java
@@ -503,33 +503,28 @@ public class POV implements EntityFilterInterface {
     return ret;
   }
 
-  /** Return the value type as string, for debugging puposes. */
-  public String getValueType() {
-    if (this.vInt != null) { // vInt
-      return "Integer";
-    }
-    if (this.vDouble != null) { // vInt
-      return "Double";
-    }
-    if (this.vDatetime != null) { // vInt
-      return "Datetime";
-    }
-    return "String";
-  }
-
   /** Return the Int value, which may be null. */
   public Integer getVInt() {
-    return this.vInt;
+    if (this.vInt != null){
+      return vInt.clone();
+    }
+    return null;
   }
 
   /** Return the Double value, which may be null. */
   public Double getVDouble() {
-    return this.vDouble;
+    if (this.vDouble != null) {
+      return this.vDouble.clone();
+    }
+    return null;
   }
 
   /** Return the Datetime value, which may be null. */
   public DateTimeInterface getVDatetime() {
-    return this.vDatetime;
+    if (this.vDatetime != null) {
+      return DateTimeFactory2.valueOf(this.vDatetime.toDateTimeString());
+    }
+    return null;
   }
 
   public String getAggregate() {
diff --git a/src/test/java/org/caosdb/server/query/TestCQL.java b/src/test/java/org/caosdb/server/query/TestCQL.java
index 87cfddbb..3a151fc3 100644
--- a/src/test/java/org/caosdb/server/query/TestCQL.java
+++ b/src/test/java/org/caosdb/server/query/TestCQL.java
@@ -6931,7 +6931,8 @@ public class TestCQL {
     POV pov = ((POV) sfq.filter);
     System.out.println(pov.getValue());
     assertEquals("10000000000", pov.getValue());
-    assertEquals("Double", pov.getValueType());
+    assertNotNull(pov.getVDouble());
+    assertNull(pov.getVInt());
     assertEquals(1e10, pov.getVDouble().doubleValue(), 0.0);
   }
 }
-- 
GitLab