diff options
author | liamfallon <liam.fallon@est.tech> | 2019-05-21 16:11:39 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-05-21 16:11:39 +0000 |
commit | d5ed712cf50bcf270fed8cd597d78ff4ff9370a0 (patch) | |
tree | 2b5e7a828df7aa5316630c45b82cc5d9aa61767f /models-base/src/main | |
parent | 3b10bf7dbdc63d0a2424af34ee3c0d18087e6b91 (diff) |
Add version on legacy get/delete
Issue-ID: POLICY-1777
Change-Id: I5b07ad1acdb4a614a50cb15978130c19bc5786f7
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-base/src/main')
-rw-r--r-- | models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java | 14 | ||||
-rw-r--r-- | models-base/src/main/java/org/onap/policy/models/base/PfKey.java | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java index 9bfe8abc9..dfc356060 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java @@ -27,9 +27,10 @@ import java.util.List; import javax.persistence.Column; import javax.persistence.Embeddable; -import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.Getter; import lombok.NonNull; +import lombok.ToString; import org.onap.policy.common.utils.validation.Assertions; import org.onap.policy.models.base.PfValidationResult.ValidationResult; @@ -43,7 +44,8 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult; * regular expressions respectively. */ @Embeddable -@Data +@Getter +@ToString @EqualsAndHashCode(callSuper = false) public class PfConceptKey extends PfKey { private static final long serialVersionUID = 8932717618579392561L; @@ -118,6 +120,14 @@ public class PfConceptKey extends PfKey { return this; } + public void setName(@NonNull final String name) { + this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP); + } + + public void setVersion(@NonNull final String version) { + this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP); + } + @Override public List<PfKey> getKeys() { final List<PfKey> keyList = new ArrayList<>(); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java index 5407030ba..72b8b5844 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java @@ -33,7 +33,7 @@ public abstract class PfKey extends PfConcept { public static final String NAME_REGEXP = "[A-Za-z0-9\\-_\\.]+"; /** Regular expression to specify the structure of key versions. */ - public static final String VERSION_REGEXP = "[A-Za-z0-9.]+"; + public static final String VERSION_REGEXP = "[0-9.]+"; /** Regular expression to specify the structure of key IDs. */ public static final String KEY_ID_REGEXP = "[A-Za-z0-9\\-_\\.]+:[0-9].[0-9].[0-9]"; |