Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
SessionEntity.java
Go to the documentation of this file.
1 package com.griddynamics.jagger.engine.e1.services.data.service;
2 
3 import java.util.Comparator;
4 import java.util.Date;
5 
12 public class SessionEntity {
13 
17  private String id;
18 
22  private String comment;
23 
27  private Date startDate;
28 
32  private Date endDate;
33 
37  private Integer kernels;
38 
42  public String getId() {
43  return id;
44  }
45 
46  public void setId(String id) {
47  this.id = id;
48  }
49 
53  public String getComment() {
54  return comment;
55  }
56 
57  public void setComment(String comment) {
58  this.comment = comment;
59  }
60 
64  public Date getStartDate() {
65  return startDate;
66  }
67 
68  public void setStartDate(Date startDate) {
69  this.startDate = startDate;
70  }
71 
75  public Date getEndDate() {
76  return endDate;
77  }
78 
79  public void setEndDate(Date endDate) {
80  this.endDate = endDate;
81  }
82 
86  public Integer getKernels() {
87  return kernels;
88  }
89 
90  public void setKernels(Integer kernels) {
91  this.kernels = kernels;
92  }
93 
94  @Override
95  public boolean equals(Object o) {
96  if (this == o) {
97  return true;
98  }
99  if (o == null || getClass() != o.getClass()) {
100  return false;
101  }
102 
103  SessionEntity that = (SessionEntity) o;
104 
105  if (comment != null ? !comment.equals(that.comment) : that.comment != null) {
106  return false;
107  }
108  if (endDate != null ? !endDate.equals(that.endDate) : that.endDate != null) {
109  return false;
110  }
111  if (id != null ? !id.equals(that.id) : that.id != null) {
112  return false;
113  }
114  if (kernels != null ? !kernels.equals(that.kernels) : that.kernels != null) {
115  return false;
116  }
117  if (startDate != null ? !startDate.equals(that.startDate) : that.startDate != null) {
118  return false;
119  }
120 
121  return true;
122  }
123 
124  @Override
125  public int hashCode() {
126  int result = id != null ? id.hashCode() : 0;
127  result = 31 * result + (comment != null ? comment.hashCode() : 0);
128  result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
129  result = 31 * result + (endDate != null ? endDate.hashCode() : 0);
130  result = 31 * result + (kernels != null ? kernels.hashCode() : 0);
131  return result;
132  }
133 
134  @Override
135  public String toString() {
136  return "SessionEntity{" +
137  "id='" + id + '\'' +
138  ", comment='" + comment + '\'' +
139  ", startDate='" + startDate + '\'' +
140  ", endDate='" + endDate + '\'' +
141  ", kernels=" + kernels +
142  '}';
143  }
144 
145  public static class IdComparator implements Comparator<SessionEntity> {
146 
147  @Override
148  public int compare(SessionEntity o1, SessionEntity o2) {
149  Integer id1 = Integer.parseInt(o1.getId());
150  Integer id2 = Integer.parseInt(o2.getId());
151 
152  return id2.compareTo(id1);
153  }
154 
155  }
156 }