b4fb233b97ee7160cfcd39b32654418386ab26b4
[so/adapters/so-cnf-adapter.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 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.so.cnfm.lcm.bpmn.flows.tasks;
22
23 import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
24
25 import java.io.Serializable;
26 import java.util.Comparator;
27 import java.util.Objects;
28 import org.jetbrains.annotations.NotNull;
29
30 /**
31  *
32  * @author Raviteja Karumuri (raviteja.karumuri@est.tech)
33  *
34  */
35 public class TerminateDeploymentItemRequest implements Serializable, Comparable<TerminateDeploymentItemRequest> {
36
37     private static final long serialVersionUID = 2953758424937589468L;
38     private String asInstId;
39     private String asDeploymentItemInstId;
40     private String kubeConfigFile;
41     private Integer deploymentOrder;
42     private String releaseName;
43
44     private static final Comparator<Integer> COMPARATOR = Comparator.nullsFirst(Integer::compare).reversed();
45
46     public String getAsInstId() {
47         return asInstId;
48     }
49
50     public void setAsInstId(final String asInstId) {
51         this.asInstId = asInstId;
52     }
53
54     public String getAsDeploymentItemInstId() {
55         return asDeploymentItemInstId;
56     }
57
58     public void setAsDeploymentItemInstId(final String asDeploymentItemInstId) {
59         this.asDeploymentItemInstId = asDeploymentItemInstId;
60     }
61
62     public String getKubeConfigFile() {
63         return kubeConfigFile;
64     }
65
66     public void setKubeConfigFile(final String kubeConfigFile) {
67         this.kubeConfigFile = kubeConfigFile;
68     }
69
70     public Integer getDeploymentOrder() {
71         return deploymentOrder;
72     }
73
74     public void setDeploymentOrder(final Integer deploymentOrder) {
75         this.deploymentOrder = deploymentOrder;
76     }
77
78     public String getReleaseName() {
79         return releaseName;
80     }
81
82     public void setReleaseName(final String releaseName) {
83         this.releaseName = releaseName;
84     }
85
86     @Override
87     public boolean equals(final Object obj) {
88         if (obj instanceof TerminateDeploymentItemRequest) {
89             final TerminateDeploymentItemRequest that = (TerminateDeploymentItemRequest) obj;
90             return Objects.equals(asInstId, that.asInstId)
91                     && Objects.equals(asDeploymentItemInstId, that.asDeploymentItemInstId)
92                     && Objects.equals(kubeConfigFile, that.kubeConfigFile)
93                     && Objects.equals(deploymentOrder, that.deploymentOrder)
94                     && Objects.equals(releaseName, that.releaseName);
95         }
96         return false;
97     }
98
99     @Override
100     public int hashCode() {
101         return Objects.hash(asInstId, asDeploymentItemInstId, kubeConfigFile, deploymentOrder,
102                 releaseName);
103     }
104
105     @Override
106     public int compareTo(@NotNull final TerminateDeploymentItemRequest terminateDeploymentItemRequest) {
107         return COMPARATOR.compare(this.getDeploymentOrder(), terminateDeploymentItemRequest.getDeploymentOrder());
108     }
109
110     @Override
111     public String toString() {
112         final StringBuilder sb = new StringBuilder();
113         sb.append("class TerminateDeploymentItemRequest {\n");
114         sb.append("    asInstId: ").append(toIndentedString(asInstId)).append("\n");
115         sb.append("    asDeploymentItemInstId: ").append(toIndentedString(asDeploymentItemInstId)).append("\n");
116         sb.append("    deploymentOrder: ").append(toIndentedString(deploymentOrder)).append("\n");
117         sb.append("    kubeConfigFile: ").append(toIndentedString(kubeConfigFile)).append("\n");
118         sb.append("    releaseName: ").append(toIndentedString(releaseName)).append("\n");
119         sb.append("}");
120         return sb.toString();
121     }
122 }