Added support for using oauth token for Kafka
[nonrtric/plt/ranpm.git] / datafilecollector / src / main / java / org / oran / datafile / model / FileReadyMessage.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019-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.oran.datafile.model;
22
23 import java.util.List;
24
25 import lombok.Builder;
26
27 @Builder
28 public class FileReadyMessage {
29
30     /**
31      * Meta data about a fileReady message.
32      */
33     @Builder
34     public static class MessageMetaData {
35
36         public String eventId;
37
38         public String priority;
39         public String version;
40         public String reportingEntityName;
41         public int sequence;
42         public String domain;
43
44         public String eventName;
45         public String vesEventListenerVersion;
46
47         public String sourceName;
48
49         public long lastEpochMicrosec;
50         public long startEpochMicrosec;
51
52         public String timeZoneOffset;
53
54         public String changeIdentifier;
55
56         /**
57          * Gets data from the event name. Defined as:
58          * {DomainAbbreviation}_{productName}-{vendorName}_{Description},
59          * example: Noti_RnNode-Ericsson_FileReady
60          *
61          */
62         public String productName() {
63             String[] eventArray = eventName.split("_|-");
64             if (eventArray.length >= 2) {
65                 return eventArray[1];
66             } else {
67                 return eventName;
68             }
69         }
70
71         public String vendorName() {
72             String[] eventArray = eventName.split("_|-");
73             if (eventArray.length >= 3) {
74                 return eventArray[2];
75             } else {
76                 return eventName;
77             }
78         }
79     }
80
81     @Builder
82     public static class FileInfo {
83         public String fileFormatType;
84         public String location;
85         public String fileFormatVersion;
86         public String compression;
87     }
88
89     @Builder
90     public static class ArrayOfNamedHashMap {
91         public String name;
92         public FileInfo hashMap;
93     }
94
95     @Builder
96     public static class NotificationFields {
97         public String notificationFieldsVersion;
98         public String changeType;
99         public String changeIdentifier;
100         public List<ArrayOfNamedHashMap> arrayOfNamedHashMap;
101     }
102
103     @Builder
104     public static class Event {
105         public MessageMetaData commonEventHeader;
106         public NotificationFields notificationFields;
107     }
108
109     public Event event;
110
111 }