From efaa2f3f7d22a5096625b51643f707b471569d78 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 16 Jul 2021 10:04:54 -0400 Subject: Use lombok annotations in gui Issue-ID: POLICY-3395 Change-Id: I7820877522875a3caf47e3b7409eb4f7fb15ba2b Signed-off-by: Jim Hahn --- .../apex/rest/handling/ContextAlbumHandler.java | 4 +- .../editors/apex/rest/handling/EventHandler.java | 2 +- .../editors/apex/rest/handling/TaskHandler.java | 4 +- .../apex/rest/handling/bean/BeanContextAlbum.java | 77 ++----------------- .../editors/apex/rest/handling/bean/BeanEvent.java | 88 ++-------------------- .../editors/apex/rest/handling/bean/BeanField.java | 33 ++------ .../apex/rest/handling/bean/BeanKeyRef.java | 32 ++------ .../editors/apex/rest/handling/bean/BeanLogic.java | 31 ++------ .../apex/rest/handling/bean/BeanPolicy.java | 78 ++----------------- .../editors/apex/rest/handling/bean/BeanState.java | 86 ++------------------- .../apex/rest/handling/bean/BeanStateOutput.java | 32 ++------ .../apex/rest/handling/bean/BeanStateTaskRef.java | 41 ++-------- .../editors/apex/rest/handling/bean/BeanTask.java | 84 +-------------------- .../apex/rest/handling/bean/BeanTaskParameter.java | 32 ++------ .../apex/rest/handling/RestSessionTest.java | 2 + .../apex/rest/handling/bean/DummyBeanBase.java | 7 +- .../gui/pdp/monitoring/PdpMonitoringMain.java | 15 +--- .../monitoring/rest/PdpMonitoringRestResource.java | 12 +-- 18 files changed, 67 insertions(+), 593 deletions(-) diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ContextAlbumHandler.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ContextAlbumHandler.java index ffe445c..50a61e5 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ContextAlbumHandler.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ContextAlbumHandler.java @@ -109,7 +109,7 @@ public class ContextAlbumHandler implements RestCommandHandler { final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextAlbum.class); ApexApiResult result = session.getApexModelEdited().createContextAlbum(jsonbean.getName(), - jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.getWriteable()), + jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.isWriteable()), jsonbean.getItemSchema().getName(), jsonbean.getItemSchema().getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); @@ -137,7 +137,7 @@ public class ContextAlbumHandler implements RestCommandHandler { final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextAlbum.class); ApexApiResult result = session.getApexModelEdited().updateContextAlbum(jsonbean.getName(), - jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.getWriteable()), + jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.isWriteable()), jsonbean.getItemSchema().getName(), jsonbean.getItemSchema().getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/EventHandler.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/EventHandler.java index 0adfffa..a66ce63 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/EventHandler.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/EventHandler.java @@ -150,7 +150,7 @@ public class EventHandler implements RestCommandHandler { final ApexApiResult createParResult = session.getApexModelEdited().createEventPar(jsonbean.getName(), jsonbean.getVersion(), parameterEntry.getKey(), parameterEntry.getValue().getName(), - parameterEntry.getValue().getVersion(), parameterEntry.getValue().getOptional()); + parameterEntry.getValue().getVersion(), parameterEntry.getValue().isOptional()); if (createParResult.isNok()) { result.setResult(createParResult.getResult()); result.addMessage("Failed to add event parameter information for parameter \"" + parameterEntry.getKey() diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/TaskHandler.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/TaskHandler.java index ed7f915..848a117 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/TaskHandler.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/TaskHandler.java @@ -191,7 +191,7 @@ public class TaskHandler implements RestCommandHandler { } else { ApexApiResult fieldCreationResult = session.getApexModelEdited().createTaskInputField( jsonbean.getName(), jsonbean.getVersion(), fieldEntry.getKey(), fieldEntry.getValue().getName(), - fieldEntry.getValue().getVersion(), fieldEntry.getValue().getOptional()); + fieldEntry.getValue().getVersion(), fieldEntry.getValue().isOptional()); if (fieldCreationResult.isNok()) { result.setResult(fieldCreationResult.getResult()); @@ -240,7 +240,7 @@ public class TaskHandler implements RestCommandHandler { } else { ApexApiResult fieldCreationResult = session.getApexModelEdited().createTaskOutputField( jsonbean.getName(), jsonbean.getVersion(), fieldEntry.getKey(), fieldEntry.getValue().getName(), - fieldEntry.getValue().getVersion(), fieldEntry.getValue().getOptional()); + fieldEntry.getValue().getVersion(), fieldEntry.getValue().isOptional()); if (fieldCreationResult.isNok()) { result.setResult(fieldCreationResult.getResult()); result.addMessage("Failed to add task output field information for field \"" + fieldEntry.getKey() diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanContextAlbum.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanContextAlbum.java index 51ccafb..1b8634d 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanContextAlbum.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanContextAlbum.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,11 +23,15 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The ContextAlbum Bean. */ @XmlType +@Getter +@ToString public class BeanContextAlbum extends BeanBase { private String name = null; private String version = null; @@ -35,76 +40,4 @@ public class BeanContextAlbum extends BeanBase { private String description = null; private BeanKeyRef itemSchema = null; private boolean writeable; - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the scope. - * - * @return the scope - */ - public String getScope() { - return scope; - } - - /** - * Gets the uuid. - * - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * Gets the description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the item schema. - * - * @return the item schema - */ - public BeanKeyRef getItemSchema() { - return itemSchema; - } - - /** - * Gets the writeable. - * - * @return the writeable - */ - public boolean getWriteable() { - return writeable; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "ContextAlbum [name=" + name + ", version=" + version + ", scope=" + scope + ", uuid=" + uuid - + ", description=" + description + ", itemSchema=" + itemSchema + ", writeable=" + writeable + "]"; - } } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanEvent.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanEvent.java index 2e14f72..1c20607 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanEvent.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanEvent.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -23,11 +24,15 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import java.util.Map; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The Event Bean. */ @XmlType +@Getter +@ToString public class BeanEvent extends BeanBase { private String name = null; private String version = null; @@ -38,78 +43,6 @@ public class BeanEvent extends BeanBase { private String description = null; private Map parameters = null; - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the name space. - * - * @return the name space - */ - public String getNameSpace() { - return nameSpace; - } - - /** - * Gets the source. - * - * @return the source - */ - public String getSource() { - return source; - } - - /** - * Gets the target. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the uuid. - * - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * Gets the description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the parameters. - * - * @return the parameters - */ - public Map getParameters() { - return parameters; - } - /** * Gets the parameter. * @@ -122,15 +55,4 @@ public class BeanEvent extends BeanBase { } return null; } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "Event [name=" + name + ", version=" + version + ", nameSpace=" + nameSpace + ", source=" + source - + ", target=" + target + ", uuid=" + uuid + ", description=" + description + ", parameters=" - + getParameters() + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanField.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanField.java index 0a9042c..5b1b271 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanField.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanField.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,41 +23,17 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The Field Bean. */ @XmlType +@Getter +@ToString public class BeanField extends BeanKeyRef { private boolean optional = true; private String localName = null; - - /** - * Gets the local name for this field. - * - * @return the local name for this field. - */ - public String getLocalName() { - return localName; - } - - /** - * Gets the optional flag. - * - * @return the optional flag - */ - public boolean getOptional() { - return optional; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "Field [localName=" + getLocalName() + ", name=" + getName() + ", version=" + getVersion() - + ", optional=" + getOptional() + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanKeyRef.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanKeyRef.java index 6238b3c..234c50a 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanKeyRef.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanKeyRef.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,39 +23,16 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The Key Reference Bean. */ @XmlType +@Getter +@ToString public class BeanKeyRef extends BeanBase { private String name = null; private String version = null; - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "KeyRef [name=" + name + ", version=" + version + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanLogic.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanLogic.java index a11b768..c337ea1 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanLogic.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanLogic.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,38 +23,16 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The Logic Bean. */ @XmlType +@Getter +@ToString public class BeanLogic extends BeanBase { private String logic = null; private String logicFlavour = null; - - /** - * Gets the logic flavour. - * - * @return the logic flavour - */ - public String getLogicFlavour() { - return logicFlavour; - } - - /** - * Gets the logic. - * - * @return the logic - */ - public String getLogic() { - return logic; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "Logic [logicFlavour=" + logicFlavour + ", logic=" + logic + "]"; - } } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanPolicy.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanPolicy.java index be67402..7d6cfee 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanPolicy.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanPolicy.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -23,11 +24,15 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import java.util.Map; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The Policy Bean. */ @XmlType +@Getter +@ToString public class BeanPolicy extends BeanBase { private String name = null; private String version = null; @@ -36,77 +41,4 @@ public class BeanPolicy extends BeanBase { private String firstState = null; private String template = null; private Map states = null; - - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the uuid. - * - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * Gets the description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the first state. - * - * @return the first state - */ - public String getFirstState() { - return firstState; - } - - /** - * Gets the template. - * - * @return the template - */ - public String getTemplate() { - return template; - } - - /** - * Gets the states. - * - * @return the states - */ - public Map getStates() { - return states; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "Policy [name=" + name + ", version=" + version + ", uuid=" + uuid + ", description=" + description - + ", firstState=" + firstState + ", template=" + template + ", states=" + states + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanState.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanState.java index e1a5c68..a5cbafd 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanState.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanState.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -24,15 +25,19 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import java.util.Arrays; import java.util.Map; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.Setter; /** * The State Bean. */ @XmlType +@Getter public class BeanState extends BeanBase { private String name = null; private BeanKeyRef trigger = null; + @Setter private BeanKeyRef defaultTask = null; private BeanKeyRef[] contexts = null; private BeanLogic taskSelectionLogic = null; @@ -40,87 +45,6 @@ public class BeanState extends BeanBase { private Map finalizers = null; private Map stateOutputs = null; - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the trigger. - * - * @return the trigger - */ - public BeanKeyRef getTrigger() { - return trigger; - } - - /** - * Gets the contexts. - * - * @return the contexts - */ - public BeanKeyRef[] getContexts() { - return contexts; - } - - /** - * Gets the task selection logic. - * - * @return the task selection logic - */ - public BeanLogic getTaskSelectionLogic() { - return taskSelectionLogic; - } - - /** - * Gets the tasks. - * - * @return the tasks - */ - public Map getTasks() { - return tasks; - } - - /** - * Gets the finalizers. - * - * @return the finalizers - */ - public Map getFinalizers() { - return finalizers; - } - - /** - * Gets the state outputs. - * - * @return the state outputs - */ - public Map getStateOutputs() { - return stateOutputs; - } - - /** - * Gets the default task. - * - * @return the default task - */ - public BeanKeyRef getDefaultTask() { - return defaultTask; - } - - /** - * Sets the default task. - * - * @param defaultTask the new default task - */ - public void setDefaultTask(final BeanKeyRef defaultTask) { - this.defaultTask = defaultTask; - } - /** * {@inheritDoc}. */ diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateOutput.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateOutput.java index ee4c3fc..7e15eae 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateOutput.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateOutput.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,40 +23,17 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The StateOutput Bean. */ @XmlType +@Getter +@ToString public class BeanStateOutput extends BeanBase { private BeanKeyRef event = null; private String nextState = null; - - /** - * Gets the event. - * - * @return the event - */ - public BeanKeyRef getEvent() { - return event; - } - - /** - * Gets the next state. - * - * @return the next state - */ - public String getNextState() { - return nextState; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "StateOutput [event=" + event + ", nextState=" + nextState + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateTaskRef.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateTaskRef.java index 9b31dad..9b9616d 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateTaskRef.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanStateTaskRef.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,49 +23,17 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The State Task Reference Bean. */ @XmlType +@Getter +@ToString public class BeanStateTaskRef extends BeanBase { private BeanKeyRef task = null; private String outputType = null; private String outputName = null; - - /** - * Gets the task. - * - * @return the task - */ - public BeanKeyRef getTask() { - return task; - } - - /** - * Gets the output type. - * - * @return the output type - */ - public String getOutputType() { - return outputType; - } - - /** - * Gets the output name. - * - * @return the output name - */ - public String getOutputName() { - return outputName; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "StateTaskRef [task=" + task + ", outputType=" + outputType + ", outputName=" + outputName + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTask.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTask.java index 010745e..eebfc92 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTask.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTask.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -24,11 +25,13 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import java.util.Arrays; import java.util.Map; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; /** * The Task Bean. */ @XmlType +@Getter public class BeanTask extends BeanBase { private String name = null; private String version = null; @@ -40,87 +43,6 @@ public class BeanTask extends BeanBase { private Map parameters = null; private BeanKeyRef[] contexts = null; - /** - * Gets the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the uuid. - * - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * Gets the description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the task logic. - * - * @return the task logic - */ - public BeanLogic getTaskLogic() { - return taskLogic; - } - - /** - * Gets the input fields. - * - * @return the input fields - */ - public Map getInputFields() { - return inputFields; - } - - /** - * Gets the output fields. - * - * @return the output fields - */ - public Map getOutputFields() { - return outputFields; - } - - /** - * Gets the parameters. - * - * @return the parameters - */ - public Map getParameters() { - return parameters; - } - - /** - * Gets the contexts. - * - * @return the contexts - */ - public BeanKeyRef[] getContexts() { - return contexts; - } - /** * {@inheritDoc}. */ diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTaskParameter.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTaskParameter.java index 5210a48..d38e6b3 100644 --- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTaskParameter.java +++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/bean/BeanTaskParameter.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,40 +23,17 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.ToString; /** * The Task Parameter Bean. */ @XmlType +@Getter +@ToString public class BeanTaskParameter extends BeanBase { private String parameterName = null; private String defaultValue = null; - - /** - * Gets the parameter name. - * - * @return the parameter name - */ - public String getParameterName() { - return parameterName; - } - - /** - * Gets the default value. - * - * @return the default value - */ - public String getDefaultValue() { - return defaultValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TaskParameter [parameterName=" + parameterName + ", defaultValue=" + defaultValue + "]"; - } - } diff --git a/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/RestSessionTest.java b/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/RestSessionTest.java index 8717198..b2158ce 100644 --- a/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/RestSessionTest.java +++ b/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/RestSessionTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation. + * 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. @@ -100,6 +101,7 @@ public class RestSessionTest { final var apexModel = restSession.getApexModel(); assertThat(apexApiResult.isOk()).isTrue(); assertThat(original).isNull(); + assertThat(apexModelEdited).isNotNull(); assertThat(apexModel).isNotNull(); } diff --git a/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/bean/DummyBeanBase.java b/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/bean/DummyBeanBase.java index edb240b..79092a7 100644 --- a/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/bean/DummyBeanBase.java +++ b/gui-editors/gui-editor-apex/src/test/java/org/onap/policy/gui/editors/apex/rest/handling/bean/DummyBeanBase.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * 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. @@ -22,6 +23,7 @@ package org.onap.policy.gui.editors.apex.rest.handling.bean; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; /** * The Event Bean. @@ -29,6 +31,7 @@ import javax.xml.bind.annotation.XmlType; @XmlType public class DummyBeanBase extends BeanBase { private String name = null; + @Getter private String version = null; private String field1 = null; private int field2 = 0; @@ -39,10 +42,6 @@ public class DummyBeanBase extends BeanBase { return field1; } - public String getVersion() { - return version; - } - public int getField2() { field3 = field2; return field3; diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java index 385e2b5..398cbc4 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java @@ -105,7 +105,7 @@ public class PdpMonitoringMain { pdpMonitoringServer = new PdpMonitoringServer(parameters); // Add a shutdown hook to shut down the servlet services when the process is exiting - Runtime.getRuntime().addShutdownHook(new Thread(new PdpServicesShutdownHook())); + Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown)); state = ServicesState.RUNNING; @@ -159,19 +159,6 @@ public class PdpMonitoringMain { LOGGER.info(PDP_MONITORING_PREFIX + "{}) shutting down", this); } - /** - * This class is a shutdown hook for the Pdp services command. - */ - private class PdpServicesShutdownHook implements Runnable { - /** - * {@inheritDoc}. - */ - @Override - public void run() { - shutdown(); - } - } - /** * Main method, main entry point for command. * diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java index ede9bee..6075049 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java @@ -38,6 +38,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; @@ -243,15 +244,12 @@ public class PdpMonitoringRestResource { * A list of values that uses a FIFO sliding window of a fixed size. */ @EqualsAndHashCode(callSuper = true) + @AllArgsConstructor public class SlidingWindowList extends LinkedList { private static final long serialVersionUID = -7187277916025957447L; private final int maxEntries; - public SlidingWindowList(final int maxEntries) { - this.maxEntries = maxEntries; - } - @Override public boolean add(final V elm) { if (this.size() > (maxEntries - 1)) { @@ -265,14 +263,10 @@ public class PdpMonitoringRestResource { * A class used to storing a single data entry for an engine. */ @Getter + @AllArgsConstructor public class Counter { private final long timestamp; private final long value; - - public Counter(final long timestamp, final long value) { - this.timestamp = timestamp; - this.value = value; - } } } -- cgit 1.2.3-korg