From 417e292dbaff7c30f86780e20da5fc95b108032a Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 17 Jun 2021 16:54:20 -0400 Subject: Use lombok for events, base, dao Issue-ID: POLICY-3396 Change-Id: I7b37efc13a25e0e27d63a85a3ee291e91a4e1682 Signed-off-by: Jim Hahn --- .../src/main/java/org/onap/policy/models/base/PfConcept.java | 10 +++------- .../org/onap/policy/models/base/PfConceptGetterImpl.java | 10 ++-------- .../main/java/org/onap/policy/models/base/PfConceptKey.java | 9 +++------ .../src/main/java/org/onap/policy/models/base/PfKey.java | 10 +++------- .../java/org/onap/policy/models/base/PfModelService.java | 12 ++++-------- .../src/main/java/org/onap/policy/models/base/PfUtils.java | 8 ++++---- 6 files changed, 19 insertions(+), 40 deletions(-) (limited to 'models-base') diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java index 2357ec00d..8afcaa159 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java @@ -23,6 +23,8 @@ package org.onap.policy.models.base; import java.io.Serializable; import java.util.List; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import lombok.NonNull; /** @@ -30,16 +32,10 @@ import lombok.NonNull; * and interfaces on all concepts that are sub-classes of this class. */ +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class PfConcept extends Validated implements Serializable, Comparable { private static final long serialVersionUID = -7434939557282697490L; - /** - * Default constructor. - */ - protected PfConcept() { - // Default Constructor - } - /** * Copy constructor. * diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java index 3c186bbf8..fa1bbb4e7 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java @@ -24,6 +24,7 @@ package org.onap.policy.models.base; import java.util.NavigableMap; import java.util.Set; import java.util.TreeSet; +import lombok.AllArgsConstructor; import org.onap.policy.common.utils.validation.Assertions; /** @@ -31,19 +32,12 @@ import org.onap.policy.common.utils.validation.Assertions; * * @param the type of concept on which the interface implementation is applied. */ +@AllArgsConstructor public class PfConceptGetterImpl implements PfConceptGetter { // The map from which to get concepts private final NavigableMap conceptMap; - /** - * Constructor that sets the concept map on which the getter methods in the interface will operate.. - * - * @param conceptMap the concept map on which the method will operate - */ - public PfConceptGetterImpl(final NavigableMap conceptMap) { - this.conceptMap = conceptMap; - } @Override public C get(final PfConceptKey conceptKey) { 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 d200a693a..98b67819e 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 @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import javax.persistence.Embeddable; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; +import lombok.ToString; import org.onap.policy.common.parameters.annotations.Pattern; import org.onap.policy.common.utils.validation.Assertions; @@ -40,6 +41,7 @@ import org.onap.policy.common.utils.validation.Assertions; @Embeddable @Getter @EqualsAndHashCode(callSuper = false) +@ToString public class PfConceptKey extends PfKeyImpl { private static final long serialVersionUID = 8932717618579392561L; @@ -102,9 +104,4 @@ public class PfConceptKey extends PfKeyImpl { public static final PfConceptKey getNullKey() { return new PfConceptKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION); } - - @Override - public String toString() { - return "PfConceptKey(name=" + getName() + ", version=" + getVersion() + ")"; - } } 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 4b7f8cf95..949598828 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 @@ -21,12 +21,15 @@ package org.onap.policy.models.base; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import lombok.NonNull; /** * The key uniquely identifies every entity in the system. This class is an abstract class to give a common parent for * all key types in the system. */ +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class PfKey extends PfConcept { private static final long serialVersionUID = 6281159885962014041L; @@ -67,13 +70,6 @@ public abstract class PfKey extends PfConcept { IDENTICAL } - /** - * Default constructor. - */ - protected PfKey() { - super(); - } - /** * Copy constructor. * diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java index 7353915b9..860288b8e 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java @@ -24,6 +24,8 @@ package org.onap.policy.models.base; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.ws.rs.core.Response; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import lombok.NonNull; /** @@ -37,17 +39,11 @@ import lombok.NonNull; * exist in Policy Framework (particularly the engine) at any time. Of course the model in a JVM can be changed at any * time provided all users of the model are stopped and restarted in an orderly manner. */ -public abstract class PfModelService { +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class PfModelService { // The map holding the models private static Map modelMap = new ConcurrentHashMap<>(); - /** - * This class is an abstract static class that cannot be extended. - */ - private PfModelService() { - // Default constructor - } - /** * Register a model with the model service. * diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java index 6a119d6c4..6f93010bb 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2021 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,8 @@ import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; import javax.ws.rs.core.Response; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -38,10 +40,8 @@ import org.apache.commons.collections4.MapUtils; * * @author Liam Fallon (liam.fallon@est.tech) */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public final class PfUtils { - private PfUtils() { - // Cannot be subclassed - } /** * Compare two objects using their equals methods, nulls are allowed. -- cgit 1.2.3-korg