Commit aced7782 authored by Daniel Gerhardt's avatar Daniel Gerhardt

Rename service layer methods for consistency

parent 45012216
......@@ -39,7 +39,7 @@ public class UserSessionAspect {
/** Sets current user and ARSnova session in session scoped UserSessionService
*/
@AfterReturning(
pointcut = "execution(public * de.thm.arsnova.services.SessionService.joinSession(..)) && args(keyword)",
pointcut = "execution(public * de.thm.arsnova.services.SessionService.join(..)) && args(keyword)",
returning = "session"
)
public void joinSessionAdvice(final JoinPoint jp, final String keyword, final Session session) {
......
......@@ -57,7 +57,7 @@ public class CommentController extends PaginationController {
@DeprecatedApi
@Deprecated
public int getInterposedCount(@ApiParam(value = "Session-Key from current session", required = true) @RequestParam final String sessionkey) {
return commentService.getInterposedCount(sessionkey);
return commentService.count(sessionkey);
}
@ApiOperation(value = "count all unread comments",
......@@ -66,7 +66,7 @@ public class CommentController extends PaginationController {
@DeprecatedApi
@Deprecated
public CommentReadingCount getUnreadInterposedCount(@ApiParam(value = "Session-Key from current session", required = true) @RequestParam("sessionkey") final String sessionkey, String user) {
return commentService.getInterposedReadingCount(sessionkey, user);
return commentService.countRead(sessionkey, user);
}
@ApiOperation(value = "Retrieves all Comments for a Session",
......@@ -74,14 +74,14 @@ public class CommentController extends PaginationController {
@RequestMapping(value = "/", method = RequestMethod.GET)
@Pagination
public List<Comment> getInterposedQuestions(@ApiParam(value = "Session-Key from current session", required = true) @RequestParam final String sessionkey) {
return Comment.fromList(commentService.getInterposedQuestions(sessionkey, offset, limit));
return Comment.fromList(commentService.getBySessionKey(sessionkey, offset, limit));
}
@ApiOperation(value = "Retrieves an Comment",
nickname = "getInterposedQuestion")
@RequestMapping(value = "/{questionId}", method = RequestMethod.GET)
public Comment getInterposedQuestion(@ApiParam(value = "ID of the Comment that needs to be deleted", required = true) @PathVariable final String questionId) {
return new Comment(commentService.readInterposedQuestion(questionId));
return new Comment(commentService.getAndMarkRead(questionId));
}
@ApiOperation(value = "Creates a new Comment for a Session and returns the Comment's data",
......@@ -95,7 +95,7 @@ public class CommentController extends PaginationController {
@ApiParam(value = "Session-Key from current session", required = true) @RequestParam final String sessionkey,
@ApiParam(value = "the body from the new comment", required = true) @RequestBody final de.thm.arsnova.entities.Comment comment
) {
if (commentService.saveQuestion(comment)) {
if (commentService.save(comment)) {
return;
}
......@@ -106,6 +106,6 @@ public class CommentController extends PaginationController {
nickname = "deleteInterposedQuestion")
@RequestMapping(value = "/{questionId}", method = RequestMethod.DELETE)
public void deleteInterposedQuestion(@ApiParam(value = "ID of the comment that needs to be deleted", required = true) @PathVariable final String questionId) {
commentService.deleteInterposedQuestion(questionId);
commentService.delete(questionId);
}
}
......@@ -63,7 +63,7 @@ public class ContentController extends PaginationController {
})
@RequestMapping(value = "/{questionId}", method = RequestMethod.GET)
public Content getQuestion(@PathVariable final String questionId) {
final Content content = contentService.getQuestion(questionId);
final Content content = contentService.get(questionId);
if (content != null) {
return content;
}
......@@ -79,7 +79,7 @@ public class ContentController extends PaginationController {
@RequestMapping(value = "/", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public Content postQuestion(@RequestBody final Content content) {
if (contentService.saveQuestion(content) != null) {
if (contentService.save(content) != null) {
return content;
}
throw new BadRequestException();
......@@ -93,7 +93,7 @@ public class ContentController extends PaginationController {
@ResponseStatus(HttpStatus.CREATED)
public List<Content> bulkPostQuestions(@RequestBody final List<Content> contents) {
for (final Content content : contents) {
if (contentService.saveQuestion(content) == null) {
if (contentService.save(content) == null) {
throw new BadRequestException();
}
}
......@@ -291,7 +291,7 @@ public class ContentController extends PaginationController {
} else if (preparationQuestionsOnly) {
contents = contentService.getPreparationQuestions(sessionkey);
} else {
contents = contentService.getSkillQuestions(sessionkey);
contents = contentService.getBySessionKey(sessionkey);
}
if (contents == null || contents.isEmpty()) {
response.setStatus(HttpStatus.NO_CONTENT.value());
......@@ -320,7 +320,7 @@ public class ContentController extends PaginationController {
} else if (preparationQuestionsOnly) {
contentService.deletePreparationQuestions(sessionkey);
} else {
contentService.deleteAllQuestions(sessionkey);
contentService.deleteBySessionKey(sessionkey);
}
}
......@@ -336,13 +336,13 @@ public class ContentController extends PaginationController {
@RequestParam(value = "preparationquestionsonly", defaultValue = "false") final boolean preparationQuestionsOnly
) {
if (lectureQuestionsOnly) {
return contentService.getLectureQuestionCount(sessionkey);
return contentService.countLectureQuestions(sessionkey);
} else if (flashcardsOnly) {
return contentService.getFlashcardCount(sessionkey);
return contentService.countFlashcards(sessionkey);
} else if (preparationQuestionsOnly) {
return contentService.getPreparationQuestionCount(sessionkey);
return contentService.countPreparationQuestions(sessionkey);
} else {
return contentService.getSkillQuestionCount(sessionkey);
return contentService.countBySessionKey(sessionkey);
}
}
......@@ -352,7 +352,7 @@ public class ContentController extends PaginationController {
public void deleteAnswersAndQuestion(
@PathVariable final String questionId
) {
contentService.deleteQuestion(questionId);
contentService.delete(questionId);
}
@ApiOperation(value = "Get unanswered skill question ID by provided session ID",
......@@ -544,7 +544,7 @@ public class ContentController extends PaginationController {
@Deprecated
@RequestMapping(value = "/{questionId}/answercount", method = RequestMethod.GET)
public int getAnswerCount(@PathVariable final String questionId) {
return contentService.getAnswerCount(questionId);
return contentService.countAnswersByQuestionIdAndRound(questionId);
}
@ApiOperation(value = "Get the amount of answers for a question, identified by the question ID",
......@@ -552,8 +552,8 @@ public class ContentController extends PaginationController {
@RequestMapping(value = "/{questionId}/allroundanswercount", method = RequestMethod.GET)
public List<Integer> getAllAnswerCount(@PathVariable final String questionId) {
return Arrays.asList(
contentService.getAnswerCount(questionId, 1),
contentService.getAnswerCount(questionId, 2)
contentService.countAnswersByQuestionIdAndRound(questionId, 1),
contentService.countAnswersByQuestionIdAndRound(questionId, 2)
);
}
......@@ -561,7 +561,7 @@ public class ContentController extends PaginationController {
nickname = "getTotalAnswerCountByQuestion")
@RequestMapping(value = "/{questionId}/totalanswercount", method = RequestMethod.GET)
public int getTotalAnswerCountByQuestion(@PathVariable final String questionId) {
return contentService.getTotalAnswerCountByQuestion(questionId);
return contentService.countTotalAnswersByQuestionId(questionId);
}
@ApiOperation(value = "Get the amount of answers and abstention answers by a question, identified by the question ID",
......@@ -569,8 +569,8 @@ public class ContentController extends PaginationController {
@RequestMapping(value = "/{questionId}/answerandabstentioncount", method = RequestMethod.GET)
public List<Integer> getAnswerAndAbstentionCount(@PathVariable final String questionId) {
return Arrays.asList(
contentService.getAnswerCount(questionId),
contentService.getAbstentionAnswerCount(questionId)
contentService.countAnswersByQuestionIdAndRound(questionId),
contentService.countTotalAbstentionsByQuestionId(questionId)
);
}
......@@ -579,7 +579,7 @@ public class ContentController extends PaginationController {
@RequestMapping(value = "/{questionId}/freetextanswer/", method = RequestMethod.GET)
@Pagination
public List<Answer> getFreetextAnswers(@PathVariable final String questionId) {
return contentService.getFreetextAnswers(questionId, offset, limit);
return contentService.getFreetextAnswersByQuestionId(questionId, offset, limit);
}
@ApiOperation(value = "Get my answers of an session, identified by the sessionkey",
......@@ -588,7 +588,7 @@ public class ContentController extends PaginationController {
@Deprecated
@RequestMapping(value = "/myanswers", method = RequestMethod.GET)
public List<Answer> getMyAnswers(@RequestParam final String sessionkey) {
return contentService.getMyAnswers(sessionkey);
return contentService.getMyAnswersBySessionKey(sessionkey);
}
@ApiOperation(value = "Get the total amount of answers of an session, identified by the sessionkey",
......@@ -606,7 +606,7 @@ public class ContentController extends PaginationController {
} else if (preparationQuestionsOnly) {
return contentService.countPreparationQuestionAnswers(sessionkey);
} else {
return contentService.getTotalAnswerCount(sessionkey);
return contentService.countTotalAnswersBySessionKey(sessionkey);
}
}
}
......@@ -51,14 +51,14 @@ public class FeedbackController extends AbstractController {
@Deprecated
@RequestMapping(value = "/session/{sessionkey}/feedback", method = RequestMethod.GET)
public Feedback getFeedback(@PathVariable final String sessionkey) {
return feedbackService.getFeedback(sessionkey);
return feedbackService.getBySessionKey(sessionkey);
}
@DeprecatedApi
@Deprecated
@RequestMapping(value = "/session/{sessionkey}/myfeedback", method = RequestMethod.GET)
public Integer getMyFeedback(@PathVariable final String sessionkey) {
Integer value = feedbackService.getMyFeedback(sessionkey, userService.getCurrentUser());
Integer value = feedbackService.getBySessionKeyAndUser(sessionkey, userService.getCurrentUser());
if (value != null && value >= Feedback.MIN_FEEDBACK_TYPE && value <= Feedback.MAX_FEEDBACK_TYPE) {
return value;
}
......@@ -69,21 +69,21 @@ public class FeedbackController extends AbstractController {
@Deprecated
@RequestMapping(value = "/session/{sessionkey}/feedbackcount", method = RequestMethod.GET)
public int getFeedbackCount(@PathVariable final String sessionkey) {
return feedbackService.getFeedbackCount(sessionkey);
return feedbackService.countFeedbackBySessionKey(sessionkey);
}
@DeprecatedApi
@Deprecated
@RequestMapping(value = "/session/{sessionkey}/roundedaveragefeedback", method = RequestMethod.GET)
public long getAverageFeedbackRounded(@PathVariable final String sessionkey) {
return feedbackService.getAverageFeedbackRounded(sessionkey);
return feedbackService.calculateRoundedAverageFeedback(sessionkey);
}
@DeprecatedApi
@Deprecated
@RequestMapping(value = "/session/{sessionkey}/averagefeedback", method = RequestMethod.GET)
public double getAverageFeedback(@PathVariable final String sessionkey) {
return feedbackService.getAverageFeedback(sessionkey);
return feedbackService.calculateAverageFeedback(sessionkey);
}
@DeprecatedApi
......@@ -95,8 +95,8 @@ public class FeedbackController extends AbstractController {
@RequestBody final int value
) {
User user = userService.getCurrentUser();
feedbackService.saveFeedback(sessionkey, value, user);
Feedback feedback = feedbackService.getFeedback(sessionkey);
feedbackService.save(sessionkey, value, user);
Feedback feedback = feedbackService.getBySessionKey(sessionkey);
return feedback;
}
......
......@@ -99,7 +99,7 @@ public class LegacyController extends AbstractController {
@RequestMapping(value = "/session/{sessionKey}/interposed", method = RequestMethod.DELETE)
@ResponseBody
public void deleteAllInterposedQuestions(@PathVariable final String sessionKey) {
commentService.deleteAllInterposedQuestions(sessionKey);
commentService.deleteBySessionKey(sessionKey);
}
@DeprecatedApi
......
......@@ -93,9 +93,9 @@ public class MotdController extends AbstractController {
if (motd != null) {
Motd newMotd;
if ("session".equals(motd.getAudience()) && motd.getSessionkey() != null) {
newMotd = motdService.saveSessionMotd(motd.getSessionkey(), motd);
newMotd = motdService.save(motd.getSessionkey(), motd);
} else {
newMotd = motdService.saveMotd(motd);
newMotd = motdService.save(motd);
}
if (newMotd == null) {
response.setStatus(HttpStatus.SERVICE_UNAVAILABLE.value());
......@@ -115,20 +115,20 @@ public class MotdController extends AbstractController {
@ApiParam(value = "current motd", required = true) @RequestBody final Motd motd
) {
if ("session".equals(motd.getAudience()) && motd.getSessionkey() != null) {
return motdService.updateSessionMotd(motd.getSessionkey(), motd);
return motdService.update(motd.getSessionkey(), motd);
} else {
return motdService.updateMotd(motd);
return motdService.update(motd);
}
}
@ApiOperation(value = "deletes a message of the day", nickname = "deleteMotd")
@RequestMapping(value = "/{motdkey}", method = RequestMethod.DELETE)
public void deleteMotd(@ApiParam(value = "Motd-key from the message that shall be deleted", required = true) @PathVariable final String motdkey) {
Motd motd = motdService.getMotd(motdkey);
Motd motd = motdService.getByKey(motdkey);
if ("session".equals(motd.getAudience())) {
motdService.deleteSessionMotd(motd.getSessionkey(), motd);
motdService.deleteBySessionKey(motd.getSessionkey(), motd);
} else {
motdService.deleteMotd(motd);
motdService.delete(motd);
}
}
......@@ -136,7 +136,7 @@ public class MotdController extends AbstractController {
@RequestMapping(value = "/userlist", method = RequestMethod.GET)
public MotdList getUserMotdList(
@ApiParam(value = "users name", required = true) @RequestParam(value = "username", defaultValue = "null", required = true) final String username) {
return motdService.getMotdListForUser(username);
return motdService.getMotdListByUsername(username);
}
@ApiOperation(value = "create a list of the motdkeys the current user has confirmed to be read")
......@@ -144,7 +144,7 @@ public class MotdController extends AbstractController {
public MotdList postUserMotdList(
@ApiParam(value = "current motdlist", required = true) @RequestBody final MotdList userMotdList
) {
return motdService.saveUserMotdList(userMotdList);
return motdService.saveMotdList(userMotdList);
}
@ApiOperation(value = "update a list of the motdkeys the current user has confirmed to be read")
......@@ -152,6 +152,6 @@ public class MotdController extends AbstractController {
public MotdList updateUserMotdList(
@ApiParam(value = "current motdlist", required = true) @RequestBody final MotdList userMotdList
) {
return motdService.updateUserMotdList(userMotdList);
return motdService.updateMotdList(userMotdList);
}
}
......@@ -76,9 +76,9 @@ public class SessionController extends PaginationController {
@ApiParam(value = "Adminflag", required = false) @RequestParam(value = "admin", defaultValue = "false") final boolean admin
) {
if (admin) {
return sessionService.getSessionForAdmin(sessionkey);
return sessionService.getForAdmin(sessionkey);
} else {
return sessionService.getSession(sessionkey);
return sessionService.getByKey(sessionkey);
}
}
......@@ -86,7 +86,7 @@ public class SessionController extends PaginationController {
nickname = "deleteSession")
@RequestMapping(value = "/{sessionkey}", method = RequestMethod.DELETE)
public void deleteSession(@ApiParam(value = "Session-Key from current session", required = true) @PathVariable final String sessionkey) {
sessionService.deleteSession(sessionkey);
sessionService.delete(sessionkey);
}
@ApiOperation(value = "count active users",
......@@ -112,7 +112,7 @@ public class SessionController extends PaginationController {
final Course course = new Course();
course.setId(session.getCourseId());
courses.add(course);
final int sessionCount = sessionService.countSessions(courses);
final int sessionCount = sessionService.countSessionsByCourses(courses);
if (sessionCount > 0) {
final String appendix = " (" + (sessionCount + 1) + ")";
session.setName(session.getName() + appendix);
......@@ -120,7 +120,7 @@ public class SessionController extends PaginationController {
}
}
final Session newSession = sessionService.saveSession(session);
final Session newSession = sessionService.save(session);
if (newSession == null) {
response.setStatus(HttpStatus.SERVICE_UNAVAILABLE.value());
......@@ -137,7 +137,7 @@ public class SessionController extends PaginationController {
@ApiParam(value = "session-key from current session", required = true) @PathVariable final String sessionkey,
@ApiParam(value = "current session", required = true) @RequestBody final Session session
) {
return sessionService.updateSession(sessionkey, session);
return sessionService.update(sessionkey, session);
}
@ApiOperation(value = "change the session creator (owner)", nickname = "changeSessionCreator")
......@@ -146,7 +146,7 @@ public class SessionController extends PaginationController {
@ApiParam(value = "session-key from current session", required = true) @PathVariable final String sessionkey,
@ApiParam(value = "new session creator", required = true) @RequestBody final String newCreator
) {
return sessionService.changeSessionCreator(sessionkey, newCreator);
return sessionService.updateCreator(sessionkey, newCreator);
}
@ApiOperation(value = "Retrieves a list of Sessions",
......@@ -376,7 +376,7 @@ public class SessionController extends PaginationController {
@ApiParam(value = "session-key from current session", required = true) @PathVariable final String sessionkey,
final HttpServletResponse response
) {
return sessionService.getSessionFeatures(sessionkey);
return sessionService.getFeatures(sessionkey);
}
@RequestMapping(value = "/{sessionkey}/features", method = RequestMethod.PUT)
......@@ -387,7 +387,7 @@ public class SessionController extends PaginationController {
@ApiParam(value = "session feature", required = true) @RequestBody final SessionFeature features,
final HttpServletResponse response
) {
return sessionService.changeSessionFeatures(sessionkey, features);
return sessionService.updateFeatures(sessionkey, features);
}
@RequestMapping(value = "/{sessionkey}/lockfeedbackinput", method = RequestMethod.POST)
......
......@@ -50,7 +50,7 @@ public class UserController extends AbstractController {
public void register(@RequestParam final String username,
@RequestParam final String password,
final HttpServletRequest request, final HttpServletResponse response) {
if (null != userService.createDbUser(username, password)) {
if (null != userService.create(username, password)) {
return;
}
......@@ -64,10 +64,10 @@ public class UserController extends AbstractController {
@PathVariable final String username,
@RequestParam final String key, final HttpServletRequest request,
final HttpServletResponse response) {
DbUser dbUser = userService.getDbUser(username);
DbUser dbUser = userService.getByUsername(username);
if (null != dbUser && key.equals(dbUser.getActivationKey())) {
dbUser.setActivationKey(null);
userService.updateDbUser(dbUser);
userService.update(dbUser);
return;
}
......@@ -80,7 +80,7 @@ public class UserController extends AbstractController {
@PathVariable final String username,
final HttpServletRequest request,
final HttpServletResponse response) {
if (null == userService.deleteDbUser(username)) {
if (null == userService.deleteByUsername(username)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
}
......@@ -92,7 +92,7 @@ public class UserController extends AbstractController {
@RequestParam(required = false) final String password,
final HttpServletRequest request,
final HttpServletResponse response) {
DbUser dbUser = userService.getDbUser(username);
DbUser dbUser = userService.getByUsername(username);
if (null == dbUser) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
......
......@@ -105,7 +105,7 @@ public class CouchDbMotdRepository extends CouchDbCrudRepository<Motd> implement
motd.setMotdkey(oldMotd.getMotdkey());
update(motd);
} else {
motd.setMotdkey(sessionService.generateKeyword());
motd.setMotdkey(sessionService.generateKey());
add(motd);
}
......
......@@ -89,7 +89,7 @@ public class CouchDbSessionRepository extends CouchDbCrudRepository<Session> imp
@Override
@Caching(evict = @CacheEvict(cacheNames = "sessions", key = "#result.keyword"))
public Session save(final User user, final Session session) {
session.setKeyword(sessionService.generateKeyword());
session.setKeyword(sessionService.generateKey());
session.setCreator(user.getUsername());
session.setActive(true);
session.setFeedbackLock(false);
......
......@@ -7,19 +7,19 @@ import de.thm.arsnova.entities.User;
import java.util.List;
public interface CommentService {
boolean saveQuestion(Comment comment);
boolean save(Comment comment);
int getInterposedCount(String sessionKey);
int count(String sessionKey);
CommentReadingCount getInterposedReadingCount(String sessionKey, String username);
CommentReadingCount countRead(String sessionKey, String username);
List<Comment> getInterposedQuestions(String sessionKey, int offset, int limit);
List<Comment> getBySessionKey(String sessionKey, int offset, int limit);
Comment readInterposedQuestion(String commentId);
Comment getAndMarkRead(String commentId);
Comment readInterposedQuestionInternal(String commentId, User user);
Comment getAndMarkReadInternal(String commentId, User user);
void deleteInterposedQuestion(String commentId);
void delete(String commentId);
void deleteAllInterposedQuestions(String sessionKeyword);
void deleteBySessionKey(String sessionKeyword);
}
......@@ -36,7 +36,7 @@ public class CommentServiceImpl implements CommentService {
@Override
@PreAuthorize("isAuthenticated()")
public boolean saveQuestion(final Comment comment) {
public boolean save(final Comment comment) {
final Session session = sessionRepository.findByKeyword(comment.getSessionId());
final Comment result = commentRepository.save(session.getId(), comment, userService.getCurrentUser());
......@@ -50,7 +50,7 @@ public class CommentServiceImpl implements CommentService {
@Override
@PreAuthorize("isAuthenticated() and hasPermission(#commentId, 'comment', 'owner')")
public void deleteInterposedQuestion(final String commentId) {
public void delete(final String commentId) {
final Comment comment = commentRepository.findOne(commentId);
if (comment == null) {
throw new NotFoundException();
......@@ -64,7 +64,7 @@ public class CommentServiceImpl implements CommentService {
@Override
@PreAuthorize("isAuthenticated()")
public void deleteAllInterposedQuestions(final String sessionKeyword) {
public void deleteBySessionKey(final String sessionKeyword) {
final Session session = sessionRepository.findByKeyword(sessionKeyword);
if (session == null) {
throw new UnauthorizedException();
......@@ -79,13 +79,13 @@ public class CommentServiceImpl implements CommentService {
@Override
@PreAuthorize("isAuthenticated()")
public int getInterposedCount(final String sessionKey) {
public int count(final String sessionKey) {
return commentRepository.countBySessionKey(sessionKey);
}
@Override
@PreAuthorize("isAuthenticated()")
public CommentReadingCount getInterposedReadingCount(final String sessionKey, String username) {
public CommentReadingCount countRead(final String sessionKey, String username) {
final Session session = sessionRepository.findByKeyword(sessionKey);
if (session == null) {
throw new NotFoundException();
......@@ -104,7 +104,7 @@ public class CommentServiceImpl implements CommentService {
@Override
@PreAuthorize("isAuthenticated()")
public List<Comment> getInterposedQuestions(final String sessionKey, final int offset, final int limit) {
public List<Comment> getBySessionKey(final String sessionKey, final int offset, final int limit) {
final Session session = this.getSession(sessionKey);
final User user = getCurrentUser();
if (session.isCreator(user)) {
......@@ -116,9 +116,9 @@ public class CommentServiceImpl implements CommentService {
@Override
@PreAuthorize("isAuthenticated()")
public Comment readInterposedQuestion(final String commentId) {
public Comment getAndMarkRead(final String commentId) {
final User user = userService.getCurrentUser();
return this.readInterposedQuestionInternal(commentId, user);
return this.getAndMarkReadInternal(commentId, user);
}
/*
......@@ -126,7 +126,7 @@ public class CommentServiceImpl implements CommentService {
* TODO: Find a better way of doing this...
*/
@Override
public Comment readInterposedQuestionInternal(final String commentId, User user) {
public Comment getAndMarkReadInternal(final String commentId, User user) {
final Comment comment = commentRepository.findOne(commentId);
if (comment == null) {
throw new NotFoundException();
......
......@@ -30,17 +30,17 @@ import java.util.Map;
* The functionality the question service should provide.
*/
public interface ContentService {
Content saveQuestion(Content content);
Content save(Content content);
Content getQuestion(String id);
Content get(String id);
List<Content> getSkillQuestions(String sessionkey);
List<Content> getBySessionKey(String sessionkey);
int getSkillQuestionCount(String sessionkey);
int countBySessionKey(String sessionkey);
void deleteQuestion(String questionId);
void delete(String questionId);
void deleteAllQuestions(String sessionKeyword);
void deleteBySessionKey(String sessionKeyword);
void startNewPiRound(String questionId, User user);
......@@ -56,7 +56,7 @@ public interface ContentService {
Answer getMyAnswer(String questionId);
void readFreetextAnswer(String answerId, User user);
void getFreetextAnswerAndMarkRead(String answerId, User user);
List<Answer> getAnswers(String questionId, int piRound, int offset, int limit);
......@@ -64,17 +64,17 @@ public interface ContentService {
List<Answer> getAllAnswers(String questionId, int offset, int limit);
int getAnswerCount(String questionId);
int countAnswersByQuestionIdAndRound(String questionId);
int getAnswerCount(String questionId, int piRound);
int countAnswersByQuestionIdAndRound(String questionId, int piRound);
List<Answer> getFreetextAnswers(String questionId, int offset, int limit);
List<Answer> getFreetextAnswersByQuestionId(String questionId, int offset, int limit);
List<Answer> getMyAnswers(String sessionKey);
List<Answer> getMyAnswersBySessionKey(String sessionKey);
int getTotalAnswerCount(String sessionKey);
int countTotalAnswersBySessionKey(String sessionKey);
int getTotalAnswerCountByQuestion(String questionId);
int countTotalAnswersByQuestionId(String questionId);
Content update(Content content);
......@@ -94,13 +94,13 @@ public interface ContentService {
List<Content> getPreparationQuestions(String sessionkey);
int getLectureQuestionCount(String sessionkey);
int countLectureQuestions(String sessionkey);
int getFlashcardCount(String sessionkey);
int countFlashcards(String sessionkey);
int getPreparationQuestionCount(String sessionkey);
int countPreparationQuestions(String sessionkey);
Map<String, Object> getAnswerAndAbstentionCountInternal(String questionid);
Map<String, Object> countAnswersAndAbstentionsInternal(String questionid);
int countLectureQuestionAnswers(String sessionkey);
......@@ -136,7 +136,7 @@ public interface ContentService {
void deleteAllLectureAnswers(String sessionkey);
int getAbstentionAnswerCount(String questionId);
int countTotalAbstentionsByQuestionId(String questionId);
String getImage(String questionId, String answerId);
......
......@@ -23,7 +23,7 @@ public class EntityService<T extends Entity> {
}
@PreAuthorize("hasPermission(type, #id, 'read')")
public T findOne(final String id) {
public T get(final String id) {
return repository.findOne(id);
}
......
......@@ -26,17 +26,17 @@ import de.thm.arsnova.entities.User;
public interface FeedbackService {
void cleanFeedbackVotes();
void cleanFeedbackVotesInSession(String keyword, int cleanupFeedbackDelayInMins);
void cleanFeedbackVotesBySessionKey(String keyword, int cleanupFeedbackDelayInMins);
Feedback getFeedback(String keyword);
Feedback getBySessionKey(String keyword);
int getFeedbackCount(String keyword);
int countFeedbackBySessionKey(String keyword);
double getAverageFeedback(String sessionkey);
double calculateAverageFeedback(String sessionkey);
long getAverageFeedbackRounded(String sessionkey);
long calculateRoundedAverageFeedback(String sessionkey);
boolean saveFeedback(String keyword, int value, User user);
boolean save(String keyword, int value, User user);
Integer getMyFeedback(String keyword, User user);
Integer getBySessionKeyAndUser(String keyword, User user);
}
......@@ -66,7 +66,7 @@ public class FeedbackServiceImpl implements FeedbackService, ApplicationEventPub
@Override
@Scheduled(fixedDelay = DEFAULT_SCHEDULER_DELAY)
public void cleanFeedbackVotes() {
Map<Session, List<User>> deletedFeedbackOfUsersInSession = feedbackStorage.cleanFeedbackVotes(cleanupFeedbackDelay);
Map<Session, List<User>> deletedFeedbackOfUsersInSession = feedbackStorage.cleanVotes(cleanupFeedbackDelay);
/*
* mapping (Session -> Users) is not suitable for web sockets, because we want to sent all affected
* sessions to a single user in one go instead of sending multiple messages for each session. Hence,
......@@ -101,9 +101,9 @@ public class FeedbackServiceImpl implements FeedbackService, ApplicationEventPub
}
@Override
public void cleanFeedbackVotesInSession(final String keyword, final int cleanupFeedb