2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.resources.data.auditing;
23 import com.datastax.driver.core.utils.UUIDs;
24 import com.datastax.driver.mapping.annotations.ClusteringColumn;
25 import com.datastax.driver.mapping.annotations.Column;
26 import com.datastax.driver.mapping.annotations.PartitionKey;
27 import com.datastax.driver.mapping.annotations.Table;
28 import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
29 import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
31 import java.text.SimpleDateFormat;
32 import java.util.Date;
33 import java.util.TimeZone;
34 import java.util.UUID;
36 @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.GET_CATEGORY_HIERARCHY_EVENT_TYPE)
37 public class GetCategoryHierarchyEvent extends AuditingGenericEvent {
39 protected UUID timebaseduuid;
42 // @Column(name="timestamp")
43 protected Date timestamp1;
45 @Column(name = "request_id")
46 protected String requestId;
48 protected String action;
50 protected String status;
52 @Column(name = "description")
53 protected String desc;
56 private String modifier;
59 private String details;
61 //Required to be public as it is used by Cassandra driver on get operation
62 public GetCategoryHierarchyEvent() {
63 timestamp1 = new Date();
64 timebaseduuid = UUIDs.timeBased();
67 public GetCategoryHierarchyEvent(String action, CommonAuditData commonAuditData, String modifier, String details) {
70 this.requestId = commonAuditData.getRequestId();
71 this.desc = commonAuditData.getDescription();
72 this.status = commonAuditData.getStatus();
73 this.modifier = modifier;
74 this.details = details;
77 public void setTimestamp1(String timestamp) {
78 this.timestamp1 = parseDateFromString(timestamp);
82 public void fillFields() {
83 fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId());
85 fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId());
86 fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction());
87 fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus());
88 fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc());
89 fields.put(AuditingFieldsKey.AUDIT_DETAILS.getDisplayName(), getDetails());
90 SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern);
91 simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
92 fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1));
95 public UUID getTimebaseduuid() {
99 public void setTimebaseduuid(UUID timebaseduuid) {
100 this.timebaseduuid = timebaseduuid;
103 public Date getTimestamp1() {
107 public void setTimestamp1(Date timestamp1) {
108 this.timestamp1 = timestamp1;
111 public String getRequestId() {
115 public void setRequestId(String requestId) {
116 this.requestId = requestId;
119 public String getAction() {
123 public void setAction(String action) {
124 this.action = action;
127 public String getStatus() {
131 public void setStatus(String status) {
132 this.status = status;
135 public String getDesc() {
139 public void setDesc(String desc) {
143 public String getModifier() {
147 public void setModifier(String modifier) {
148 this.modifier = modifier;
151 public String getDetails() {
155 public void setDetails(String details) {
156 this.details = details;
160 public String toString() {
161 return "GetCategoryHierarchyEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1
162 + ", requestId=" + requestId + ", action=" + action + ", status=" + status + ", desc=" + desc
163 + ", modifier=" + modifier + ", details=" + details + "]";