2 * Copyright © 2016-2017 European Support Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.openecomp.sdc.activitylog.dao.type;
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;
26 import java.util.Date;
28 @Table(keyspace = "dox", name = "activity_log")
29 public class ActivityLogEntity {
31 @Column(name = "item_id")
32 private String itemId;
33 @ClusteringColumn(value = 1)
34 @Column(name = "version_id")
35 private String versionId;
37 @Column(name = "activity_id")
40 private ActivityType type;
42 private Date timestamp;
43 private boolean success;
44 private String message;
45 private String comment;
48 * Every entity class must have a default constructor according to
49 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
50 * Definition of mapped classes</a>.
52 public ActivityLogEntity() {
53 // Don't delete! Default constructor is required by DataStax driver
56 public ActivityLogEntity(String itemId, Version version) {
61 public ActivityLogEntity(String itemId, Version version, ActivityType type, String user,
62 boolean success, String message, String comment) {
63 this(itemId, version);
66 this.success = success;
67 this.message = message;
68 this.comment = comment;
69 this.timestamp = new Date();
72 public String getItemId() {
76 public void setItemId(String itemId) {
80 public Version getVersion() {
81 return versionId == null ? null : new Version(versionId);
84 public void setVersion(Version version) {
85 this.versionId = version == null ? null : version.getId();
88 public String getVersionId() {
92 public void setVersionId(String versionId) {
93 this.versionId = versionId;
96 public String getId() {
100 public void setId(String id) {
104 public ActivityType getType() {
108 public void setType(ActivityType type) {
112 public String getUser() {
116 public void setUser(String user) {
120 public Date getTimestamp() {
124 public void setTimestamp(Date timestamp) {
125 this.timestamp = timestamp;
128 public boolean isSuccess() {
132 public void setSuccess(boolean success) {
133 this.success = success;
136 public String getMessage() {
140 public void setMessage(String message) {
141 this.message = message;
144 public String getComment() {
148 public void setComment(String comment) {
149 this.comment = comment;