From 2669bacf43f52c1bae30d1523b823110c79ca24e Mon Sep 17 00:00:00 2001
From: Christoph Thelen <christoph.thelen@mni.thm.de>
Date: Mon, 11 May 2015 11:57:35 +0200
Subject: [PATCH] Rename NewQuestionsEvent to UnlockQuestionsEvent

Unlock is a better representation because this event only
occurs when multiple questions are published. 'New' should
only be used when questions are created.
---
 src/main/java/de/thm/arsnova/dao/CacheBuster.java           | 4 ++--
 .../java/de/thm/arsnova/domain/LearningProgressFactory.java | 4 ++--
 src/main/java/de/thm/arsnova/events/NovaEventVisitor.java   | 2 +-
 .../{NewQuestionsEvent.java => UnlockQuestionsEvent.java}   | 4 ++--
 src/main/java/de/thm/arsnova/services/QuestionService.java  | 6 +++---
 .../java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java   | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)
 rename src/main/java/de/thm/arsnova/events/{NewQuestionsEvent.java => UnlockQuestionsEvent.java} (89%)

diff --git a/src/main/java/de/thm/arsnova/dao/CacheBuster.java b/src/main/java/de/thm/arsnova/dao/CacheBuster.java
index a0254dca..cd9cc80a 100644
--- a/src/main/java/de/thm/arsnova/dao/CacheBuster.java
+++ b/src/main/java/de/thm/arsnova/dao/CacheBuster.java
@@ -36,7 +36,7 @@ import de.thm.arsnova.events.NewAnswerEvent;
 import de.thm.arsnova.events.NewFeedbackEvent;
 import de.thm.arsnova.events.NewInterposedQuestionEvent;
 import de.thm.arsnova.events.NewQuestionEvent;
-import de.thm.arsnova.events.NewQuestionsEvent;
+import de.thm.arsnova.events.UnlockQuestionsEvent;
 import de.thm.arsnova.events.NewSessionEvent;
 import de.thm.arsnova.events.NovaEventVisitor;
 import de.thm.arsnova.events.PiRoundCancelEvent;
