2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.core.protocols.engdep.messages;
23 import java.util.Arrays;
24 import java.util.Collection;
26 import org.onap.policy.apex.core.protocols.Message;
27 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
30 * The Class Response is a message that holds the response by an Apex engine to another Actino message sent to that
33 * @author Liam Fallon (liam.fallon@ericsson.com)
35 public class EngineServiceInfoResponse extends Response {
36 private static final long serialVersionUID = -7895025789667402067L;
38 // The engine service key
39 private AxArtifactKey engineServiceKey;
41 // The engines under the control of this engine service
42 private AxArtifactKey[] engineKeyArray;
44 // The engine service key
45 private AxArtifactKey apexModelKey;
48 * Instantiates a new EngineServiceInfoResponse message.
50 * @param targetKey the target key of the entity that asked for the action that triggered this response message
51 * @param successful the successful if the action in the triggering message worked
52 * @param responseTo the message to which this message is a response
54 public EngineServiceInfoResponse(final AxArtifactKey targetKey, final boolean successful,
55 final Message responseTo) {
56 super(targetKey, successful, null, responseTo);
60 * Instantiates a new EngineServiceInfoResponse message.
62 * @param targetKey the target key of the entity that asked for the action that triggered this response message
63 * @param successful the successful if the action in the triggering message worked
64 * @param messageData the message data which may indicate specific conditions for the response
65 * @param responseTo the message to which this message is a response
67 public EngineServiceInfoResponse(final AxArtifactKey targetKey, final boolean successful, final String messageData,
68 final Message responseTo) {
69 super(targetKey, successful, messageData, responseTo);
73 * Gets the engine service key.
75 * @return the engine service key
77 public AxArtifactKey getEngineServiceKey() {
78 return engineServiceKey;
82 * Sets the engine service key.
84 * @param engineServiceKey the engine service key
86 public void setEngineServiceKey(final AxArtifactKey engineServiceKey) {
87 this.engineServiceKey = engineServiceKey;
91 * Gets the engine key array.
93 * @return the engine key array
95 public AxArtifactKey[] getEngineKeyArray() {
96 return engineKeyArray;
100 * Sets the engine key array.
102 * @param engineKeyCollection the engine key array
104 public void setEngineKeyArray(final Collection<AxArtifactKey> engineKeyCollection) {
105 if (engineKeyCollection != null) {
106 engineKeyArray = engineKeyCollection.toArray(new AxArtifactKey[engineKeyCollection.size()]);
109 engineKeyArray = null;
114 * Gets the apex model key.
116 * @return the apex model key
118 public AxArtifactKey getApexModelKey() {
123 * Sets the apex model key.
125 * @param apexModelKey the apex model key
127 public void setApexModelKey(final AxArtifactKey apexModelKey) {
128 this.apexModelKey = apexModelKey;
135 public int hashCode() {
136 final int prime = 31;
137 int result = super.hashCode();
138 result = prime * result + ((apexModelKey == null) ? 0 : apexModelKey.hashCode());
139 result = prime * result + Arrays.hashCode(engineKeyArray);
140 result = prime * result + ((engineServiceKey == null) ? 0 : engineServiceKey.hashCode());
148 public boolean equals(Object obj) {
152 if (!super.equals(obj)) {
156 EngineServiceInfoResponse other = (EngineServiceInfoResponse) obj;
157 if (apexModelKey == null) {
158 if (other.apexModelKey != null) {
161 } else if (!apexModelKey.equals(other.apexModelKey)) {
164 if (!Arrays.equals(engineKeyArray, other.engineKeyArray)) {
167 if (engineServiceKey == null) {
168 if (other.engineServiceKey != null) {
171 } else if (!engineServiceKey.equals(other.engineServiceKey)) {