From f08984b16abf954b7b351f21a3822e21d9d4f7c2 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 1 Jul 2019 09:01:19 +0000 Subject: Fix issues from Checkstyle reviews Use lombok on fields in EnEvent. Remove unnecessary code in BBS WebClient class Address Sonar issue in Execurot class Issue-ID: POLICY-1791 Change-Id: If07dc4529b121f8bfcd6ab1ae6c9def4774f9f4d Signed-off-by: liamfallon --- .../policy/apex/core/engine/event/EnEvent.java | 92 +++------------------- .../policy/apex/core/engine/executor/Executor.java | 4 +- 2 files changed, 15 insertions(+), 81 deletions(-) (limited to 'core/core-engine') diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java index d53fdf8ff..95ea6b5d2 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +31,9 @@ import java.util.Properties; import java.util.Random; import java.util.Set; +import lombok.Getter; +import lombok.Setter; + import org.onap.policy.apex.core.engine.monitoring.EventMonitor; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; @@ -62,6 +66,8 @@ public class EnEvent extends HashMap { private final transient EventMonitor eventMonitor = new EventMonitor(); // The stack of execution of this event, used for monitoring + @Getter + @Setter private AxConcept[] userArtifactStack; private static Random rand = new Random(System.nanoTime()); @@ -69,12 +75,18 @@ public class EnEvent extends HashMap { // An identifier for the current event execution. The default value here will always be a random // number, and should // be reset + @Getter + @Setter private long executionId = rand.nextLong(); // Event related properties used during processing of this event + @Getter + @Setter private Properties executionProperties; // A string holding a message that indicates why processing of this event threw an exception + @Getter + @Setter private String exceptionMessage; /** @@ -137,86 +149,6 @@ public class EnEvent extends HashMap { return axEvent.getKey().getId(); } - /** - * Get the currently set value for the ExecutionID for this event. A ExecutionID in an EnEvent - * is used identify all EnEvents (input, internal and output events) used in a single Engine - * invocation. Therefore, a ExecutionID can be used to match which output event is the result of - * a particular input event. The default initialized value for the ExecutionID is always unique - * in a single JVM. - * - * @return the currently set value for the ExecutionID for this event. - */ - public long getExecutionId() { - return executionId; - } - - /** - * Set the value for the ExecutionID for this event. A ExecutionID in an EnEvent is used - * identify all EnEvents (input, internal and output events) used in a single Engine invocation. - * Therefore, a ExecutionID can be used to match which output event is the result of a - * particular input event. The default initialised value for the ExecutionID is always unique in - * a single JVM. - * - * @param executionId the new value for the ExecutionID for this event. - */ - public void setExecutionId(final long executionId) { - this.executionId = executionId; - } - - /** - * Get the event execution properties. - * - * @return the event execution properties - */ - public Properties getExecutionProperties() { - return executionProperties; - } - - /** - * Set the event execution properties. - * - * @param executionProperties the execution properties to set - */ - public void setExecutionProperties(Properties executionProperties) { - this.executionProperties = executionProperties; - } - - /** - * Gets the exception message explaining why processing of this event to fail. - * - * @return the exception message - */ - public String getExceptionMessage() { - return exceptionMessage; - } - - /** - * Sets the exception message explaining why processing of this event to fail. - * - * @param exceptionMessage the exception message - */ - public void setExceptionMessage(final String exceptionMessage) { - this.exceptionMessage = exceptionMessage; - } - - /** - * Get the user artifact stack of the event. - * - * @return the event user artifact stack - */ - public AxConcept[] getUserArtifactStack() { - return userArtifactStack; - } - - /** - * Store the user artifact stack of the event. - * - * @param usedArtifactStackArray the event user artifact stack - */ - public void setUserArtifactStack(final AxConcept[] usedArtifactStackArray) { - userArtifactStack = usedArtifactStackArray; - } - /** * {@inheritDoc}. */ diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java index fa0b40e77..cb0cfabc4 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,7 +114,8 @@ public interface Executor { * * @return The parent executor of this executor */ - Executor getParent(); + @SuppressWarnings("rawtypes") + Executor getParent(); /** * Get the subject of the executor. -- cgit 1.2.3-korg