X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Fbase%2FPfSearchableKey.java;h=2296953dcf8f8118696c38a088abdaef87478e3b;hb=938005505883cf7a636a8840e20e3dc8a0ad9176;hp=bed1a35987b64a55c1b5b7d3683fd3ff9c91d9d0;hpb=e81da8dac30b0525dd0f84e3518bcc452695e224;p=policy%2Fmodels.git diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java index bed1a3598..2296953dc 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,11 +21,13 @@ package org.onap.policy.models.base; -import javax.persistence.Column; -import javax.persistence.Embeddable; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import java.io.Serial; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; +import org.onap.policy.common.parameters.annotations.Pattern; import org.onap.policy.common.utils.validation.Assertions; /** @@ -36,15 +38,18 @@ import org.onap.policy.common.utils.validation.Assertions; @Getter @EqualsAndHashCode(callSuper = false) public class PfSearchableKey extends PfKeyImpl { + @Serial private static final long serialVersionUID = 8932717618579392561L; /** Regular expression to specify the structure of key names. */ public static final String WILDCARD_NAME_REGEXP = "^[A-Za-z0-9\\-_\\.]+(?:\\.\\*)?$"; @Column(name = NAME_TOKEN, length = 120) + @Pattern(regexp = WILDCARD_NAME_REGEXP) private String name; @Column(name = VERSION_TOKEN, length = 20) + @Pattern(regexp = VERSION_REGEXP) private String version; /** @@ -95,7 +100,7 @@ public class PfSearchableKey extends PfKeyImpl { * * @return a null key */ - public static final PfSearchableKey getNullKey() { + public static PfSearchableKey getNullKey() { return new PfSearchableKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION); }