Skip to content
Snippets Groups Projects
Commit e9c88b90 authored by Mauricio's avatar Mauricio
Browse files

Primer commit

parent bacc3087
No related branches found
No related tags found
No related merge requests found
Pipeline #5864 failed
Showing
with 27 additions and 104 deletions
......@@ -17,26 +17,23 @@ import TSEP1E01.TSEP1E01.model.Noticia;
@RequestScoped
public class NoticiaListProduce {
// @Inject
// private NoticiaRepository NoticiaRepository;
private List<Noticia> Noticia;
private List<Noticia> Noticia;
// @Named provides access the return value via the EL variable name "members" in the UI (e.g.,
// Facelets or JSP view)
@Produces
@Produces
@Named
public List<Noticia> getNoticias() {
return Noticia;
}
public void onNoticiaListChanged(@Observes(notifyObserver = Reception.IF_EXISTS) final Noticia Noticia) throws Exception {
retrieveAllNoticiasOrderedByName();
}
@Inject
@PostConstruct
public void retrieveAllNoticiasOrderedByName() throws Exception {
List<Noticia> list = new ArrayList<Noticia>(NoticiaRepository.getInstancia().findAllOrderedByName().values());
Noticia = list;
}
}
......@@ -22,16 +22,13 @@ public class NoticiaRepository implements NoticiaRepositoryLocal,NoticiaReposito
private Map<String,Noticia> mapNoticia;
//private Map<String,Publicacion> mapPublicacion/////;
//private PublicacionRepository Prespository;
private static NoticiaRepository instancia = null;
public Noticia findById(String id) {
return mapNoticia.get(id);
// return em.find(Noticia.class, id);
}
}
public static NoticiaRepository getInstancia() throws Exception {
if(instancia == null) {
......@@ -70,20 +67,17 @@ public class NoticiaRepository implements NoticiaRepositoryLocal,NoticiaReposito
public void cargarDatos() throws Exception {
//Cargar Noticias
Noticia noticia0 = new Noticia("0", "El Grupo PRISA completa la ampliacion de capital con una demanda 20 veces superior", "La compania ha informado de que se ha suscrito el total de las 150.243.297 acciones ofrecidas, por importe efectivo de 199.823.585 euros");
Noticia noticia1 = new Noticia("1", "Francisco Reynes avala los planes energeticos del Gobierno socialista", "Naturgy espera obtener 1.400 millones de beneficio este anio y elevar el dividendo un 5%");
Noticia noticia2 = new Noticia("2", "Guerra de comunicados en Dia: Letterone acusa al consejo de enganiar a los accionistas", "El fondo del magnate ruso Mijail Fridman emite una nueva nota en la que responde a las criticas vertidas por el consejo contra sus planes");
Noticia noticia3 = new Noticia("3", "Letterone exige al consejo de Dia mas informacion sobre su pacto con la banca", "La cadena de supermercados reitera a los accionistas que su plan estrategico es el \"unico viable\"");
Noticia noticia4 = new Noticia("4", "Cellnex ampliara capital en 1.200 millones para crecer con adquisiciones", "La empresa de infraestructuras de telecomunicaciones emitira nuevas acciones por valor de cerca de un tercio de su capital");
Noticia noticia5 = new Noticia("5", "Dia propone una ampliacion de capital por 600 millones", "La cadena de supermercados celebrara una junta de accionistas el proximo 20 de marzo");
Noticia noticia6 = new Noticia("6", "Bankia sube un 5% el dividendo, lo que elevara las ayudas devueltas al Estado", "La entidad distribuira en conjunto 357 millones de euros entre los accionistas, con 0,115 euros abonados por titulo");
Noticia noticia7 = new Noticia("7", "Cellnex coloca 200 millones de euros en bonos convertibles", "La operadora de infraestructuras de telecomunicaciones logra refinanciar su deuda");
Noticia noticia8 = new Noticia("8", "El BCE interviene la Banca Carige, el decimo banco italiano, por su falta de capital", "Francfort nombra tres administradores temporales en la antigua caja de ahorros genovesa para intentar estabilizar la entidad");
Noticia noticia9 = new Noticia("9", "La cadena textil britanica Asos cae un 37% en Bolsa tras recortar previsiones", "La compania sufrio un importante retroceso en ventas y margenes de beneficio el pasado mes de noviembre");
Noticia noticia10 = new Noticia("10", "Los rastreadores de accionistas", "Georgeson cumple 15 anios en Espania poniendo en contacto a las empresas cotizadas con los grandes inversores");
Noticia noticia1 = new Noticia("1", "Titulo 1","Noticia 1");
Noticia noticia2 = new Noticia("2", "Titulo 2","Noticia 2");
Noticia noticia3 = new Noticia("3", "Titulo 3","Noticia 3");
Noticia noticia4 = new Noticia("4", "Titulo 4","Noticia 4");
Noticia noticia5 = new Noticia("5", "Titulo 5","Noticia 5");
Noticia noticia6 = new Noticia("6", "Titulo 6","Noticia 6");
Noticia noticia7 = new Noticia("7", "Titulo 7","Noticia 7");
Noticia noticia8 = new Noticia("8", "Titulo 8","Noticia 8");
Noticia noticia9 = new Noticia("9", "Titulo 9","Noticia 9");
Noticia noticia10 = new Noticia("10", "Titulo 10","Noticia 10");
AgregarNoticia(noticia0);
AgregarNoticia(noticia1);
AgregarNoticia(noticia2);
AgregarNoticia(noticia3);
......@@ -94,11 +88,6 @@ public class NoticiaRepository implements NoticiaRepositoryLocal,NoticiaReposito
AgregarNoticia(noticia8);
AgregarNoticia(noticia9);
AgregarNoticia(noticia10);
}
}
\ No newline at end of file
package TSEP1E01.TSEP1E01.data;
import java.util.Map;
import javax.ejb.Local;
import TSEP1E01.TSEP1E01.model.Noticia;
@Local(NoticiaRepositoryLocal.class)
public interface NoticiaRepositoryLocal {
public Noticia findById(String id) ;
public Noticia findById(String id) ;
public Map<String,Noticia> findAllOrderedByName();
public boolean AgregarNoticia(Noticia Noticia) throws Exception;
// public NoticiaRepository getInstancia();
}
\ No newline at end of file
......@@ -25,22 +25,12 @@ public class PublicacionRepository implements PublicacionRepositoryLocal, Public
mapPublicacion = new HashMap<>();
}
/*public static PublicacionRepository getInstancia() {
if(instancia == null) {
instancia = new PublicacionRepository();
}
return instancia;
}*/
//@Override
public Map<String,Publicacion> getAllPublicaciones(){
return mapPublicacion;
}
public Noticia getNoticia(String id) throws Exception {
return NoticiaRepository.getInstancia().getNoticia(id);
......@@ -52,19 +42,12 @@ public class PublicacionRepository implements PublicacionRepositoryLocal, Public
Publicacion pub = new Publicacion(idPublicacion,tipo,url);
//pub.setNoticia(noticia);
Noticia noti = NoticiaRepository.getInstancia().getNoticia(idNoticia);
pub.setNoticia(noti);
return noti.agregarPublicacion(pub);
return noti.agregarPublicacion(pub);
}
//@Override
public Publicacion getPublicacion(String id) {
return mapPublicacion.get(id);
......
package TSEP1E01.TSEP1E01.data;
import java.util.Map;
import javax.ejb.Remote;
import TSEP1E01.TSEP1E01.model.Publicacion;
@Remote(PublicacionRepositoryRemoto.class)
public interface PublicacionRepositoryRemoto {
......
package TSEP1E01.TSEP1E01.service;
import java.util.Map;
import javax.ejb.Stateless;
import TSEP1E01.TSEP1E01.data.NoticiaRepository;
import TSEP1E01.TSEP1E01.data.PublicacionRepository;
import TSEP1E01.TSEP1E01.model.Noticia;
......@@ -15,30 +12,16 @@ import TSEP1E01.TSEP1E01.model.Publicacion;
@Stateless
public class NoticiasServicios implements NoticiasServiciosLocal, NoticiasServiciosRemoto {
//
//private EntityManager em;
//private EntityManager em;
//private EntityManager em;
@Override
public boolean AgregarNoticia(Noticia Noticia)throws Exception {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
return NoticiaRepository.getInstancia().AgregarNoticia(Noticia);
}
@Override
public Map<String,Noticia> ObtenerNoticias() throws Exception {
public Map<String,Noticia> ObtenerNoticias() throws Exception {
return NoticiaRepository.getInstancia().findAllOrderedByName();
}
......@@ -54,15 +37,8 @@ public class NoticiasServicios implements NoticiasServiciosLocal, NoticiasServic
boolean t ;
PublicacionRepository p = new PublicacionRepository();
t = p.altaServicio(idPublicacion, tipo, url, idNoticia);
return t;
t = p.altaServicio(idPublicacion, tipo, url, idNoticia);
return t;
}
@Override
......@@ -70,15 +46,4 @@ public class NoticiasServicios implements NoticiasServiciosLocal, NoticiasServic
// TODO Auto-generated method stub
return false;
}
/*
@Inject
private Event<Noticia> memberEventSrc;
public void AgregarNoticia(Noticia Noticia) throws Exception {
log.info("Noticia agregada " + Noticia.getTitulo());
em.persist(Noticia);
memberEventSrc.fire(Noticia);
}*/
}
\ No newline at end of file
......@@ -10,19 +10,14 @@ import TSEP1E01.TSEP1E01.model.Publicacion;
public interface NoticiasServiciosLocal {
public boolean AgregarNoticia(Noticia Noticia) throws Exception;
//public boolean AgregarPublicacionNoticia(String idPublicacion, String tipo, String url, String idNoticia);
public boolean AgregarPublicacion(String idPublicacion, String tipo, String url, String idNoticia);
public Map<String,Noticia> ObtenerNoticias() throws Exception;
// public Map<String, Publicacion> ObtenerPublicaciones();
public Map<String,Publicacion> ObtenerPublicacionesNoticia(String Not) throws Exception;
public boolean altaServicio(String idPublicacion, String tipo, String url, String idNoticia) throws Exception;
}
\ No newline at end of file
......@@ -11,13 +11,10 @@ public interface NoticiasServiciosRemoto {
public boolean AgregarNoticia(Noticia Noticia) throws Exception;
//public boolean AgregarPublicacionNoticia(String idPublicacion, String tipo, String url, String idNoticia);
public boolean altaServicio(String idPublicacion, String tipo, String url, String idNoticia) throws Exception;
public Map<String,Noticia> ObtenerNoticias() throws Exception;
//public Map<String, Publicacion> ObtenerPublicaciones();
public Map<String,Publicacion> ObtenerPublicacionesNoticia(String Not) throws Exception;
}
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment