Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-sdc-activity-log-lib / openecomp-sdc-activity-log-api / src / main / java / org / openecomp / sdc / activitylog / dao / type / ActivityLogEntity.java
1 /*
2  * Copyright © 2016-2017 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.activitylog.dao.type;
18
19 import com.datastax.driver.mapping.annotations.ClusteringColumn;
20 import com.datastax.driver.mapping.annotations.Column;
21 import com.datastax.driver.mapping.annotations.Enumerated;
22 import com.datastax.driver.mapping.annotations.PartitionKey;
23 import com.datastax.driver.mapping.annotations.Table;
24 import org.openecomp.sdc.versioning.dao.types.Version;
25
26 import java.util.Date;
27
28 @Table(keyspace = "dox", name = "activity_log")
29 public class ActivityLogEntity {
30   @PartitionKey
31   @Column(name = "item_id")
32   private String itemId;
33   @ClusteringColumn(value = 1)
34   @Column(name = "version_id")
35   private String versionId;
36   @ClusteringColumn
37   @Column(name = "activity_id")
38   private String id;
39   @Enumerated
40   private ActivityType type;
41   private String user;
42   private Date timestamp;
43   private boolean success;
44   private String message;
45   private String comment;
46
47   public ActivityLogEntity() {
48   }
49
50   public ActivityLogEntity(String itemId, Version version) {
51     this.itemId = itemId;
52     setVersion(version);
53   }
54
55   public ActivityLogEntity(String itemId, Version version, ActivityType type, String user,
56                            boolean success, String message, String comment) {
57     this(itemId, version);
58     this.type = type;
59     this.user = user;
60     this.success = success;
61     this.message = message;
62     this.comment = comment;
63     this.timestamp = new Date();
64   }
65
66   public String getItemId() {
67     return itemId;
68   }
69
70   public void setItemId(String itemId) {
71     this.itemId = itemId;
72   }
73
74   public Version getVersion() {
75     return versionId == null ? null : new Version(versionId);
76   }
77
78   public void setVersion(Version version) {
79     this.versionId = version == null ? null : version.getId();
80   }
81
82   public String getVersionId() {
83     return versionId;
84   }
85
86   public void setVersionId(String versionId) {
87     this.versionId = versionId;
88   }
89
90   public String getId() {
91     return id;
92   }
93
94   public void setId(String id) {
95     this.id = id;
96   }
97
98   public ActivityType getType() {
99     return type;
100   }
101
102   public void setType(ActivityType type) {
103     this.type = type;
104   }
105
106   public String getUser() {
107     return user;
108   }
109
110   public void setUser(String user) {
111     this.user = user;
112   }
113
114   public Date getTimestamp() {
115     return timestamp;
116   }
117
118   public void setTimestamp(Date timestamp) {
119     this.timestamp = timestamp;
120   }
121
122   public boolean isSuccess() {
123     return success;
124   }
125
126   public void setSuccess(boolean success) {
127     this.success = success;
128   }
129
130   public String getMessage() {
131     return message;
132   }
133
134   public void setMessage(String message) {
135     this.message = message;
136   }
137
138   public String getComment() {
139     return comment;
140   }
141
142   public void setComment(String comment) {
143     this.comment = comment;
144   }
145 }