From 55358aecf6ef33e1641bcd20b5208502056bafc6 Mon Sep 17 00:00:00 2001
From: Paul-Christian Volkmer <paul-christian.volkmer@mni.thm.de>
Date: Wed, 17 Oct 2012 14:51:33 +0200
Subject: [PATCH] Removed wrong SessionController class that was previously
 moved

---
 .../de/thm/arsnova/SessionController.java     | 141 ------------------
 1 file changed, 141 deletions(-)
 delete mode 100644 src/main/java/de/thm/arsnova/SessionController.java

diff --git a/src/main/java/de/thm/arsnova/SessionController.java b/src/main/java/de/thm/arsnova/SessionController.java
deleted file mode 100644
index 7f16f4fc4..000000000
--- a/src/main/java/de/thm/arsnova/SessionController.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2012 THM webMedia
- * 
- * This file is part of ARSnova.
- *
- * ARSnova is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * ARSnova is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package de.thm.arsnova;
-
-import java.util.List;
-import java.util.UUID;
-
-import javax.servlet.http.HttpServletResponse;
-
-import net.sf.json.JSONObject;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import de.thm.arsnova.entities.Session;
-import de.thm.arsnova.entities.User;
-import de.thm.arsnova.services.ISessionService;
-import de.thm.arsnova.services.IUserService;
-import de.thm.arsnova.socket.ARSnovaSocketIOServer;
-import de.thm.arsnova.socket.message.Question;
-
-@Controller
-public class SessionController {
-	
-	public static final Logger logger = LoggerFactory.getLogger(SessionController.class);
-	
-	@Autowired
-	ISessionService sessionService;
-	
-	@Autowired
-	IUserService userService;
-	
-	@Autowired
-	ARSnovaSocketIOServer server;
-	
-	@RequestMapping(method = RequestMethod.POST, value = "/authorize")
-	public void authorize(@RequestBody Object sessionObject, HttpServletResponse response) {
-		String sessionkey = (String) JSONObject.fromObject(sessionObject).get("session");
-		if(sessionkey == null) {
-			return;
-		}		
-		User u = userService.getUser(SecurityContextHolder.getContext().getAuthentication());
-		logger.info("authorize session: " + sessionkey + ", user is:  " + u);
-		response.setStatus(u != null ? HttpStatus.CREATED.value() : HttpStatus.UNAUTHORIZED.value());
-		server.authorize(UUID.fromString(sessionkey), u);
-	}
-	
-	@RequestMapping(value="/session/{sessionkey}", method=RequestMethod.GET)
-	@ResponseBody
-	public Session getSession(@PathVariable String sessionkey, HttpServletResponse response) {
-		Session session = sessionService.getSession(sessionkey);
-		if (session != null) return session;
-		
-		response.setStatus(HttpStatus.NOT_FOUND.value());
-		return null;
-	}
-	
-	@RequestMapping(value="/session", method=RequestMethod.POST)
-	@ResponseBody
-	public Session postNewSession(@RequestBody Session session, HttpServletResponse response) {
-		Session newSession = sessionService.saveSession(session);
-		if (session != null) {
-			response.setStatus(HttpStatus.CREATED.value());
-			return newSession;
-		}
-
-		response.setStatus(HttpStatus.SERVICE_UNAVAILABLE.value());
-		return null;
-	}
-	
-	@RequestMapping(value="/mySessions", method=RequestMethod.GET)
-	@ResponseBody
-	public List<Session> getMySession(HttpServletResponse response) {
-		String username = userService.getUser(SecurityContextHolder.getContext().getAuthentication()).getUsername();
-		if(username == null) {
-			response.setStatus(HttpStatus.NOT_FOUND.value());
-			return null;
-		}
-		List<Session> sessions = sessionService.getMySessions(username);
-		if (sessions == null || sessions.isEmpty()) {
-			response.setStatus(HttpStatus.NOT_FOUND.value());
-			return null;
-		}
-		return sessions;
-	}
-	
-	@RequestMapping(value="/getSkillQuestions/{sessionkey}", method=RequestMethod.GET)
-	@ResponseBody
-	public List<Question> getSkillQuestions(@PathVariable String sessionkey, @RequestParam(value="sort", required=false) String sort, HttpServletResponse response) {
-		List<Question> questions = sessionService.getSkillQuestions(sessionkey, sort);
-		if(questions == null || questions.isEmpty()) {
-			response.setStatus(HttpStatus.NOT_FOUND.value());
-			return null;
-		}
-		return questions;
-	}
-	
-	@RequestMapping(value="/getSkillQuestionCount/{sessionkey}", method=RequestMethod.GET)
-	@ResponseBody
-	public int getSkillQuestionCount(@PathVariable String sessionkey, HttpServletResponse response) {
-		return sessionService.getSkillQuestionCount(sessionkey);
-	}
-	
-	
-	@RequestMapping(value="/socketurl", method=RequestMethod.GET)
-	@ResponseBody
-	public String getSocketUrl() {
-		StringBuilder url = new StringBuilder();
-		
-		url.append(server.isUseSSL() ? "https://" : "http://");
-		url.append(server.getHostIp() + ":" + server.getPortNumber());
-		
-		return url.toString();
-	}
-}
-- 
GitLab