blob: 72d54873d26a3a09e7ebfa29528e05d23cfbf898 (
plain)
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
|
package org.openecomp.sdc.be.components.impl.exceptions;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.Arrays;
public class ComponentException extends RuntimeException {
/**
* This class will be initialized either by action status and params or by ResponseFormat
*/
private final transient ResponseFormat responseFormat;
private final ActionStatus actionStatus;
private final String[] params;
public ComponentException(ResponseFormat responseFormat) {
this(responseFormat, ActionStatus.OK);
}
public ComponentException(ActionStatus actionStatus, String... params) {
this(null, actionStatus, params);
}
private ComponentException(ResponseFormat responseFormat, ActionStatus actionStatus, String... params) {
this.actionStatus = actionStatus;
this.params = params.clone();
this.responseFormat = responseFormat;
}
public ResponseFormat getResponseFormat() {
return responseFormat;
}
public ActionStatus getActionStatus() {
return actionStatus;
}
public String[] getParams() {
return params.clone();
}
@Override
public String getMessage() {
return this.toString();
}
@Override
public String toString() {
return "ComponentException{" +
"responseFormat=" + responseFormat +
", actionStatus=" + actionStatus +
", params=" + Arrays.toString(params) +
'}';
}
}
|