Fixed Event Viewer pagination, date filter and added testcases.

This commit is contained in:
girirajsharma authored and Stian Thorgersen committed 2015-03-09 11:47:08 +01:00
1 parent ce33ce2485
commit d2188a3f55
8 files changed
+115 -118

No files matched your search

@@ -17,10 +17,6 @@ public class Event {
private String clientId;
private String userId;
private long fromDate;
private long toDate;
private String sessionId;
@@ -62,22 +58,6 @@ public class Event {
this.clientId = clientId;
}
public long getFromDate() {
return fromDate;
}
public void setFromDate(long fromDate) {
this.fromDate = fromDate;
}
public long getToDate() {
return toDate;
}
public void setToDate(long toDate) {
this.toDate = toDate;
}
public String getUserId() {
return userId;
}
@@ -125,8 +105,6 @@ public class Event {
clone.realmId = realmId;
clone.clientId = clientId;
clone.userId = userId;
clone.fromDate = fromDate;
clone.toDate = toDate;
clone.sessionId = sessionId;
clone.ipAddress = ipAddress;
clone.error = error;
@@ -15,8 +15,6 @@ public interface EventQuery {
public EventQuery user(String userId);
public EventQuery dateRange(String fromDate, String toDate);
public EventQuery fromDate(String fromDate);
public EventQuery toDate(String toDate);
@@ -66,21 +66,6 @@ public class JpaEventQuery implements EventQuery {
predicates.add(cb.equal(root.get("userId"), userId));
return this;
}
@Override
public EventQuery dateRange(String fromDate, String toDate) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Long from = null, to = null;
try {
from = df.parse(fromDate).getTime();
to = df.parse(toDate).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
predicates.add(cb.greaterThanOrEqualTo(root.<Long>get("time"), from));
predicates.add(cb.lessThanOrEqualTo(root.<Long>get("time"), to));
return this;
}
@Override
public EventQuery fromDate(String fromDate) {
@@ -56,21 +56,6 @@ public class MongoEventQuery implements EventQuery {
query.put("userId", userId);
return this;
}
@Override
public EventQuery dateRange(String fromDate, String toDate) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Long from = null, to = null;
try {
from = df.parse(fromDate).getTime();
to = df.parse(toDate).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
query.put("time", BasicDBObjectBuilder.start("$gte", from).add("$lte", to).get());
return this;
}
@Override
public EventQuery fromDate(String fromDate) {