From 13debe345b6e769ab802ae10954ef63e95f31f0a Mon Sep 17 00:00:00 2001
From: Daniel Vogel <daniel.vogel@mni.thm.de>
Date: Mon, 15 Dec 2014 10:02:54 +0100
Subject: [PATCH] Added session timestamp in backend

---
 .../de/thm/arsnova/controller/SessionController.java     | 3 ++-
 src/main/java/de/thm/arsnova/dao/CouchDBDao.java         | 1 +
 src/main/java/de/thm/arsnova/entities/Session.java       | 9 +++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/main/java/de/thm/arsnova/controller/SessionController.java b/src/main/java/de/thm/arsnova/controller/SessionController.java
index 600d51d41..e828b24e9 100644
--- a/src/main/java/de/thm/arsnova/controller/SessionController.java
+++ b/src/main/java/de/thm/arsnova/controller/SessionController.java
@@ -101,7 +101,8 @@ public class SessionController extends AbstractController {
 				session.setName(session.getName() + appendix);
 				session.setShortName(session.getShortName() + appendix);
 			}
-		}
+		}		
+		
 		final Session newSession = sessionService.saveSession(session);
 
 		if (newSession == null) {
diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java
index cdc03e8cf..2785a2494 100644
--- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java
@@ -326,6 +326,7 @@ public class CouchDBDao implements IDatabaseDao {
 		sessionDocument.put("active", true);
 		sessionDocument.put("courseType", session.getCourseType());
 		sessionDocument.put("courseId", session.getCourseId());
+		sessionDocument.put("creationTime", session.getCreationTime());
 		try {
 			database.saveDocument(sessionDocument);
 		} catch (final IOException e) {
diff --git a/src/main/java/de/thm/arsnova/entities/Session.java b/src/main/java/de/thm/arsnova/entities/Session.java
index 7c7b2d684..4f3ea69a0 100644
--- a/src/main/java/de/thm/arsnova/entities/Session.java
+++ b/src/main/java/de/thm/arsnova/entities/Session.java
@@ -37,6 +37,7 @@ public class Session implements Serializable {
 	private String courseType;
 	private String courseId;
 	private List<String> _conflicts;
+	private long creationTime;
 
 	private String _id;
 	private String _rev;
@@ -145,6 +146,14 @@ public class Session implements Serializable {
 	public boolean isCourseSession() {
 		return getCourseId() != null && !getCourseId().isEmpty();
 	}
+	
+	public long getCreationTime() {
+		return creationTime;
+	}
+
+	public void setCreationTime(long creationTime) {
+		this.creationTime = creationTime;
+	}
 
 	@Override
 	public String toString() {
-- 
GitLab