Skip to content
Snippets Groups Projects
Commit 8d0f236a authored by Christoph Thelen's avatar Christoph Thelen
Browse files

Fixed checkstyle errors

parent 4a536ff5
No related merge requests found
......@@ -105,7 +105,7 @@ public class SessionController extends AbstractController {
public final List<Session> getSessions(
@RequestParam(value = "ownedonly", defaultValue = "false") final boolean ownedOnly,
@RequestParam(value = "visitedonly", defaultValue = "false") final boolean visitedOnly,
@RequestParam(value="sortby", defaultValue="name") final String sortby,
@RequestParam(value = "sortby", defaultValue = "name") final String sortby,
final HttpServletResponse response
) {
User user = userService.getCurrentUser();
......@@ -114,7 +114,6 @@ public class SessionController extends AbstractController {
/* TODO: Could @Authorized annotation be used instead of this check? */
if (null == user) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
return null;
}
......@@ -125,12 +124,12 @@ public class SessionController extends AbstractController {
sessions = sessionService.getMyVisitedSessions(userService.getCurrentUser());
} else {
response.setStatus(HttpStatus.NOT_IMPLEMENTED.value());
return null;
}
if (sessions == null || sessions.isEmpty()) {
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
return null;
}
if (sortby != null && sortby.equals("shortname")) {
......
......@@ -650,11 +650,10 @@ public class CouchDBDao implements IDatabaseDao {
JSONObject json = results.getJSONArray("rows").optJSONObject(0).optJSONObject("value");
loggedIn = (LoggedIn) JSONObject.toBean(json, LoggedIn.class);
JSONArray vs = json.optJSONArray("visitedSessions");
if(vs != null) {
Collection<VisitedSession> visitedSessions = JSONArray.toCollection(vs,
VisitedSession.class);
loggedIn.setVisitedSessions(new ArrayList<VisitedSession>(visitedSessions));
}
if (vs != null) {
Collection<VisitedSession> visitedSessions = JSONArray.toCollection(vs, VisitedSession.class);
loggedIn.setVisitedSessions(new ArrayList<VisitedSession>(visitedSessions));
}
}
loggedIn.setUser(user.getUsername());
......@@ -677,10 +676,9 @@ public class CouchDBDao implements IDatabaseDao {
LoggedIn l = (LoggedIn) JSONObject.toBean(doc.getJSONObject(), LoggedIn.class);
JSONArray vs = doc.getJSONObject().optJSONArray("visitedSessions");
if(vs != null) {
Collection<VisitedSession> visitedSessions = JSONArray.toCollection(vs,
VisitedSession.class);
l.setVisitedSessions(new ArrayList<VisitedSession>(visitedSessions));
if (vs != null) {
Collection<VisitedSession> visitedSessions = JSONArray.toCollection(vs, VisitedSession.class);
l.setVisitedSessions(new ArrayList<VisitedSession>(visitedSessions));
}
return l;
} catch (UnsupportedEncodingException e) {
......
......@@ -64,7 +64,7 @@ public class SessionService implements ISessionService {
if (connectorClient != null && session.isCourseSession()) {
String courseid = session.getCourseId();
if (! connectorClient.getMembership(userService.getCurrentUser().getUsername(), courseid).isMember()) {
if (!connectorClient.getMembership(userService.getCurrentUser().getUsername(), courseid).isMember()) {
throw new ForbiddenException();
}
}
......@@ -107,7 +107,7 @@ public class SessionService implements ISessionService {
@Authenticated
public final Session saveSession(final Session session) {
if (connectorClient != null && session.getCourseId() != null) {
if (! connectorClient.getMembership(
if (!connectorClient.getMembership(
userService.getCurrentUser().getUsername(), session.getCourseId()).isMember()
) {
throw new ForbiddenException();
......@@ -156,7 +156,7 @@ public class SessionService implements ISessionService {
return databaseDao.countActiveUsers(session, since);
}
public static class SessionNameComperator implements Comparator<Session>, Serializable{
public static class SessionNameComperator implements Comparator<Session>, Serializable {
private static final long serialVersionUID = 1L;
@Override
......
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