BrightSide Workbench Full Report + Source Code
TimeTrackerPK.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2020 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.elephant.entities.db;
20 
21 import java.io.Serializable;
22 import java.util.Date;
23 import java.util.Objects;
24 
29 public class TimeTrackerPK implements Serializable {
30 
31  private String entityPath;
32  private String trackedPath;
33  private Date timeTrack;
34 
35  public String getEntityPath() {
36  return entityPath;
37  }
38 
39  public void setEntityPath(String entityPath) {
40  this.entityPath = entityPath;
41  }
42 
43  public String getTrackedPath() {
44  return trackedPath;
45  }
46 
47  public void setTrackedPath(String trackedPath) {
48  this.trackedPath = trackedPath;
49  }
50 
51  public Date getTimeTrack() {
52  return timeTrack;
53  }
54 
55  public void setTimeTrack(Date timeTrack) {
56  this.timeTrack = timeTrack;
57  }
58 
59  @Override
60  public int hashCode() {
61  int hash = 5;
62  hash = 53 * hash + Objects.hashCode(this.entityPath);
63  hash = 53 * hash + Objects.hashCode(this.trackedPath);
64  hash = 53 * hash + Objects.hashCode(this.timeTrack);
65  return hash;
66  }
67 
68  @Override
69  public boolean equals(Object obj) {
70  if (this == obj) {
71  return true;
72  }
73  if (obj == null) {
74  return false;
75  }
76  if (getClass() != obj.getClass()) {
77  return false;
78  }
79  final TimeTrackerPK other = (TimeTrackerPK) obj;
80  if (!Objects.equals(this.entityPath, other.entityPath)) {
81  return false;
82  }
83  if (!Objects.equals(this.trackedPath, other.trackedPath)) {
84  return false;
85  }
86  if (!Objects.equals(this.timeTrack, other.timeTrack)) {
87  return false;
88  }
89  return true;
90  }
91 
92  /* Factory */
93 
94  public static TimeTrackerPK from(TimeTracker tt) {
95  TimeTrackerPK pk = new TimeTrackerPK();
98  pk.setTimeTrack(tt.getTimeTrack());
99  return pk;
100  }
101 
102 }
static TimeTrackerPK from(TimeTracker tt)