16. //Implementación del decorador //Los métodos omitidos deben sobreescribirse con llamadas a ccl public class SpringDecorator extends ContextLoaderListener { //Variable encapsulada del entorno private ContextLoaderListener cll; //App Web de Spring private static WebApplicationContext wac; public SpringDecorator() { cll = new ContextLoaderListener(); } //Crea el objeto interno y guarda el WebApp public void contextInitialized(ServletContextEvent arg0) { try { cll.contextInitialized(arg0); wac = WebApplicationContextUtils.getWebApplicationContext (arg0.getServletContext()); } catch(Exception e) { e.printStackTrace(); } } //Ejemplo de llamada interna public ContextLoader getContextLoader() { return cll.getContextLoader(); } public static WebApplicationContext getSpringContext() { return wac; } }
17.
18.
19.
20. Implementación Básica public interface BasicDao { public boolean agregar(Object o); public boolean editar(Object o); public boolean borrar(Object o); //Buscar duplicados antes de agregar public boolean hayRepetido(Object o); //Buscar dependientes antes de borrar public boolean hayDependiente(Object o); public List cargar(); public List cargarUno(Serializable id); public List cargarCondicion(String prop, Object val); }