@@ -64,7 +64,7 @@ public class CacheBuster implements ICacheBuster, NovaEventVisitor {
 	public void visit(NewQuestionEvent event) {}
 
 	@Override
-	public void visit(NewQuestionsEvent newQuestionsEvent) {}
+	public void visit(UnlockQuestionsEvent newQuestionsEvent) {}
 
 	@Override
 	public void visit(LockQuestionEvent lockQuestionEvent) {}
diff --git a/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java b/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java
index 84f6e486..198ae7d5 100644
--- a/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java
+++ b/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java
@@ -40,7 +40,7 @@ import de.thm.arsnova.events.NewAnswerEvent;
 import de.thm.arsnova.events.NewFeedbackEvent;
 import de.thm.arsnova.events.NewInterposedQuestionEvent;
 import de.thm.arsnova.events.NewQuestionEvent;
-import de.thm.arsnova.events.NewQuestionsEvent;
+import de.thm.arsnova.events.UnlockQuestionsEvent;
 import de.thm.arsnova.events.NewSessionEvent;
 import de.thm.arsnova.events.NovaEventVisitor;
 import de.thm.arsnova.events.PiRoundCancelEvent;
@@ -83,7 +83,7 @@ public class LearningProgressFactory implements NovaEventVisitor, ILearningProgr
 
 	@CacheEvict(value = "learningprogress", key = "#event.Session")
 	@Override
-	public void visit(NewQuestionsEvent event) {
+	public void visit(UnlockQuestionsEvent event) {
 		this.publisher.publishEvent(new ChangeLearningProgressEvent(this, event.getSession()));
 	}
 
diff --git a/src/main/java/de/thm/arsnova/events/NovaEventVisitor.java b/src/main/java/de/thm/arsnova/events/NovaEventVisitor.java
index 416ab614..c23fec9c 100644
--- a/src/main/java/de/thm/arsnova/events/NovaEventVisitor.java
+++ b/src/main/java/de/thm/arsnova/events/NovaEventVisitor.java
@@ -25,7 +25,7 @@ public interface NovaEventVisitor {
 
 	void visit(NewQuestionEvent newQuestionEvent);
 
-	void visit(NewQuestionsEvent newQuestionsEvent);
+	void visit(UnlockQuestionsEvent newQuestionsEvent);
 
 	void visit(LockQuestionEvent lockQuestionEvent);
 
diff --git a/src/main/java/de/thm/arsnova/events/NewQuestionsEvent.java b/src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java
similarity index 89%
rename from src/main/java/de/thm/arsnova/events/NewQuestionsEvent.java
rename to src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java
index 4516dbbb..5f1e4617 100644
--- a/src/main/java/de/thm/arsnova/events/NewQuestionsEvent.java
+++ b/src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java
@@ -22,13 +22,13 @@ import java.util.List;
 import de.thm.arsnova.entities.Question;
 import de.thm.arsnova.entities.Session;
 
-public class NewQuestionsEvent extends SessionEvent {
+public class UnlockQuestionsEvent extends SessionEvent {
 
 	private static final long serialVersionUID = 1L;
 
 	private List<Question> questions;
 
-	public NewQuestionsEvent(Object source, Session session, List<Question> questions) {
+	public UnlockQuestionsEvent(Object source, Session session, List<Question> questions) {
 		super(source, session);
 		this.questions = questions;
 	}
diff --git a/src/main/java/de/thm/arsnova/services/QuestionService.java b/src/main/java/de/thm/arsnova/services/QuestionService.java
index 079a927f..e48f1aad 100644
--- a/src/main/java/de/thm/arsnova/services/QuestionService.java
+++ b/src/main/java/de/thm/arsnova/services/QuestionService.java
@@ -58,7 +58,7 @@ import de.thm.arsnova.events.LockVotingEvent;
 import de.thm.arsnova.events.NewAnswerEvent;
 import de.thm.arsnova.events.NewInterposedQuestionEvent;
 import de.thm.arsnova.events.NewQuestionEvent;
-import de.thm.arsnova.events.NewQuestionsEvent;
+import de.thm.arsnova.events.UnlockQuestionsEvent;
 import de.thm.arsnova.events.NovaEvent;
 import de.thm.arsnova.events.PiRoundCancelEvent;
 import de.thm.arsnova.events.PiRoundDelayedStartEvent;
@@ -871,7 +871,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis
 		final List<Question> questions = databaseDao.publishAllQuestions(session, publish);
 		NovaEvent event;
 		if (publish) {
-			event = new NewQuestionsEvent(this, session, questions);
+			event = new UnlockQuestionsEvent(this, session, questions);
 		} else {
 			event = new LockQuestionsEvent(this, session, questions);
 		}
@@ -889,7 +889,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis
 		databaseDao.publishQuestions(session, publish, questions);
 		NovaEvent event;
 		if (publish) {
-			event = new NewQuestionsEvent(this, session, questions);
+			event = new UnlockQuestionsEvent(this, session, questions);
 		} else {
 			event = new LockQuestionsEvent(this, session, questions);
 		}
diff --git a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java
index 1e1f975e..9b658f60 100644
--- a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java
+++ b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java
@@ -66,7 +66,7 @@ import de.thm.arsnova.events.NewAnswerEvent;
 import de.thm.arsnova.events.NewFeedbackEvent;
 import de.thm.arsnova.events.NewInterposedQuestionEvent;
 import de.thm.arsnova.events.NewQuestionEvent;
-import de.thm.arsnova.events.NewQuestionsEvent;
+import de.thm.arsnova.events.UnlockQuestionsEvent;
 import de.thm.arsnova.events.NewSessionEvent;
 import de.thm.arsnova.events.NovaEventVisitor;
 import de.thm.arsnova.events.PiRoundCancelEvent;
@@ -477,7 +477,7 @@ public class ARSnovaSocketIOServer implements ARSnovaSocket, NovaEventVisitor {
 	}
 
 	@Override
-	public void visit(NewQuestionsEvent event) {
+	public void visit(UnlockQuestionsEvent event) {
 		this.reportLecturerQuestionAvailable(event.getSession(), event.getQuestions());
 	}
 
-- 
GitLab