Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-core-lib / openecomp-zusammen-lib / openecomp-zusammen-plugin / src / main / java / org / openecomp / core / zusammen / plugin / dao / types / SynchronizationStateEntity.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.core.zusammen.plugin.dao.types;
18
19 import com.amdocs.zusammen.datatypes.Id;
20
21 import java.util.Date;
22
23 /**
24  * Synchronization state of an entity:
25  * <ul>
26  * <li>On private entity edit (create/update/delete): marked as dirty</li>
27  * <li>On entity publication:
28  * <ul>
29  * <li>if the private entity exists - updated with the publish time, marked as not dirty</li>
30  * <li>Otherwise - deleted</li>
31  * </ul>
32  * </li>
33  * </ul>
34  */
35 public class SynchronizationStateEntity {
36   private Id id;
37   private Id revisionId;
38   private Date publishTime;
39   private boolean dirty;
40   private String user;
41   private String message;
42
43   public SynchronizationStateEntity(Id id,Id revisionId) {
44     this.id = id;
45     this.revisionId = revisionId;
46   }
47
48   public SynchronizationStateEntity(Id id,Id revisionId, Date publishTime, boolean dirty) {
49     this(id,revisionId);
50     this.publishTime = publishTime;
51     this.dirty = dirty;
52   }
53
54   public Id getId() {
55     return id;
56   }
57
58   public Date getPublishTime() {
59     return publishTime;
60   }
61
62   public void setPublishTime(Date publishTime) {
63     this.publishTime = publishTime;
64   }
65
66   public boolean isDirty() {
67     return dirty;
68   }
69
70   public void setDirty(boolean dirty) {
71     this.dirty = dirty;
72   }
73
74   public Id getRevisionId() {
75     return revisionId;
76   }
77
78   public void setRevisionId(Id revisionId) {
79     this.revisionId = revisionId;
80   }
81
82   public String getUser() {
83     return user;
84   }
85
86   public void setUser(String user) {
87     this.user = user;
88   }
89
90   public String getMessage() {
91     return message;
92   }
93
94   public void setMessage(String message) {
95     this.message = message;
96   }
97
98   @Override
99   public boolean equals(Object o) {
100     if (this == o) {
101       return true;
102     }
103     if (o == null || getClass() != o.getClass()) {
104       return false;
105     }
106
107     SynchronizationStateEntity that = (SynchronizationStateEntity) o;
108
109     return id.equals(that.id);
110   }
111
112   @Override
113   public int hashCode() {
114     return id.hashCode();
115   }
116 }