31a42c548a4f552834c18c86ecfa8f7b76481085
[policy/clamp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * Copyright (C) 2021-2023 Nordix Foundation.
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
22
23 import java.util.ArrayList;
24 import java.util.List;
25 import lombok.Getter;
26 import lombok.Setter;
27 import lombok.ToString;
28 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
29 import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
30 import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
31 import org.onap.policy.models.base.PfUtils;
32
33 /**
34  * Class to represent the PARTICIPANT_STATUS message that all the participants send to the ACM runtime.
35  */
36 @Getter
37 @Setter
38 @ToString(callSuper = true)
39 public class ParticipantStatus extends ParticipantMessage {
40
41     // State and health status of the participant
42     private ParticipantState state;
43
44     // A list of ParticipantDefinition updates, returned in response to ParticipantStatusReq only
45     private List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
46
47     // List of AutomationCompositionInfo types with AutomationCompositionId and its state
48     private List<AutomationCompositionInfo> automationCompositionInfoList = new ArrayList<>();
49
50     /**
51      * Constructor for instantiating ParticipantStatus class with message name.
52      *
53      */
54     public ParticipantStatus() {
55         super(ParticipantMessageType.PARTICIPANT_STATUS);
56     }
57
58     /**
59      * Constructs the object, making a deep copy.
60      *
61      * @param source source from which to copy
62      */
63     public ParticipantStatus(final ParticipantStatus source) {
64         super(source);
65
66         this.state = source.state;
67         this.participantDefinitionUpdates =
68             PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new);
69         this.automationCompositionInfoList =
70             PfUtils.mapList(source.automationCompositionInfoList, AutomationCompositionInfo::new);
71     }
72 }