Package cl.loso.melon.server.model

Examples of cl.loso.melon.server.model.ListaEventoLN


    try {
      List<ListaEventoLN> eventos=FueraServicioLNDAO.obtenerEventosPendientes();                            // pendientes
      Iterator<ListaEventoLN> ite = eventos.iterator();
      while (ite.hasNext()) {
        ListaEventoLN evento = ite.next();
        UsuarioLN usr =UsuarioLNBO.editarUsuarioLN(String.valueOf(evento.getIdResponsable()));
        FueraServicioLNBO.enviarCorreo(
            "tiene un fuera de servicio pendiente", from, usr
                .getEmail());
      }
View Full Code Here


  }

  public static FueraServicio getListaEventoLNbyId(Long idUsuario,
      Long idListaEvento) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    ListaEventoLN evento = null;
    FueraServicio fueraServicio = null;
    try {
      Key k1 = KeyFactory.createKey(UsuarioLN.class.getSimpleName(),
          idUsuario);
      Key k2 = KeyFactory.createKey(k1, ListaEventoLN.class
          .getSimpleName(), idListaEvento);
      evento = pm.getObjectById(ListaEventoLN.class, k2);

      java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
          "dd/MM/yyyy");
      String fecha = sdf.format(evento.getFecha());
      fueraServicio = new FueraServicio(fecha, evento.getFalla()
          .getProblema(), String.valueOf(evento.getIdResponsable()),
          String.valueOf(evento.getFalla().getEquipo()));

    } catch (Exception e) {
      log.error(e.getMessage());
    } finally {
      pm.close();
View Full Code Here

  public static FueraServicioUsuario getFueraServicioUsuario(Long idUsuario,
      Long idListaEvento, Long idUsuarioResponsable,
      Long idListaEventoUsuarioResponsable) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    ListaEventoLN evento, evento1 = null;
    FueraServicioUsuario fueraServicioUsuario = null;
    try {
      SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
      log.info("idUsuario : " + idUsuario);
      log.info("idListaEvento : " + idListaEvento);

      Key k1 = KeyFactory.createKey(UsuarioLN.class.getSimpleName(),
          idUsuario);
      Key k2 = KeyFactory.createKey(k1, ListaEventoLN.class
          .getSimpleName(), idListaEvento);
      evento = pm.getObjectById(ListaEventoLN.class, k2);
      log.info("evento1 : " + evento.getEstado());

      log.info("idUsuarioResponsable : " + idUsuarioResponsable);
      log.info("idListaEventoUsuarioResponsable : "
          + idListaEventoUsuarioResponsable);
      Key k11 = KeyFactory.createKey(UsuarioLN.class.getSimpleName(),
          idUsuarioResponsable);
      Key k22 = KeyFactory.createKey(k11, ListaEventoLN.class
          .getSimpleName(), idListaEventoUsuarioResponsable);
      evento1 = pm.getObjectById(ListaEventoLN.class, k22);

      log.info("evento2 : " + evento1.getEstado());
      SolucionLN solucion = evento1.getSolucion();
     
      FallaLN falla=evento.getFalla();
     
      String problema="";
      if(falla!=null){
        problema=falla.getProblema();
      }
      Long equipo=null;
      String equipoTxt="";
     
      if(falla!=null){
        equipo=falla.getEquipo();
      }
      if(equipo!=null){
        equipoTxt=String.valueOf(equipo);
      }

      if (solucion != null) {
        Date fechaCompromiso = solucion.getFechaCompromiso();
        Date fechaSolucion = solucion.getFechaSolucion();
        String fechaCompromisoTxt = "";
        String fechaSolucionTxt = "";
        if (fechaCompromiso != null) {
          fechaCompromisoTxt = sdf.format(fechaCompromiso);
        }
        if (fechaSolucion != null) {
          fechaSolucionTxt = sdf.format(fechaSolucion);
        }

        fueraServicioUsuario = new FueraServicioUsuario(sdf
            .format(evento.getFecha()), problema, String.valueOf(evento
            .getIdResponsable()), equipoTxt, evento.getEstado(), fechaCompromisoTxt,
            fechaSolucionTxt, solucion.getComentario());
      } else {
        fueraServicioUsuario = new FueraServicioUsuario(sdf
            .format(evento.getFecha()), problema, String.valueOf(evento
            .getIdResponsable()), equipoTxt, evento.getEstado(), "", "", "");
      }

    } catch (Exception e) {
      log.error(e.getMessage());
    } finally {
View Full Code Here

  }

  public static ListaEventoLN getPadre(Long idUsuario, Long idListaEvento) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    ListaEventoLN evento, detached = null;

    try {
      Key k1 = KeyFactory.createKey(UsuarioLN.class.getSimpleName(),
          idUsuario);
      Key k2 = KeyFactory.createKey(k1, ListaEventoLN.class
View Full Code Here

      Key k4 = KeyFactory.createKey(k3, ListaEventoLN.class
          .getSimpleName(), idEventoHijo);

      tx = datastore.beginTransaction();

      ListaEventoLN eventoPadre = pm.getObjectById(ListaEventoLN.class,
          k2);
      eventoPadre.setEstado("T");
      tx.commit();

      tx = datastore.beginTransaction();
      ListaEventoLN eventoHijo = pm
          .getObjectById(ListaEventoLN.class, k4);
      eventoHijo.setEstado("T");
      tx.commit();

    } catch (Exception e) {
      log.error(e.getMessage());
    } finally {
View Full Code Here

      long idUsuarioPapa = usuario.getId();

      tx.commit();

      tx.begin();
      ListaEventoLN evento2 = new ListaEventoLN(fecha_ingreso, id,
          idUsuarioPapa, "P", responsable.getId());
      List<ListaEventoLN> eventos = new ArrayList<ListaEventoLN>();
      eventos.add(evento2);
      responsable.setEventos(eventos);
      pm.makePersistent(responsable);
View Full Code Here

  public static void guardarUsuario(String fechacompromiso,
      String fechasolucion, String idUsuario, String idListaEvento,
      String comentario) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    ListaEventoLN evento = null;
    Date fecha_compromiso = null;
    Date fecha_solucion = null;
    DateFormat formato1 = new SimpleDateFormat("dd/MM/yyyy");
    try {
      if (fechacompromiso != null) {
        fecha_compromiso = (Date) formato1.parse(fechacompromiso);
      }

      if (fechasolucion != null) {
        fecha_solucion = (Date) formato1.parse(fechasolucion);
      }

      UsuarioLN usuario = UsuarioLNDAO.getUsuarioLNbyId(Long
          .valueOf(idUsuario));

      Key k1 = KeyFactory.createKey(UsuarioLN.class.getSimpleName(),
          usuario.getId());

      Key k2 = KeyFactory.createKey(k1, ListaEventoLN.class
          .getSimpleName(), Long.valueOf(idListaEvento));

      evento = pm.getObjectById(ListaEventoLN.class, k2);

      SolucionLN solucion = evento.getSolucion();

      if (solucion == null) {
        SolucionLN solu = new SolucionLN(fecha_compromiso,
            fecha_solucion, comentario);
        evento.setSolucion(solu);

        pm.makePersistent(evento);
      } else {
        solucion.setComentario(comentario);
        solucion.setFechaCompromiso(fecha_compromiso);
View Full Code Here

  public String editarFueraServicioUsuario() {
    try {
      UsuarioLN usuario=UsuarioLNBO.editarUsuarioLN(idUsuario);
      equipoList = EquipoLNBO.obtenerEquipoLN(String.valueOf(usuario.getIdNegocio()));
      usuarioList = UsuarioLNBO.obtenerUsuarioNegocioLN(String.valueOf(usuario.getIdNegocio()));
      ListaEventoLN eventoPadre=FueraServicioLNBO.obtenerUsuarioPadre(idUsuario, idListaEvento);
     
      log.info("idUsuario Hijo" +  idUsuario);
      log.info("idListaEvento Hijo" +  idListaEvento);
     
      log.info("eventoPadre.getIdUsuarioPadre() " +  eventoPadre.getIdUsuarioPadre());
      log.info("eventoPadre.getIdpadre() " + eventoPadre.getIdpadre());
     
      fueraServicioUsuario=FueraServicioLNBO.editarFueraServicioUsuario(
          String.valueOf(eventoPadre.getIdUsuarioPadre()),
          String.valueOf(eventoPadre.getIdpadre()),
          idUsuario,
          idListaEvento
          );//sacar idPadre
     
    } catch (Exception e) {
View Full Code Here

    log.info("idUsuario:" + idUsuario);
    log.info("idResponsable:" + idResponsable);
    UsuarioLN usuario = UsuarioLNBO.editarUsuarioLN(idUsuario);
    UsuarioLN responsable = UsuarioLNBO.editarUsuarioLN(idResponsable);
    EquipoLN equipo = EquipoLNBO.editarEquipoLN(idNegocio, idEquipo);
    ListaEventoLN evento = new ListaEventoLN(fecha_ingreso, new Long(0),
        new Long(0), "P", responsable.getId());
    List<ListaEventoLN> eventos = new ArrayList<ListaEventoLN>();
    eventos.add(evento);
    usuario.setEventos(eventos);

    FallaLN falla = new FallaLN(fecha_ingreso,problema, equipo.getKey().getId(), equipo
        .getNombre());

    evento.setFalla(falla);

    FueraServicioLNDAO.guardar(usuario, evento, fecha_ingreso, responsable);
   
    enviarCorreo("prueba", usuario.getEmail(),responsable.getEmail());
  }
View Full Code Here

  }
 

  public static void cerrarFueraServicioUsuario(String idUsuario, String idEventoHijo) throws Exception {

    ListaEventoLN eventoPadre=FueraServicioLNBO.obtenerUsuarioPadre(idUsuario, idEventoHijo);

    FueraServicioLNDAO.cambiarEstado(
        eventoPadre.getIdpadre(),
        eventoPadre.getIdUsuarioPadre(),
        Long.valueOf(idEventoHijo),
        Long.valueOf(idUsuario));
   
 
View Full Code Here

TOP

Related Classes of cl.loso.melon.server.model.ListaEventoLN

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.