package hr.kapsch.javacro.actuator;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.actuate.endpoint.AbstractEndpoint;
import org.springframework.stereotype.Component;

import hr.kapsch.javacro.actuator.JavaCroEndpoint.Lecture;

@Component
public class JavaCroEndpoint extends AbstractEndpoint<List<Lecture>> {

	private static final List<Lecture> LECTURES = new ArrayList<>(3);

	static {
		LECTURES.add(new Lecture("Vedran Pavić", "Managing user's session with Spring Session",
				LocalDateTime.of(2016, 5, 19, 12, 0), "Hall D", 30));
		LECTURES.add(new Lecture("Vjeran Marčinko", "Demand-oriented web architecture",
				LocalDateTime.of(2016, 5, 19, 12, 40), "Hall C", 30));
		LECTURES.add(new Lecture("Vedran Pavić", "Meeting non-functional requirements with Spring Boot Actuator",
				LocalDateTime.of(2016, 5, 19, 18, 0), "Hall A", 30));
	}

	public JavaCroEndpoint() {
		super("javacro");
	}

	@Override
	public List<Lecture> invoke() {
		return LECTURES;
	}

	public static class Lecture {

		private String speaker;
		private String title;
		private LocalDateTime dateTime;
		private String room;
		private int duration;

		public Lecture(String speaker, String title, LocalDateTime dateTime, String room, int duration) {
			this.speaker = speaker;
			this.title = title;
			this.dateTime = dateTime;
			this.room = room;
			this.duration = duration;
		}

		public String getSpeaker() {
			return speaker;
		}

		public String getTitle() {
			return title;
		}

		public LocalDateTime getDateTime() {
			return dateTime;
		}

		public String getRoom() {
			return room;
		}

		public int getDuration() {
			return duration;
		}

	}

}

@@ -46,25 +46,44 @@
 ava.
+u
 ti
-me.LocalDateTim
+l.ArrayList;%0Aimport java.util.Dat
 e;%0Ai
@@ -94,33 +94,41 @@
 t java.util.
-ArrayList
+GregorianCalendar
 ;%0Aimport jav
@@ -573,32 +573,37 @@
 n%22,%0A%09%09%09%09
-LocalDateTime.of
+new GregorianCalendar
 (2016, 5
@@ -610,24 +610,34 @@
 , 19, 12, 0)
+.getTime()
 , %22Hall D%22, 
@@ -728,32 +728,37 @@
 e%22,%0A%09%09%09%09
-LocalDateTime.of
+new GregorianCalendar
 (2016, 5
@@ -770,16 +770,26 @@
  12, 40)
+.getTime()
 , %22Hall 
@@ -914,24 +914,29 @@
 %09%09%09%09
-LocalDateTime.of
+new GregorianCalendar
 (201
@@ -951,16 +951,26 @@
 , 18, 0)
+.getTime()
 , %22Hall 
@@ -1103,23 +1103,16 @@
 S;%0A%09%7D%0A%0A%09
-public 
 static c
@@ -1187,28 +1187,19 @@
 private 
-LocalDateTim
+Dat
 e dateTi
@@ -1252,23 +1252,16 @@
 ion;%0A%0A%09%09
-public 
 Lecture(
@@ -1290,28 +1290,19 @@
  title, 
-LocalDateTim
+Dat
 e dateTi
@@ -1587,20 +1587,11 @@
 lic 
-LocalDateTim
+Dat
 e ge

Refactor demo endpoint