/
DdiConfirmationBaseAction.java
112 lines (99 loc) · 3.31 KB
/
DdiConfirmationBaseAction.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* Copyright (c) 2022 Bosch.IO GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.ddi.json.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.hateoas.RepresentationModel;
import jakarta.validation.constraints.NotNull;
import java.util.Objects;
/**
* Update action resource.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "id", "confirmation", "actionHistory" })
public class DdiConfirmationBaseAction extends RepresentationModel<DdiConfirmationBaseAction> {
@JsonProperty("id")
@NotNull
@Schema(example = "6")
private String id;
@JsonProperty("confirmation")
@NotNull
private DdiDeployment confirmation;
/**
* Action history containing current action status and a list of feedback
* messages received earlier from the controller.
*/
@JsonProperty("actionHistory")
@JsonInclude(JsonInclude.Include.NON_NULL)
private DdiActionHistory actionHistory;
/**
* Constructor.
*/
public DdiConfirmationBaseAction() {
// needed for json create.
}
/**
* Constructor.
*
* @param id
* of the update action
* @param confirmation
* chunk details
* @param actionHistory
* containing current action status and a list of feedback messages
* received earlier from the controller.
*/
public DdiConfirmationBaseAction(final String id, final DdiDeployment confirmation,
final DdiActionHistory actionHistory) {
this.id = id;
this.confirmation = confirmation;
this.actionHistory = actionHistory;
}
/**
* Return the confirmation data containing chunks needed to confirm a action.
*
* @return {@link DdiDeployment}
*/
public DdiDeployment getConfirmation() {
return confirmation;
}
/**
* Returns the action history containing current action status and a list of
* feedback messages received earlier from the controller.
*
* @return {@link DdiActionHistory}
*/
public DdiActionHistory getActionHistory() {
return actionHistory;
}
@Override
public String toString() {
return "ConfirmationBase [id=" + id + ", confirmation=" + confirmation + " actionHistory=" + actionHistory
+ "]";
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
final DdiConfirmationBaseAction oBase = (DdiConfirmationBaseAction) obj;
return Objects.equals(this.id, oBase.id) && Objects.equals(this.confirmation, oBase.confirmation)
&& Objects.equals(this.actionHistory, oBase.actionHistory);
}
}