Use lombok annotations for actors 32/122032/1
authorJim Hahn <jrh3@att.com>
Thu, 17 Jun 2021 22:04:53 +0000 (18:04 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 17 Jun 2021 22:21:08 +0000 (18:21 -0400)
This is the last one for policy-models!

Issue-ID: POLICY-3396
Change-Id: I05b114a57a720a6ae8ae073b80c8bded36d0d06d
Signed-off-by: Jim Hahn <jrh3@att.com>
models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmConstants.java
models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java
models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/constants/CdsActorConstants.java
models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java
models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoConstants.java
models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Util.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/Forwarder.java

index c44e9d8..1d0ccc3 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -23,16 +23,15 @@ package org.onap.policy.controlloop.actor.aai;
 import java.util.HashMap;
 import java.util.Map;
 import javax.ws.rs.core.MediaType;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
 
 /**
  * Utilities used by A&AI classes.
  */
-public class AaiUtil {
-
-    private AaiUtil() {
-        // do nothing
-    }
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class AaiUtil {
 
     /**
      * Makes standard request headers for A&AI requests.
index efcbe49..582d16b 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -24,8 +24,11 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.stream.Collectors;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 
-public class AppcLcmConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class AppcLcmConstants {
 
     // Strings for OPERATIONs
     public static final String OPERATION_RESTART = "Restart";
@@ -52,8 +55,4 @@ public class AppcLcmConstants {
 
     protected static final Set<String> SUPPORTS_PAYLOAD =
                     Set.of(OPERATION_CONFIG_MODIFY).stream().map(String::toLowerCase).collect(Collectors.toSet());
-
-    private AppcLcmConstants() {
-        // do nothing
-    }
 }
index 61394f2..9673f28 100644 (file)
@@ -3,7 +3,7 @@
  *
  * ================================================================================
  * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,16 +24,14 @@ package org.onap.policy.controlloop.actor.appclcm;
 
 import com.google.common.collect.Lists;
 import java.util.stream.Collectors;
+import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 
+@AllArgsConstructor
 class AppcLcmRecipeFormatter {
 
     private final String dashCasedRecipe;
 
-    AppcLcmRecipeFormatter(String dashCasedRecipe) {
-        this.dashCasedRecipe = dashCasedRecipe;
-    }
-
     String getUrlRecipe() {
         return dashCasedRecipe.toLowerCase();
     }
index 0dc5bfb..74eb6dd 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 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.
 
 package org.onap.policy.controlloop.actor.cds.constants;
 
-public class CdsActorConstants {
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class CdsActorConstants {
     public static final String CDS_ACTOR = "CDS";
 
     // CDS Status
@@ -39,8 +44,4 @@ public class CdsActorConstants {
     public static final String ORIGINATOR_ID = "POLICY";
     // Temporarily set to synchronous mode to support current rules, since callbacks aren't supported yet
     public static final String CDS_MODE = "sync";
-
-    private CdsActorConstants() {
-        // Hide implicit public constructor
-    }
 }
index 1b49ab5..12f526f 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -34,6 +34,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.NewCookie;
 import javax.ws.rs.core.Response;
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 import org.onap.policy.common.utils.coder.Coder;
 import org.onap.policy.common.utils.coder.CoderException;
@@ -42,6 +43,7 @@ import org.onap.policy.common.utils.coder.CoderException;
  * RestManager Response suitable for use with subclasses of HttpOperation. Only a couple
  * of methods are implemented; the rest throw {@link UnsupportedOperationException}.
  */
+@AllArgsConstructor
 public class RestManagerResponse extends Response {
     // TODO move to actorServices
 
@@ -51,19 +53,6 @@ public class RestManagerResponse extends Response {
     private final String body;
     private final Coder coder;
 
-    /**
-     * Constructs the object.
-     *
-     * @param status HTTP response status code
-     * @param body response body
-     * @param coder coder to decode the entity body
-     */
-    public RestManagerResponse(int status, String body, Coder coder) {
-        this.status = status;
-        this.body = body;
-        this.coder = coder;
-    }
-
     @Override
     public void close() {
         // do nothing
index b238671..a59ea3d 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
 
 package org.onap.policy.controlloop.actor.so;
 
-public class SoConstants {
-    public static final String VF_COUNT_PREFIX = "SO.VFCount";
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 
-    private SoConstants() {
-        // do nothing
-    }
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class SoConstants {
+    public static final String VF_COUNT_PREFIX = "SO.VFCount";
 }
index 3e06f1c..215286e 100644 (file)
@@ -25,6 +25,8 @@ import static org.mockito.Mockito.when;
 
 import java.util.List;
 import java.util.function.BiConsumer;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
 import org.mockito.Mock;
@@ -49,6 +51,7 @@ import org.onap.policy.simulators.Util;
  *
  * @param <Q> request type
  */
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
 public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation {
     protected static final String MY_SINK = "my-sink";
     protected static final String MY_SOURCE = "my-source";
@@ -79,12 +82,6 @@ public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation
 
     private TopicServer<Q> topicServer;
 
-    /**
-     * Constructs the object using a default actor and operation name.
-     */
-    protected BasicBidirectionalTopicOperation() {
-        super();
-    }
 
     /**
      * Constructs the object.
index d4dea7c..0c8615d 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -20,6 +20,9 @@
 
 package org.onap.policy.controlloop.actorserviceprovider;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 /**
  * Names of properties needed by the Actors defined within this repo. Note: this is not
  * exhaustive, as additional property names may be returned by company-defined Actors.
@@ -27,7 +30,8 @@ package org.onap.policy.controlloop.actorserviceprovider;
  * Note: any time a property is added, applications using the actors must be updated to
  * provide the property's value when requested.
  */
-public class OperationProperties {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class OperationProperties {
 
     /**
      * A&AI Default Cloud Region. Obtained as follows:
@@ -153,9 +157,4 @@ public class OperationProperties {
      * An Integer containing the count.
      */
     public static final String DATA_VF_COUNT = "data/vfCount";
-
-
-    private OperationProperties() {
-        super();
-    }
 }
index ba47859..d185c2e 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -23,6 +23,8 @@ package org.onap.policy.controlloop.actorserviceprovider;
 import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.onap.policy.common.utils.coder.Coder;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
@@ -32,14 +34,11 @@ import org.slf4j.LoggerFactory;
 /**
  * Actor utilities.
  */
-public class Util {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class Util {
     private static final Logger logger = LoggerFactory.getLogger(Util.class);
     private static final Coder coder = new StandardCoder();
 
-    private Util() {
-        // do nothing
-    }
-
     /**
      * Extracts an object's identity by invoking {@link Object#toString()} and returning
      * the portion starting with "@". Extraction is done on-demand, when toString() is
index 22dfc28..dec3513 100644 (file)
@@ -79,6 +79,7 @@ public class ControlLoopOperationParams {
      * across various components/servers.
      */
     @NotNull
+    @Getter
     private UUID requestId;
 
     /**
@@ -173,15 +174,6 @@ public class ControlLoopOperationParams {
         // @formatter:on
     }
 
-    /**
-     * Gets the requested ID of the associated event.
-     *
-     * @return the event's request ID, or {@code null} if no request ID is available
-     */
-    public UUID getRequestId() {
-        return requestId;
-    }
-
     /**
      * Makes an operation outcome, populating it from the parameters.
      *
index 957185e..a4071ad 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.BiConsumer;
+import lombok.AllArgsConstructor;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
 import org.onap.policy.controlloop.actorserviceprovider.Util;
 import org.slf4j.Logger;
@@ -35,6 +36,7 @@ import org.slf4j.LoggerFactory;
  * message. Each forwarder is associated with a single set of selector keys. Listeners are
  * then registered with that forwarder for a particular set of values for the given keys.
  */
+@AllArgsConstructor
 public class Forwarder {
     private static final Logger logger = LoggerFactory.getLogger(Forwarder.class);
 
@@ -51,16 +53,6 @@ public class Forwarder {
      */
     private final List<SelectorKey> keys;
 
-    /**
-     * Constructs the object.
-     *
-     * @param keys keys used to extract the field's value from the
-     *        {@link StandardCoderObject}
-     */
-    public Forwarder(List<SelectorKey> keys) {
-        this.keys = keys;
-    }
-
     /**
      * Registers a listener for messages containing the given field values.
      *