Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. package controllers;
  2.  
  3. import java.util.List;
  4. import menu.CrearIndicador;
  5.  
  6. import estructura.Indicador;
  7. import persistencia.Persistencia;
  8. import spark.*;
  9.  
  10.  
  11. public class IndicadorController implements Persistencia {
  12.  
  13.     public static List<Indicador> verIndicadores(String user) {
  14.         return repositorio.indicadores().allIndicadores(user);
  15.     }
  16.    
  17.     public static Indicador crearIndicador(String nombre,String expresion, String usuario){
  18.         //TODO mover a un lugar mejor el metodo del menu?
  19.         return menu.CrearIndicadorWeb.crearIndicador(nombre,expresion,usuario);
  20.     }
  21.    
  22.     public void aplicarIndicador(){
  23.         //TODO sacar este metodo de menu?
  24.         //TODO probablemente rompa como el allIndicadores y debe llevar un null dentro?
  25.         menu.AplicarIndicador.aplicarIndicadoresAEmpresa();
  26.     }
  27.  
  28.     public static TemplateViewRoute renderVerIndicadores = (Request req, Response resp) -> new ModelAndView(verIndicadores(req.cookie("user")),"lista_indicadores.hbs");
  29.  
  30.     public static TemplateViewRoute serveCrearIndicador = (Request req, Response resp) -> new ModelAndView(null,"crear_indicador.hbs");
  31.  
  32.     public static Route handleCrearIndicadorPost = (Request req, Response resp) -> {
  33.         String nombre = req.queryParams("nombre");
  34.         String expresion = req.queryParams("expresion");
  35.         String user = req.cookie("user");
  36.        
  37.         return crearIndicador(nombre,expresion,user);  
  38.     };
  39.    
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement