1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.calendar.model;
18
19 import java.io.Serializable;
20 import java.util.Objects;
21
22 @SuppressWarnings("serial")
23 public abstract class AbstractModel implements Serializable {
24
25 private String id;
26
27 private String ds;
28
29 private long lastModified;
30
31 public AbstractModel(String id) {
32 this.id = id;
33 }
34
35 public String getId() {
36 return id;
37 }
38
39 public void setId(String id) {
40 this.id = id;
41 }
42
43 public void setDS(String dsName) {
44 this.ds = dsName;
45 }
46
47 public String getDS() {
48 return ds;
49 }
50
51 public String getCompositeId() {
52 return new CompositeID(getId(), getDS()).toString();
53 }
54
55 public long getLastModified() {
56 return lastModified;
57 }
58
59 public void setLastModified(long lastModified) {
60 lastModified = (lastModified / 1000) * 1000;
61 this.lastModified = lastModified;
62 }
63
64 @Override
65 public boolean equals(Object o) {
66 if (this == o) return true;
67 if (o == null || getClass() != o.getClass()) return false;
68 AbstractModel that = (AbstractModel) o;
69 return lastModified == that.lastModified &&
70 Objects.equals(id, that.id) &&
71 Objects.equals(ds, that.ds);
72 }
73
74 @Override
75 public int hashCode() {
76 return Objects.hash(id, ds, lastModified);
77 }
78 }