Example usage for org.joda.time LocalDateTime parse

List of usage examples for org.joda.time LocalDateTime parse

Introduction

In this page you can find the example usage for org.joda.time LocalDateTime parse.

Prototype

public static LocalDateTime parse(String str, DateTimeFormatter formatter) 

Source Link

Document

Parses a LocalDateTime from the specified string using a formatter.

Usage

From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java

public String setDevolucion(Devolucion d, List<DevolucionDetalle> detalles) {

    if (d.getFechaCadena() != null) {
        LocalDateTime localDateTime = LocalDateTime.parse(d.getFechaCadena(),
                DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
        d.setFecha(localDateTime.toDate());
    }/*  www  .j a v  a  2  s. c o m*/

    String R = d.getId() + "";
    Devolucion rbd = null;
    try {
        rbd = (Devolucion) em.createQuery("SELECT d FROM Devolucion d where d.hashKey = :hash")
                .setParameter("hash", d.getHashKey().trim()).getSingleResult();
    } catch (Exception e) {

    }

    if (rbd != null && rbd.getEstadoDescarga().compareToIgnoreCase("T") == 0) {
        return R;
    }

    d.setEstadoDescarga("N");
    if (rbd == null) {
        System.out.println("Detalles devolucion: " + detalles);
        d.setId(null);
        System.out.println("Paso 1:");

        em.persist(d);
        em.flush();
        em.refresh(d);

        for (DevolucionDetalle dt : detalles) {
            dt.setId(null);
            dt.setDevolucionId(d.getId());
            em.persist(dt);
        }
    } else {
        rbd = copiaDevolucion(rbd, d);
        rbd.setEstadoDescarga("N");
        em.merge(rbd);
        em.flush();
        em.refresh(rbd);

        em.createQuery("DELETE FROM DevolucionDetalle d WHERE d.devolucionId = ?1").setParameter(1, rbd.getId())
                .executeUpdate();

        for (DevolucionDetalle dt : detalles) {
            dt.setId(null);
            dt.setDevolucionId(rbd.getId());
            em.persist(dt);
        }
    }

    return R;
}

From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java

public Cobranza setCobranza(Cobranza c, List<Cobranzadetalle> detalles,
        List<Cobranzaaplicacionpago> aplicaciones) {

    if (c.getFechaCadena() != null) {
        LocalDateTime localDateTime = LocalDateTime.parse(c.getFechaCadena(),
                DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
        c.setFecha(localDateTime.toDate());
    }/* www  . j  a v a 2 s.c  o m*/

    Cobranza vivo = em.find(Cobranza.class, c.getId());
    if (vivo != null && vivo.getEstadodescarga().compareTo('T') == 0) {
        return c;
    }

    em.createQuery("DELETE FROM Cobranzadetalle c WHERE c.cobranzaid = ?1").setParameter(1, c.getId())
            .executeUpdate();

    em.createQuery("DELETE FROM Cobranzaaplicacionpago c WHERE c.cobranzaid = ?1").setParameter(1, c.getId())
            .executeUpdate();

    c.setEstadodescarga('N');
    String[] arrayId = c.getId().split(",");
    short sucursalId = Short.valueOf(arrayId[1]);
    c.setSucursalId(sucursalId);

    em.merge(c);
    for (Cobranzadetalle cd : detalles) {
        if (cd.getFechaCadena() != null) {
            LocalDateTime localDateTime = LocalDateTime.parse(cd.getFechaCadena(),
                    DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
            cd.setFechaFactura(localDateTime.toDate());
        }

        cd.setCobranza(c);
        em.merge(cd);
    }

    for (Cobranzaaplicacionpago cap : aplicaciones) {

        if (cap.getFechaCadena() != null) {
            LocalDateTime localDateTime = LocalDateTime.parse(cap.getFechaCadena(),
                    DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
            cap.setValorfecha(localDateTime.toDate());
        }

        cap.setCobranza(c);
        em.merge(cap);
    }
    return c;
}

From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java

public Cobranzaaplicacionpago setCobranzaAplicacionPago(Cobranzaaplicacionpago c) {

    if (c.getFechaCadena() != null) {
        LocalDateTime localDateTime = LocalDateTime.parse(c.getFechaCadena(),
                DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
        c.setValorfecha(localDateTime.toDate());
    }/*from   w  ww.  j a va2s . c  o m*/

    em.merge(c);
    return c;
}

From source file:py.com.palermo.servicioarthy.PuntosService.java

public void guarda(Evento e) {

    if (e.getFechaCadena() != null) {
        LocalDateTime localDateTime = LocalDateTime.parse(e.getFechaCadena(),
                DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
        e.setFecha(localDateTime.toDate());
    }/*from w  w w.ja v a 2 s .co  m*/

    em.merge(e);
}