-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
335 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
phive-api/src/main/java/com/helger/phive/api/executorset/EValidationExecutorStatusType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* Licensed 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 com.helger.phive.api.executorset; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import com.helger.commons.annotation.Nonempty; | ||
import com.helger.commons.id.IHasID; | ||
import com.helger.commons.lang.EnumHelper; | ||
|
||
/** | ||
* Defines the overall status of a validation executor. | ||
* | ||
* @author Philip Helger | ||
* @since 9.2.0 | ||
*/ | ||
public enum EValidationExecutorStatusType implements IHasID <String> | ||
{ | ||
/** | ||
* The executor is explicitly deprecated. Most likely a replacement is | ||
* available. | ||
*/ | ||
DEPRECATED ("deprecated"), | ||
/** | ||
* The executor has a validity period that starts in the future. | ||
*/ | ||
NOT_YET_ACTIVE ("notyetactive"), | ||
/** | ||
* The executor has a validity period that ended in the past. | ||
*/ | ||
EXPIRED ("expired"), | ||
/** | ||
* The executor is valid. | ||
*/ | ||
VALID ("valid"); | ||
|
||
private final String m_sID; | ||
|
||
EValidationExecutorStatusType (@Nonnull @Nonempty final String sID) | ||
{ | ||
m_sID = sID; | ||
} | ||
|
||
@Nonnull | ||
@Nonempty | ||
public String getID () | ||
{ | ||
return m_sID; | ||
} | ||
|
||
/** | ||
* @return <code>true</code> if the status type is deprecated, | ||
* <code>false</code> if not. | ||
*/ | ||
public boolean isDeprecated () | ||
{ | ||
return this == DEPRECATED; | ||
} | ||
|
||
public boolean isValid () | ||
{ | ||
return this == VALID; | ||
} | ||
|
||
@Nullable | ||
public static EValidationExecutorStatusType getFromIDOrNull (@Nullable final String sID) | ||
{ | ||
return EnumHelper.getFromIDOrNull (EValidationExecutorStatusType.class, sID); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSetStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.helger.phive.api.executorset; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import com.helger.diver.api.version.VESID; | ||
|
||
/** | ||
* Defines the status of a VES. | ||
* | ||
* @author Philip Helger | ||
* @since 9.2.0 | ||
*/ | ||
public interface IValidationExecutorSetStatus | ||
{ | ||
/** | ||
* @return The effective status type. May not be <code>null</code>. | ||
*/ | ||
@Nonnull | ||
EValidationExecutorStatusType getType (); | ||
|
||
/** | ||
* @return <code>true</code> if the status type is deprecated, | ||
* <code>false</code> if not. | ||
*/ | ||
default boolean isDeprecated () | ||
{ | ||
return getType ().isDeprecated (); | ||
} | ||
|
||
/** | ||
* @return <code>true</code> if a replacement VESID is present, | ||
* <code>false</code> if not. | ||
*/ | ||
default boolean hasReplacementVESID () | ||
{ | ||
return getReplacementVESID () != null; | ||
} | ||
|
||
/** | ||
* @return The replacement VESID to be used. May be <code>null</code>. | ||
*/ | ||
@Nullable | ||
VESID getReplacementVESID (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
phive-api/src/main/java/com/helger/phive/api/executorset/ValidationExecutorSetStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.helger.phive.api.executorset; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import com.helger.commons.ValueEnforcer; | ||
import com.helger.commons.string.ToStringGenerator; | ||
import com.helger.diver.api.version.VESID; | ||
|
||
/** | ||
* Defines the status of a VES. | ||
* | ||
* @author Philip Helger | ||
* @since 9.2.0 | ||
*/ | ||
public class ValidationExecutorSetStatus implements IValidationExecutorSetStatus | ||
{ | ||
private final EValidationExecutorStatusType m_eType; | ||
private final VESID m_aReplacementVESID; | ||
|
||
public ValidationExecutorSetStatus (@Nonnull final EValidationExecutorStatusType eType, | ||
@Nullable final VESID aReplacementVESID) | ||
{ | ||
ValueEnforcer.notNull (eType, "Type"); | ||
m_eType = eType; | ||
m_aReplacementVESID = aReplacementVESID; | ||
} | ||
|
||
@Nonnull | ||
public EValidationExecutorStatusType getType () | ||
{ | ||
return m_eType; | ||
} | ||
|
||
@Nullable | ||
public VESID getReplacementVESID () | ||
{ | ||
return m_aReplacementVESID; | ||
} | ||
|
||
@Override | ||
public String toString () | ||
{ | ||
return new ToStringGenerator (null).append ("Type", m_eType) | ||
.append ("ReplacementVESID", m_aReplacementVESID) | ||
.getToString (); | ||
} | ||
|
||
@Nonnull | ||
public static ValidationExecutorSetStatus createValid () | ||
{ | ||
return new ValidationExecutorSetStatus (EValidationExecutorStatusType.VALID, null); | ||
} | ||
|
||
@Nonnull | ||
public static ValidationExecutorSetStatus createDeprecated (final boolean bDeprecated) | ||
{ | ||
return new ValidationExecutorSetStatus (bDeprecated ? EValidationExecutorStatusType.DEPRECATED | ||
: EValidationExecutorStatusType.VALID, null); | ||
} | ||
} |
Oops, something went wrong.