Commit 070d242d authored by Tom Käsler's avatar Tom Käsler

change packages according to java package guideline

parent 7503fcce
package de.thm.arsnova
import akka.http.scaladsl.server.Directives._
import api._
import de.thm.arsnova.api._
trait Routes extends ApiErrorHandler with UserApi with SessionApi with QuestionApi with FreetextAnswerApi with ChoiceAnswerApi
with CommentApi with FeaturesApi {
......
import models._
import services._
package de.thm.arsnova
import de.thm.arsnova.models._
import de.thm.arsnova.services._
import scala.util.{Success, Failure}
import scala.concurrent.ExecutionContext.Implicits.global
......
package de.thm.arsnova
import akka.actor.ActorSystem
import akka.event.{Logging, LoggingAdapter}
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import utils.{MigrationConfig, Config}
import de.thm.arsnova.utils.{MigrationConfig, Config}
import scala.concurrent.ExecutionContext
......
package api
package de.thm.arsnova.api
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.StatusCodes._
......
package api
package de.thm.arsnova.api
import services.{ChoiceAnswerService, FreetextAnswerService}
import de.thm.arsnova.services.{ChoiceAnswerService, FreetextAnswerService}
import de.thm.arsnova.models._
import de.thm.arsnova.hateoas.{ApiRoutes, ResourceAdapter, Link}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
import hateoas.{ApiRoutes, ResourceAdapter, Link}
/*
The API Interface regarding answers to choice questions (e.g. MC, SC).
*/
trait ChoiceAnswerApi {
// protocol for serializing data
import mappings.ChoiceAnswerJsonProtocol._
import de.thm.arsnova.mappings.ChoiceAnswerJsonProtocol._
// add the "top level" endpoint to ApiRoutes
ApiRoutes.addRoute("choiceAnswer", "choiceAnswer")
......
package api
package de.thm.arsnova.api
import services.CommentService
import de.thm.arsnova.services.CommentService
import de.thm.arsnova.models._
import de.thm.arsnova.hateoas.{ApiRoutes, ResourceAdapter, Link}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
import hateoas.{ApiRoutes, ResourceAdapter, Link}
/*
The API Interface regarding comments (formerly known as "interposed question"), made by participants.
*/
trait CommentApi {
// protocol for serializing data
import mappings.CommentJsonProtocol._
import de.thm.arsnova.mappings.CommentJsonProtocol._
// add the "top level" endpoint to ApiRoutes
ApiRoutes.addRoute("comment", "comment")
......
package api
package de.thm.arsnova.api
import services.FeaturesService
import de.thm.arsnova.services.FeaturesService
import de.thm.arsnova.models._
import de.thm.arsnova.hateoas.{ApiRoutes, ResourceAdapter, Link}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
import hateoas.{ApiRoutes, ResourceAdapter, Link}
/*
The API Interface regarding session features.
*/
trait FeaturesApi {
// protocol for serializing data
import mappings.FeatureJsonProtocol._
import de.thm.arsnova.mappings.FeatureJsonProtocol._
// add the "top level" endpoint to ApiRoutes
ApiRoutes.addRoute("features", "features")
......
package api
package de.thm.arsnova.api
import services.FreetextAnswerService
import de.thm.arsnova.services.FreetextAnswerService
import de.thm.arsnova.models._
import de.thm.arsnova.hateoas.{ApiRoutes, ResourceAdapter, Link}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
import hateoas.{ApiRoutes, ResourceAdapter, Link}
/*
The API Interface regarding answers for the question type "freetext".
*/
trait FreetextAnswerApi {
// protocol for serializing data
import mappings.FreetextAnswerJsonProtocol._
import de.thm.arsnova.mappings.FreetextAnswerJsonProtocol._
// add the "top level" endpoint to ApiRoutes
ApiRoutes.addRoute("freetextAnswer", "freetextAnswer")
......
package api
package de.thm.arsnova.api
import services.QuestionService
import de.thm.arsnova.services.QuestionService
import de.thm.arsnova.models._
import de.thm.arsnova.hateoas.{ApiRoutes, ResourceAdapter, Link}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
import hateoas.{ApiRoutes, ResourceAdapter, Link}
/*
The API Interface regarding questions.
*/
trait QuestionApi {
// protocol for serializing data
import mappings.QuestionJsonProtocol._
import de.thm.arsnova.mappings.QuestionJsonProtocol._
// add the "top level" endpoint to ApiRoutes
ApiRoutes.addRoute("question", "question")
......
package api
package de.thm.arsnova.api
import services.SessionService
import de.thm.arsnova.services.SessionService
import de.thm.arsnova.models._
import de.thm.arsnova.hateoas.{ApiRoutes, ResourceAdapter, Link}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
import hateoas.{ApiRoutes, ResourceAdapter, Link}
/*
The API Interface regarding sessions, the core component for arsnova.voting.
*/
trait SessionApi {
// protocol for serializing data
import mappings.SessionJsonProtocol._
import de.thm.arsnova.mappings.SessionJsonProtocol._
// add the "top level" endpoint to ApiRoutes
ApiRoutes.addRoute("session", "session")
......
package api
package de.thm.arsnova.api
import services.UserService
import de.thm.arsnova.services.UserService
import de.thm.arsnova.models._
import scala.concurrent.ExecutionContext.Implicits.global
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import models._
import akka.http.scaladsl.server.Directives._
import spray.json._
trait UserApi {
import mappings.UserJsonProtocol._
import de.thm.arsnova.mappings.UserJsonProtocol._
val userApi = pathPrefix("") {
pathEndOrSingleSlash {
......
package hateoas
package de.thm.arsnova.hateoas
/*
This object stores every "routepiece" (e.g. "session") to reduce redundancy in HATEOAS impl.
......
package hateoas
package de.thm.arsnova.hateoas
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
......
package hateoas
package de.thm.arsnova.hateoas
import spray.json._
class ResourceAdapter[T](jsonFormat: RootJsonFormat[T], modelLink: T => Seq[Link]) {
import hateoas.LinkJsonProtocol._
import de.thm.arsnova.hateoas.LinkJsonProtocol._
/** This function maps a sequence of models to a sequence of models with their links.
*
......
package mappings
package de.thm.arsnova.mappings
import models.AnswerOption
import de.thm.arsnova.models.AnswerOption
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object AnswerOptionJsonProtocol extends DefaultJsonProtocol {
......
package mappings
package de.thm.arsnova.mappings
import models.ChoiceAnswer
import de.thm.arsnova.models.ChoiceAnswer
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object ChoiceAnswerJsonProtocol extends DefaultJsonProtocol {
......
package mappings
package de.thm.arsnova.mappings
import models.Comment
import de.thm.arsnova.models.Comment
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object CommentJsonProtocol extends DefaultJsonProtocol {
implicit val commentFormat: RootJsonFormat[Comment] = jsonFormat7(Comment)
}
package mappings
package de.thm.arsnova.mappings
import models.Features
import de.thm.arsnova.models.Features
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object FeatureJsonProtocol extends DefaultJsonProtocol {
......
package mappings
package de.thm.arsnova.mappings
import models.FreetextAnswer
import de.thm.arsnova.models.FreetextAnswer
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object FreetextAnswerJsonProtocol extends DefaultJsonProtocol {
......
package mappings
package de.thm.arsnova.mappings
import models.{FormatAttributes, Question}
import de.thm.arsnova.models.{FormatAttributes, Question}
import spray.json._
object QuestionJsonProtocol extends DefaultJsonProtocol {
......
package mappings
package de.thm.arsnova.mappings
import models.Session
import de.thm.arsnova.models.Session
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object SessionJsonProtocol extends DefaultJsonProtocol {
......
package mappings
package de.thm.arsnova.mappings
import models.User
import de.thm.arsnova.models.User
import spray.json.{DefaultJsonProtocol, RootJsonFormat}
object UserJsonProtocol extends DefaultJsonProtocol {
......
package models
package de.thm.arsnova.models
case class FreetextAnswer(id: Option[FreetextAnswerId], questionId: QuestionId, sessionId: SessionId, subject: String, text: String)
case class ChoiceAnswer(id: Option[ChoiceAnswerId], questionId: QuestionId, sessionId: SessionId, answerOptionId: AnswerOptionId)
package models
package de.thm.arsnova.models
case class AnswerOption(id: Option[AnswerOptionId], questionId: Option[QuestionId], correct: Boolean, text: String, value: Int)
package models
package de.thm.arsnova.models
case class Comment(id: Option[CommentId], userId: UserId, sessionId: SessionId, isRead: Boolean, subject: String, text: String, createdAt: String)
package de.thm.arsnova.models
case class Features(
id: Option[FeaturesId],
sessionId: SessionId,
slides: Boolean,
flashcards: Boolean,
peerGrading: Boolean,
peerInstruction: Boolean,
comments: Boolean,
tileView: Boolean,
jitt: Boolean,
learningProgress: Boolean,
feedback: Boolean,
liveQuestions: Boolean
)
\ No newline at end of file
package models
package de.thm.arsnova.models
case class FormatAttributes(attributes: Map[String, String])
......
package models
package de.thm.arsnova.models
case class Session(id: Option[SessionId], key: String, userId: UserId, title: String, shortTitle: String)
package models
package de.thm.arsnova.models
case class User(id: Option[UserId], userName: String, password: String)
package models.definitions
package de.thm.arsnova.models.definitions
import models.{AnswerOption, AnswerOptionId, QuestionId}
import de.thm.arsnova.models.{AnswerOption, AnswerOptionId, QuestionId, Question}
import slick.driver.MySQLDriver.api._
import models.Question
import slick.lifted.ForeignKeyQuery
class AnswerOptionsTable(tag: Tag) extends Table[AnswerOption](tag, "answer_options") {
......
package models.definitions
package de.thm.arsnova.models.definitions
import models.{ChoiceAnswer, ChoiceAnswerId, QuestionId, SessionId, AnswerOptionId}
import de.thm.arsnova.models.{ChoiceAnswer, ChoiceAnswerId, QuestionId, SessionId, AnswerOptionId}
import slick.driver.MySQLDriver.api._
class ChoiceAnswersTable(tag: Tag) extends Table[ChoiceAnswer](tag, "choice_answers") {
......
package models.definitions
package de.thm.arsnova.models.definitions
import models.{CommentId, SessionId, Session, UserId, User, Comment}
import de.thm.arsnova.models.{CommentId, SessionId, Session, UserId, User, Comment}
import slick.driver.MySQLDriver.api._
import slick.lifted.ForeignKeyQuery
import java.sql.Timestamp
......
package models.definitions
package de.thm.arsnova.models.definitions
import models.{FeaturesId, Features, SessionId, Session}
import de.thm.arsnova.models.{FeaturesId, Features, SessionId, Session}
import slick.driver.MySQLDriver.api._
import slick.lifted.ForeignKeyQuery
......
package models.definitions
package de.thm.arsnova.models.definitions
import models.{FreetextAnswer, FreetextAnswerId, QuestionId, SessionId}
import de.thm.arsnova.models.{FreetextAnswer, FreetextAnswerId, QuestionId, SessionId, Question, Session}
import slick.driver.MySQLDriver.api._
import models.{Question, Session}
import slick.lifted.ForeignKeyQuery
class FreetextAnswersTable(tag: Tag) extends Table[FreetextAnswer](tag, "freetext_answers") {
......
package models.definitions
package de.thm.arsnova.models.definitions
import models._
import de.thm.arsnova.models._
import slick.driver.MySQLDriver.api._
import slick.lifted.ForeignKeyQuery
import models.Session
import spray.json._
class QuestionsTable(tag: Tag) extends Table[Question](tag, "questions"){
import mappings.QuestionJsonProtocol._
import de.thm.arsnova.mappings.QuestionJsonProtocol._
def id: Rep[QuestionId] = column[QuestionId]("id", O.PrimaryKey, O.AutoInc)
def sessionId: Rep[Long] = column[Long]("session_id")
def subject: Rep[String] = column[String]("subject")
......@@ -40,6 +39,6 @@ class QuestionsTable(tag: Tag) extends Table[Question](tag, "questions"){
Option[(Option[QuestionId], SessionId, String, String, String, String, String)]
})
def session: ForeignKeyQuery[SessionsTable, Session] = foreignKey("question_session_fk", sessionId, TableQuery[SessionsTable])(_.id)
def session: ForeignKeyQuery[SessionsTable, de.thm.arsnova.models.Session] = foreignKey("question_session_fk", sessionId, TableQuery[SessionsTable])(_.id)
}
package models.definitions
package de.thm.arsnova.models.definitions
import models.{SessionId, UserId, Session}
import de.thm.arsnova.models.{SessionId, UserId, Session, User}
import slick.driver.MySQLDriver.api._
import slick.lifted.ForeignKeyQuery
import models.User
class SessionsTable(tag: Tag) extends Table[Session](tag, "sessions"){
def id: Rep[SessionId] = column[SessionId]("id", O.PrimaryKey, O.AutoInc)
......
package models.definitions
package de.thm.arsnova.models.definitions
import models.{UserId, User}
import de.thm.arsnova.models.{UserId, User}
import slick.driver.MySQLDriver.api._
class UsersTable(tag: Tag) extends Table[User](tag, "users"){
......
package de.thm.arsnova
package object models {
type UserId = Long
type SessionId = Long
......
package services
package de.thm.arsnova.services
import models._
import de.thm.arsnova.models._
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
......
package services
package de.thm.arsnova.services
import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer11_OmitComments
import models.ChoiceAnswer
import models.definitions._
import de.thm.arsnova.models.ChoiceAnswer
import de.thm.arsnova.models.definitions._
import slick.dbio.{Effect, NoStream}
import slick.lifted.TableQuery
import slick.sql.{FixedSqlAction, FixedSqlStreamingAction, SqlAction}
import utils.DatabaseConfig
import de.thm.arsnova.utils.DatabaseConfig
import scala.concurrent.Future
......
package services
package de.thm.arsnova.services
import models._
import de.thm.arsnova.models._
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
......
package services
package de.thm.arsnova.services
import models.{Comment, CommentId, SessionId}
import de.thm.arsnova.models.{Comment, CommentId, SessionId}
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
......
package services
package de.thm.arsnova.services
import models._
import de.thm.arsnova.models._
import slick.driver.MySQLDriver.api._
import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.ExecutionContext.Implicits.global
......
package services
package de.thm.arsnova.services
import models._
import de.thm.arsnova.models._
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
......
package services
package de.thm.arsnova.services
import models._
import de.thm.arsnova.models._
import slick.driver.MySQLDriver.api._
import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.ExecutionContext.Implicits.global
......
package services
package de.thm.arsnova.services
import models.{UserId, Session, SessionId}
import de.thm.arsnova.models.{UserId, Session, SessionId}
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
......
package services
package de.thm.arsnova.services
import models.{UserId, User}
import de.thm.arsnova.models.{UserId, User}
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
......
package utils
package de.thm.arsnova.utils
import com.typesafe.config.ConfigFactory
......