From 20079f925a09fe1a66c810929835d671bb534b34 Mon Sep 17 00:00:00 2001 From: Nicola Fulvio Calabria <nicola.calabria@inaf.it> Date: Wed, 3 Nov 2021 19:33:01 +0100 Subject: [PATCH] Minor refactoring --- .../exchange/ArchiveEntryDescriptor.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/it/inaf/oats/vospace/parent/exchange/ArchiveEntryDescriptor.java b/src/main/java/it/inaf/oats/vospace/parent/exchange/ArchiveEntryDescriptor.java index a19a643..0449566 100644 --- a/src/main/java/it/inaf/oats/vospace/parent/exchange/ArchiveEntryDescriptor.java +++ b/src/main/java/it/inaf/oats/vospace/parent/exchange/ArchiveEntryDescriptor.java @@ -5,18 +5,24 @@ */ package it.inaf.oats.vospace.parent.exchange; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.beans.Transient; + public class ArchiveEntryDescriptor { private final String vosPath; private final String targetNodeVosPath; - public ArchiveEntryDescriptor(String vosPath, String targetNodeVosPath) { + @JsonCreator + public ArchiveEntryDescriptor(@JsonProperty("vosPath")String vosPath, + @JsonProperty("targetNodeVosPath") String targetNodeVosPath) { this.vosPath = vosPath; this.targetNodeVosPath = targetNodeVosPath; } public ArchiveEntryDescriptor(String vosPath) { - this(vosPath, null); + this(vosPath, vosPath); } public String getVosPath() { @@ -24,16 +30,12 @@ public class ArchiveEntryDescriptor { } public String getTargetNodeVosPath() { - if (targetNodeVosPath == null) { - return vosPath; - } else { - return targetNodeVosPath; - } + return targetNodeVosPath; } - + + @Transient public boolean isPointingToAnotherNode() { - return (targetNodeVosPath != null && - !targetNodeVosPath.equals(vosPath)); + return !targetNodeVosPath.equals(vosPath); } } -- GitLab