Skip to content
Snippets Groups Projects
Commit f87e5e4f authored by Daniel Knapp's avatar Daniel Knapp
Browse files

added server methods for single interposed question

parent f8cb33c6
No related merge requests found
.project
.classpath
.settings/*
target/*
chromedriver.log
.checkstyle
......@@ -336,10 +336,10 @@
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.6.5.v20120716</version>
<!-- <configuration> <scanIntervalSeconds>5</scanIntervalSeconds> <webApp>
<configuration> <scanIntervalSeconds>1</scanIntervalSeconds> <webApp>
<contextPath>/</contextPath> <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
<resourcesAsCSV>src/main/webapp,../arsnova-js/src/main/webapp,../arsnova-legacy-js/src/main/webapp,../dojo-war/src/main/webapp</resourcesAsCSV>
</baseResource> </webApp> </configuration> -->
<resourcesAsCSV>src/main/webapp,../arsnova-js/src/main/webapp,../arsnova-legacy-js/src/main/webapp</resourcesAsCSV>
</baseResource> </webApp> </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
......@@ -267,5 +267,15 @@ public class QuestionController extends AbstractController {
) {
return questionService.getInterposedQuestions(sessionKey);
}
@RequestMapping(value = "/session/{sessionKey}/interposed/{documentId}", method = RequestMethod.GET)
@ResponseBody
public final Question getInterposedQuestion(
@PathVariable final String sessionKey,
@PathVariable final String documentId,
final HttpServletResponse response
) {
return questionService.getInterposedQuestion(sessionKey, documentId);
}
}
......@@ -1048,6 +1048,22 @@ public class CouchDBDao implements IDatabaseDao {
}
return null;
}
public Question getInterposedQuestion(String sessionKey, String documentId) {
try {
Document document = this.getDatabase().getDocument(documentId);
if(document != null) {
Question question = (Question) JSONObject.toBean(document.getJSONObject().getJSONObject("value"), Question.class);
question.setQuestionType("interposed_question");
return question;
}
} catch (IOException e) {
LOGGER.error("Error while retrieving interposed question", e);
}
return null;
}
@Override
public void vote(String menu) {
......
......@@ -101,4 +101,6 @@ public interface IDatabaseDao {
int countAnswers();
int countQuestions();
Question getInterposedQuestion(String sessionKey, String documentId);
}
......@@ -54,4 +54,6 @@ public interface IQuestionService {
int getInterposedCount(String sessionKey);
List<Question> getInterposedQuestions(String sessionKey);
Question getInterposedQuestion(String sessionKey, String documentId);
}
......@@ -142,4 +142,10 @@ public class QuestionService implements IQuestionService {
public List<Question> getInterposedQuestions(String sessionKey) {
return databaseDao.getInterposedQuestions(sessionKey);
}
@Override
@Authenticated
public Question getInterposedQuestion(String sessionKey, String documentId) {
return databaseDao.getInterposedQuestion(sessionKey, documentId);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment