diff --git a/phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSetStatus.java b/phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSetStatus.java
index 7c942672..8d2cefb6 100644
--- a/phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSetStatus.java
+++ b/phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSetStatus.java
@@ -1,5 +1,7 @@
package com.helger.phive.api.executorset;
+import java.time.OffsetDateTime;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -28,6 +30,22 @@ default boolean isDeprecated ()
return getType ().isDeprecated ();
}
+ default boolean hasValidFrom ()
+ {
+ return getValidFrom () != null;
+ }
+
+ @Nullable
+ OffsetDateTime getValidFrom ();
+
+ default boolean hasValidTo ()
+ {
+ return getValidTo () != null;
+ }
+
+ @Nullable
+ OffsetDateTime getValidTo ();
+
/**
* @return true
if a replacement VESID is present,
* false
if not.
diff --git a/phive-api/src/main/java/com/helger/phive/api/executorset/ValidationExecutorSetStatus.java b/phive-api/src/main/java/com/helger/phive/api/executorset/ValidationExecutorSetStatus.java
index ae41e247..45e0a6f0 100644
--- a/phive-api/src/main/java/com/helger/phive/api/executorset/ValidationExecutorSetStatus.java
+++ b/phive-api/src/main/java/com/helger/phive/api/executorset/ValidationExecutorSetStatus.java
@@ -1,5 +1,7 @@
package com.helger.phive.api.executorset;
+import java.time.OffsetDateTime;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -16,22 +18,40 @@
public class ValidationExecutorSetStatus implements IValidationExecutorSetStatus
{
private final EValidationExecutorStatusType m_eType;
+ private final OffsetDateTime m_aValidFrom;
+ private final OffsetDateTime m_aValidTo;
private final VESID m_aReplacementVESID;
public ValidationExecutorSetStatus (@Nonnull final EValidationExecutorStatusType eType,
+ @Nullable final OffsetDateTime aValidFrom,
+ @Nullable final OffsetDateTime aValidTo,
@Nullable final VESID aReplacementVESID)
{
ValueEnforcer.notNull (eType, "Type");
m_eType = eType;
+ m_aValidFrom = aValidFrom;
+ m_aValidTo = aValidTo;
m_aReplacementVESID = aReplacementVESID;
}
@Nonnull
- public EValidationExecutorStatusType getType ()
+ public final EValidationExecutorStatusType getType ()
{
return m_eType;
}
+ @Nullable
+ public final OffsetDateTime getValidFrom ()
+ {
+ return m_aValidFrom;
+ }
+
+ @Nullable
+ public final OffsetDateTime getValidTo ()
+ {
+ return m_aValidTo;
+ }
+
@Nullable
public VESID getReplacementVESID ()
{
@@ -42,6 +62,8 @@ public VESID getReplacementVESID ()
public String toString ()
{
return new ToStringGenerator (null).append ("Type", m_eType)
+ .append ("ValidFrom", m_aValidFrom)
+ .append ("ValidTo", m_aValidTo)
.append ("ReplacementVESID", m_aReplacementVESID)
.getToString ();
}
@@ -49,13 +71,13 @@ public String toString ()
@Nonnull
public static ValidationExecutorSetStatus createValid ()
{
- return new ValidationExecutorSetStatus (EValidationExecutorStatusType.VALID, null);
+ return createDeprecated (false);
}
@Nonnull
public static ValidationExecutorSetStatus createDeprecated (final boolean bDeprecated)
{
return new ValidationExecutorSetStatus (bDeprecated ? EValidationExecutorStatusType.DEPRECATED
- : EValidationExecutorStatusType.VALID, null);
+ : EValidationExecutorStatusType.VALID, null, null, null);
}
}
diff --git a/phive-result/src/test/java/com/helger/phive/result/json/PhiveJsonHelperTest.java b/phive-result/src/test/java/com/helger/phive/result/json/PhiveJsonHelperTest.java
index 29a56d92..226b4ba7 100644
--- a/phive-result/src/test/java/com/helger/phive/result/json/PhiveJsonHelperTest.java
+++ b/phive-result/src/test/java/com/helger/phive/result/json/PhiveJsonHelperTest.java
@@ -82,7 +82,7 @@ public void testValidationResults ()
ValidationExecutorSetStatus.createValid ());
PhiveJsonHelper.applyValidationResultList (aObj, aVES, new CommonsArrayList <> (), aDisplayLocale, 123, null, null);
final String sJson = aObj.getAsJsonString ();
- assertEquals ("{\"ves\":{\"vesid\":\"group:art:1\",\"name\":\"name\",\"deprecated\":false}," +
+ assertEquals ("{\"ves\":{\"vesid\":\"group:art:1\",\"name\":\"name\",\"deprecated\":false,\"status\":{\"type\":\"valid\"}}," +
"\"success\":true," +
"\"interrupted\":false," +
"\"mostSevereErrorLevel\":\"SUCCESS\"," +
diff --git a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java
index f851e52d..78d183a6 100644
--- a/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java
+++ b/phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/LoadedVES.java
@@ -16,6 +16,7 @@
*/
package com.helger.phive.ves.engine.load;
+import java.time.OffsetDateTime;
import java.util.Locale;
import javax.annotation.Nonnull;
@@ -143,6 +144,30 @@ public XMLOffsetDateTime getStatusLastModification ()
return m_aStatusLastMod;
}
+ @Nonnull
+ public XMLOffsetDateTime getValidFrom ()
+ {
+ return m_aValidFrom;
+ }
+
+ @Nonnull
+ public OffsetDateTime getValidFromOffset ()
+ {
+ return m_aValidFrom == null ? null : m_aValidFrom.toOffsetDateTime ();
+ }
+
+ @Nonnull
+ public XMLOffsetDateTime getValidTo ()
+ {
+ return m_aValidTo;
+ }
+
+ @Nonnull
+ public OffsetDateTime getValidToOffset ()
+ {
+ return m_aValidTo == null ? null : m_aValidTo.toOffsetDateTime ();
+ }
+
@Nonnull
public EValidationExecutorStatusType getDateTimeValidityNow ()
{
@@ -429,13 +454,16 @@ public void applyValidation (@Nonnull final IValidationSource aValidationSource,
if (!hasExecutor ())
throw new VESLoadingException ("The loaded VES has no Executor Set and can therefore not be used for validating objects");
- final EValidationExecutorStatusType eStatus = _getRecursiveExecutorStatusType ();
+ final EValidationExecutorStatusType eStatusType = _getRecursiveExecutorStatusType ();
final ICommonsList > aExecutors = _getValidationExecutorsRecursive ();
+ final ValidationExecutorSetStatus aVESStatus = new ValidationExecutorSetStatus (eStatusType,
+ m_aStatus.getValidFromOffset (),
+ m_aStatus.getValidToOffset (),
+ m_aStatus.getReplacementVESID ());
final IValidationExecutorSet aVES = ValidationExecutorSet.create (m_aHeader.getVESID (),
m_aHeader.getName (),
- new ValidationExecutorSetStatus (eStatus,
- m_aStatus.getReplacementVESID ()),
+ aVESStatus,
aExecutors);
// Validate