summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dcaegen2/services/pmmapper/model/measurement/common/MeasurementInfo.java
blob: c6042b165f4485772e0f5056d03e8f1a3002a8ea (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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*-
 * ============LICENSE_START=======================================================
 *  Copyright (C) 2020 Nordix Foundation.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 * ============LICENSE_END=========================================================
 */

package org.onap.dcaegen2.services.pmmapper.model.measurement.common;

import java.math.BigInteger;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import lombok.Data;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {"job", "granPeriod", "repPeriod", "measTypes", "measType", "measValue", "measInfoId"})
@Data
public class MeasurementInfo {

    @XmlElement
    protected Job job;
    @XmlElement(required = true)
    protected GranPeriod granPeriod;
    protected RepPeriod repPeriod;
    @XmlList
    protected List<String> measTypes;
    protected List<MeasType> measType;
    protected List<MeasValue> measValue;
    @XmlAttribute
    protected String measInfoId;

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    @Data
    public static class GranPeriod {

        @XmlAttribute(name = "duration", required = true)
        protected Duration duration;
        @XmlAttribute(name = "endTime", required = true)
        @XmlSchemaType(name = "dateTime")
        protected XMLGregorianCalendar endTime;
    }


    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    @Data
    public static class Job {

        @XmlAttribute(name = "jobId", required = true)
        protected String jobId;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {"value"})
    @Data
    public static class MeasType {

        @XmlValue
        @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
        @XmlSchemaType(name = "Name")
        protected String value;
        @XmlAttribute(name = "p", required = true)
        @XmlSchemaType(name = "positiveInteger")
        protected BigInteger p;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {"measResults", "r", "suspect"})
    @Data
    public static class MeasValue {

        @XmlList
        protected List<String> measResults;
        protected List<MeasurementInfo.MeasValue.R> r;
        protected Boolean suspect;
        @XmlAttribute(name = "measObjLdn", required = true)
        protected String measObjLdn;

        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {"value"})
        @Data
        public static class R {

            @XmlValue
            protected String value;
            @XmlAttribute(name = "p", required = true)
            @XmlSchemaType(name = "positiveInteger")
            protected BigInteger p;
        }

        public void replaceR(List<R> filteredRs) {
            this.r = filteredRs;

        }

        public void replaceMeasResults(List<String> filteredMeasResults) {
            this.measResults = filteredMeasResults;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    @Data
    public static class RepPeriod {

        @XmlAttribute(name = "duration", required = true)
        protected Duration duration;
    }

    public void replaceMeasTypes(List<String> newMeasTypes) {
        this.measTypes = newMeasTypes;
    }

    public void replaceMeasType(List<MeasType> filteredMeasTypes) {
        this.measType = filteredMeasTypes;
    }

    public void replaceMeasValue(List<MeasValue> filteredMeasValues) {
        this.measValue = filteredMeasValues;
    }

}