// Path: src/main/java/es/urjc/etsii/mtenrero/SecurityConfiguration.java
// @Configuration
// @EnableGlobalMethodSecurity(securedEnabled = true)
// public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
// 
//     static final String MANAGER = "MANAGER";
//     static final String CLIENT = "CLIENT";
// 
//     @Autowired
//     public UserRepositoryAuthenticationProvider authenticationProvider;
// 
// 
//     @Override
//     protected void configure(HttpSecurity http) throws Exception {
// 
//         // Login form configuration
//         http.formLogin().loginPage("/");
//         http.formLogin().usernameParameter("id");
//         http.formLogin().passwordParameter("password");
//         http.formLogin().defaultSuccessUrl("/");
// 
//         http.formLogin().failureUrl("/");
// 
//         // Logout
//         http.logout().logoutUrl("/logout"); http.logout().logoutSuccessUrl("/");
// 
//         // Public routes
//         http.authorizeRequests().antMatchers("/").permitAll();
//         http.authorizeRequests().antMatchers("/resources/**").permitAll();
// 
//         // Dashboard access (Veterinary management)
//         http.authorizeRequests().antMatchers("/dashboard/**").hasAnyRole("MANAGER");
// 
// 
//         // Disable CSRF by the moment
//         http.csrf().disable();
// 
//     }
// 
//     @Override
//     protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//         // Database authentication provider
//         auth.authenticationProvider(authenticationProvider);
//         // Users
// 
//     }
// }
// 
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
// 
// 	@Autowired
// 	static
// 	ClientRepository clientRepository;
// 
//     @Autowired
//     static
//     AppointmentRepository appointmentRepository;
// 
// 
// 
//     @Override
// 	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// 		return application.sources(VetmanagerApplication.class);
// 	}
// 
// 	public static String appName = "VetManager";
// 
// 	public static void main(String[] args) {
// 		SpringApplication.run(VetmanagerApplication.class, args);
// 
// 		HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// 			public boolean verify(String hostname, SSLSession session) {
// 				return true;
// 			}
// 		});
// 
// 		
// 		ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// 		ses.scheduleAtFixedRate(new Runnable() {
// 			@Override
// 			public void run() {
// 			    System.out.print("HOOOOLA");
// 				List<Appointment> appointments = 			    appointmentRepository.findAll();
// 
// //                for (Appointment appointment : appointments) {
// //                    LocalDate dateBefore;
// //                    LocalDate dateAfter appointment.g;
// //                    long daysBetween = HOURS.between(dateBefore, dateAfter);
// //                    //if (client.getHoursBeforeNotification())
// //                }
// 
// 
//             }
// 		}, 0, 1, TimeUnit.DAYS);
// 	}
// }


import es.urjc.etsii.mtenrero.SecurityConfiguration;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
package es.urjc.etsii.mtenrero.Controllers;




/**
 * Created by mtenrero on 28/01/2017.
 */
@Controller
public class DashboardController {

    @RequestMapping("/dashboard")
    public String getLanding(Model model) {
// Path: src/main/java/es/urjc/etsii/mtenrero/SecurityConfiguration.java
// @Configuration
// @EnableGlobalMethodSecurity(securedEnabled = true)
// public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
// 
//     static final String MANAGER = "MANAGER";
//     static final String CLIENT = "CLIENT";
// 
//     @Autowired
//     public UserRepositoryAuthenticationProvider authenticationProvider;
// 
// 
//     @Override
//     protected void configure(HttpSecurity http) throws Exception {
// 
//         // Login form configuration
//         http.formLogin().loginPage("/");
//         http.formLogin().usernameParameter("id");
//         http.formLogin().passwordParameter("password");
//         http.formLogin().defaultSuccessUrl("/");
// 
//         http.formLogin().failureUrl("/");
// 
//         // Logout
//         http.logout().logoutUrl("/logout"); http.logout().logoutSuccessUrl("/");
// 
//         // Public routes
//         http.authorizeRequests().antMatchers("/").permitAll();
//         http.authorizeRequests().antMatchers("/resources/**").permitAll();
// 
//         // Dashboard access (Veterinary management)
//         http.authorizeRequests().antMatchers("/dashboard/**").hasAnyRole("MANAGER");
// 
// 
//         // Disable CSRF by the moment
//         http.csrf().disable();
// 
//     }
// 
//     @Override
//     protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//         // Database authentication provider
//         auth.authenticationProvider(authenticationProvider);
//         // Users
// 
//     }
// }
// 
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
// 
// 	@Autowired
// 	static
// 	ClientRepository clientRepository;
// 
//     @Autowired
//     static
//     AppointmentRepository appointmentRepository;
// 
// 
// 
//     @Override
// 	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// 		return application.sources(VetmanagerApplication.class);
// 	}
// 
// 	public static String appName = "VetManager";
// 
// 	public static void main(String[] args) {
// 		SpringApplication.run(VetmanagerApplication.class, args);
// 
// 		HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// 			public boolean verify(String hostname, SSLSession session) {
// 				return true;
// 			}
// 		});
// 
// 		
// 		ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// 		ses.scheduleAtFixedRate(new Runnable() {
// 			@Override
// 			public void run() {
// 			    System.out.print("HOOOOLA");
// 				List<Appointment> appointments = 			    appointmentRepository.findAll();
// 
// //                for (Appointment appointment : appointments) {
// //                    LocalDate dateBefore;
// //                    LocalDate dateAfter appointment.g;
// //                    long daysBetween = HOURS.between(dateBefore, dateAfter);
// //                    //if (client.getHoursBeforeNotification())
// //                }
// 
// 
//             }
// 		}, 0, 1, TimeUnit.DAYS);
// 	}
// }


// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/DashboardController.java
import es.urjc.etsii.mtenrero.SecurityConfiguration;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;

package es.urjc.etsii.mtenrero.Controllers;




/**
 * Created by mtenrero on 28/01/2017.
 */
@Controller
public class DashboardController {

    @RequestMapping("/dashboard")
    public String getLanding(Model model) {
        model.addAttribute("title", VetmanagerApplication.appName + ": Dashboard");