Fixed formatting.

This commit is contained in:
neviyn 2018-10-09 16:39:44 +01:00
parent 2013c4b84b
commit 185f258b6f
5 changed files with 149 additions and 149 deletions

View File

@ -22,7 +22,7 @@ data class SimpleObservation(
val observed: String, val observed: String,
val whom: String, val whom: String,
val entries: List<Entry> val entries: List<Entry>
){ ) {
constructor(observation: Observation) : this(observation.date, observation.type, constructor(observation: Observation) : this(observation.date, observation.type,
observation.observed, observation.whom, observation.entries) observation.observed, observation.whom, observation.entries)
} }
@ -56,6 +56,6 @@ data class ChartDataset(
val data: List<Double>, val data: List<Double>,
val fill: Boolean = false, val fill: Boolean = false,
val lineTension: Double = 0.1 val lineTension: Double = 0.1
){ ) {
constructor(label: String, color: String, data: List<Double>): this(label, color, color, data) constructor(label: String, color: String, data: List<Double>) : this(label, color, color, data)
} }

View File

@ -27,7 +27,8 @@ data class Site(
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0, val id: Long = 0,
val name: String){ val name: String
) {
@OneToMany(fetch = FetchType.LAZY) @OneToMany(fetch = FetchType.LAZY)
val tutors: MutableSet<Tutor> = mutableSetOf() val tutors: MutableSet<Tutor> = mutableSetOf()
} }
@ -43,10 +44,10 @@ data class Tutor(
val name: String, val name: String,
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
val site: Site val site: Site
){ ) {
@ManyToMany @ManyToMany
@JoinTable(name = "tutor_observations", @JoinTable(name = "tutor_observations",
joinColumns = [JoinColumn(name =" tutor_id", referencedColumnName = "id")], joinColumns = [JoinColumn(name = " tutor_id", referencedColumnName = "id")],
inverseJoinColumns = [JoinColumn(name = "observation_id", referencedColumnName = "id")]) inverseJoinColumns = [JoinColumn(name = "observation_id", referencedColumnName = "id")])
val observations: MutableSet<Observation> = mutableSetOf() val observations: MutableSet<Observation> = mutableSetOf()
} }

View File

@ -6,13 +6,14 @@ import org.springframework.data.repository.CrudRepository
import org.springframework.stereotype.Repository import org.springframework.stereotype.Repository
@Repository @Repository
interface SiteRepository: CrudRepository<Site, Long> interface SiteRepository : CrudRepository<Site, Long>
@Repository @Repository
interface TutorRepository: CrudRepository<Tutor, Long> interface TutorRepository : CrudRepository<Tutor, Long>
@Repository @Repository
interface ObservationRepository: CrudRepository<Observation, Long>, JpaSpecificationExecutor<Observation> { interface ObservationRepository : CrudRepository<Observation, Long>, JpaSpecificationExecutor<Observation> {
fun findBySiteAndDateBetween(site: Site, startDate: LocalDate, endDate: LocalDate): List<Observation> fun findBySiteAndDateBetween(site: Site, startDate: LocalDate, endDate: LocalDate): List<Observation>
fun findByTutorsAndDateBetween(tutor: Tutor, startDate: LocalDate, endDate: LocalDate): List<Observation> fun findByTutorsAndDateBetween(tutor: Tutor, startDate: LocalDate, endDate: LocalDate): List<Observation>

View File

@ -19,7 +19,6 @@ import javax.servlet.ServletException
import javax.servlet.http.HttpServletRequest import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse import javax.servlet.http.HttpServletResponse
@Configuration @Configuration
@EnableWebSecurity @EnableWebSecurity
class CustomWebSecurityConfigurerAdapter : WebSecurityConfigurerAdapter() { class CustomWebSecurityConfigurerAdapter : WebSecurityConfigurerAdapter() {
@ -54,11 +53,10 @@ class CustomWebSecurityConfigurerAdapter : WebSecurityConfigurerAdapter() {
} }
@Component @Component
class MyBasicAuthenticationEntryPoint: BasicAuthenticationEntryPoint() { class MyBasicAuthenticationEntryPoint : BasicAuthenticationEntryPoint() {
@Throws(IOException::class, ServletException::class) @Throws(IOException::class, ServletException::class)
override fun commence override fun commence(request: HttpServletRequest, response: HttpServletResponse, authEx: AuthenticationException) {
(request: HttpServletRequest, response: HttpServletResponse, authEx: AuthenticationException) {
response.addHeader("WWW-Authenticate", "Basic realm=\"$realmName\"") response.addHeader("WWW-Authenticate", "Basic realm=\"$realmName\"")
response.status = HttpServletResponse.SC_UNAUTHORIZED response.status = HttpServletResponse.SC_UNAUTHORIZED
response.writer.println("HTTP Status 401 - " + authEx.message) response.writer.println("HTTP Status 401 - " + authEx.message)