Example usage for java.sql Date Date

List of usage examples for java.sql Date Date

Introduction

In this page you can find the example usage for java.sql Date Date.

Prototype

public Date(long date) 

Source Link

Document

Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

Usage

From source file:nl.ordina.bag.etl.dao.AbstractBAGDAO.java

@Override
public void update(final Ligplaats origineel, final Ligplaats mutation) throws DAOException {
    try {//from  ww w  .ja v  a  2 s  .c  o m
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                jdbcTemplate.update(new PreparedStatementCreator() {
                    @Override
                    public PreparedStatement createPreparedStatement(Connection connection)
                            throws SQLException {
                        PreparedStatement ps = connection.prepareStatement("update bag_ligplaats set"
                                + " aanduiding_record_inactief = ?," + " aanduiding_record_correctie = ?,"
                                + " officieel = ?," + " ligplaats_status = ?," + " ligplaats_geometrie = ?,"
                                + " einddatum_tijdvak_geldigheid = ?," + " in_onderzoek = ?,"
                                + " bron_documentdatum = ?," + " bron_documentnummer = ?,"
                                + " bag_nummeraanduiding_id = ?" + " where bag_ligplaats_id = ?"
                                + " and aanduiding_record_correctie = ?"
                                + " and begindatum_tijdvak_geldigheid = ?");
                        ps.setInt(1, mutation.getAanduidingRecordInactief().ordinal());
                        ps.setLong(2, mutation.getAanduidingRecordCorrectie());
                        ps.setInt(3, mutation.getOfficieel().ordinal());
                        ps.setInt(4, mutation.getLigplaatsStatus().ordinal());
                        ps.setString(5, mutation.getLigplaatsGeometrie());
                        if (mutation.getEinddatumTijdvakGeldigheid() == null)
                            ps.setNull(6, Types.TIMESTAMP);
                        else
                            ps.setTimestamp(6,
                                    new Timestamp(mutation.getEinddatumTijdvakGeldigheid().getTime()));
                        ps.setInt(7, mutation.getInOnderzoek().ordinal());
                        ps.setDate(8, new Date(mutation.getDocumentdatum().getTime()));
                        ps.setString(9, mutation.getDocumentnummer());
                        ps.setLong(10, mutation.getHoofdAdres());
                        ps.setLong(11, origineel.getIdentificatie());
                        ps.setLong(12, origineel.getAanduidingRecordCorrectie());
                        ps.setTimestamp(13,
                                new Timestamp(origineel.getBegindatumTijdvakGeldigheid().getTime()));
                        return ps;
                    }
                });
                deleteNevenadressen(TypeAdresseerbaarObject.LIGPLAATS, origineel);
                insertNevenadressen(TypeAdresseerbaarObject.LIGPLAATS, mutation);
            }
        });
    } catch (DataAccessException e) {
        throw new DAOException("Error updating ligplaats: " + origineel.getIdentificatie(), e);
    }
}

From source file:nl.ordina.bag.etl.dao.AbstractBAGDAO.java

@Override
public void update(final Standplaats origineel, final Standplaats mutation) throws DAOException {
    try {//from   w  ww.  ja v a2s. c o m
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                jdbcTemplate.update(new PreparedStatementCreator() {
                    @Override
                    public PreparedStatement createPreparedStatement(Connection connection)
                            throws SQLException {
                        PreparedStatement ps = connection.prepareStatement("update bag_standplaats set"
                                + " aanduiding_record_inactief = ?," + " aanduiding_record_correctie = ?,"
                                + " officieel = ?," + " standplaats_status = ?," + " standplaats_geometrie = ?,"
                                + " einddatum_tijdvak_geldigheid = ?," + " in_onderzoek = ?,"
                                + " bron_documentdatum = ?," + " bron_documentnummer = ?,"
                                + " bag_nummeraanduiding_id = ?" + " where bag_standplaats_id = ?"
                                + " and aanduiding_record_correctie = ?"
                                + " and begindatum_tijdvak_geldigheid = ?");
                        ps.setInt(1, mutation.getAanduidingRecordInactief().ordinal());
                        ps.setLong(2, mutation.getAanduidingRecordCorrectie());
                        ps.setInt(3, mutation.getOfficieel().ordinal());
                        ps.setInt(4, mutation.getStandplaatsStatus().ordinal());
                        ps.setString(5, mutation.getStandplaatsGeometrie());
                        if (mutation.getEinddatumTijdvakGeldigheid() == null)
                            ps.setNull(6, Types.TIMESTAMP);
                        else
                            ps.setTimestamp(6,
                                    new Timestamp(mutation.getEinddatumTijdvakGeldigheid().getTime()));
                        ps.setInt(7, mutation.getInOnderzoek().ordinal());
                        ps.setDate(8, new Date(mutation.getDocumentdatum().getTime()));
                        ps.setString(9, mutation.getDocumentnummer());
                        ps.setLong(10, mutation.getHoofdAdres());
                        ps.setLong(11, origineel.getIdentificatie());
                        ps.setLong(12, origineel.getAanduidingRecordCorrectie());
                        ps.setTimestamp(13,
                                new Timestamp(origineel.getBegindatumTijdvakGeldigheid().getTime()));
                        return ps;
                    }
                });
                deleteNevenadressen(TypeAdresseerbaarObject.STANDPLAATS, origineel);
                insertNevenadressen(TypeAdresseerbaarObject.STANDPLAATS, mutation);
            }
        });
    } catch (DataAccessException e) {
        throw new DAOException("Error updating standplaats: " + origineel.getIdentificatie(), e);
    }
}

From source file:org.kuali.kra.award.home.Award.java

/**
 * This method finds the latest final expiration date from the collection of AmnoutInfos
 * @return The latest final expiration date from the collection of AmnoutInfos. If there are no AmoutInfos, 1/1/1900 is returned
 *///from  ww w.  j a  v  a 2 s  . c o  m
public Date findLatestFinalExpirationDate() {
    Date latestExpDate = new Date(new GregorianCalendar(1900, Calendar.JANUARY, 1).getTimeInMillis());
    for (AwardAmountInfo amountInfo : getAwardAmountInfos()) {
        Date expDate = amountInfo.getFinalExpirationDate();
        if (expDate != null && expDate.after(latestExpDate)) {
            latestExpDate = expDate;
        }
    }
    return latestExpDate;
}

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartHelper.java

/***********************************************************************************************
 * Creates a test dataset./* w  w w.  j  av  a  2s .c o m*/
 *
 * @return the dataset.
 */

public static XYDataset createDummyDataset() {
    final TimeSeries s1 = new TimeSeries("Channel 0 23.4kHz", Second.class);

    s1.add(new Second(new Date(1110400770000L)), 178);
    s1.add(new Second(new Date(1110401020000L)), 182);
    s1.add(new Second(new Date(1110401270000L)), 172);
    s1.add(new Second(new Date(1110401520000L)), 173);
    s1.add(new Second(new Date(1110401770000L)), 164);
    s1.add(new Second(new Date(1110402080000L)), 148);
    s1.add(new Second(new Date(1110402330000L)), 159);
    s1.add(new Second(new Date(1110402580000L)), 162);
    s1.add(new Second(new Date(1110402830000L)), 171);
    s1.add(new Second(new Date(1110403080000L)), 175);
    s1.add(new Second(new Date(1110403330000L)), 175);
    s1.add(new Second(new Date(1110403580000L)), 169);
    s1.add(new Second(new Date(1110403830000L)), 176);
    s1.add(new Second(new Date(1110404080000L)), 181);
    s1.add(new Second(new Date(1110404330000L)), 184);
    s1.add(new Second(new Date(1110404580000L)), 169);
    s1.add(new Second(new Date(1110404830000L)), 165);
    s1.add(new Second(new Date(1110405080000L)), 163);
    s1.add(new Second(new Date(1110405330000L)), 149);
    s1.add(new Second(new Date(1110405580000L)), 150);
    s1.add(new Second(new Date(1110405830000L)), 163);
    s1.add(new Second(new Date(1110406080000L)), 164);
    s1.add(new Second(new Date(1110406330000L)), 161);
    s1.add(new Second(new Date(1110406580000L)), 169);
    s1.add(new Second(new Date(1110406830000L)), 170);
    s1.add(new Second(new Date(1110407080000L)), 167);
    s1.add(new Second(new Date(1110407330000L)), 167);
    s1.add(new Second(new Date(1110407580000L)), 187);
    s1.add(new Second(new Date(1110407830000L)), 195);
    s1.add(new Second(new Date(1110408080000L)), 207);
    s1.add(new Second(new Date(1110408330000L)), 200);
    s1.add(new Second(new Date(1110408580000L)), 185);
    s1.add(new Second(new Date(1110408830000L)), 179);
    s1.add(new Second(new Date(1110409080000L)), 172);
    s1.add(new Second(new Date(1110409330000L)), 196);
    s1.add(new Second(new Date(1110409580000L)), 233);
    s1.add(new Second(new Date(1110409830000L)), 218);
    s1.add(new Second(new Date(1110410080000L)), 217);
    s1.add(new Second(new Date(1110410330000L)), 198);
    s1.add(new Second(new Date(1110410580000L)), 196);
    s1.add(new Second(new Date(1110410830000L)), 183);
    s1.add(new Second(new Date(1110411080000L)), 170);
    s1.add(new Second(new Date(1110411330000L)), 155);
    s1.add(new Second(new Date(1110411580000L)), 167);
    s1.add(new Second(new Date(1110411830000L)), 166);
    s1.add(new Second(new Date(1110412080000L)), 184);
    s1.add(new Second(new Date(1110412330000L)), 199);
    s1.add(new Second(new Date(1110412580000L)), 194);
    s1.add(new Second(new Date(1110412830000L)), 185);
    s1.add(new Second(new Date(1110413080000L)), 181);
    s1.add(new Second(new Date(1110413330000L)), 171);
    s1.add(new Second(new Date(1110413580000L)), 163);
    s1.add(new Second(new Date(1110413830000L)), 169);
    s1.add(new Second(new Date(1110414080000L)), 162);
    s1.add(new Second(new Date(1110414330000L)), 173);
    s1.add(new Second(new Date(1110414580000L)), 160);
    s1.add(new Second(new Date(1110414830000L)), 147);
    s1.add(new Second(new Date(1110415080000L)), 151);
    s1.add(new Second(new Date(1110415330000L)), 179);
    s1.add(new Second(new Date(1110415580000L)), 192);
    s1.add(new Second(new Date(1110415830000L)), 180);
    s1.add(new Second(new Date(1110416080000L)), 159);
    s1.add(new Second(new Date(1110416330000L)), 164);
    s1.add(new Second(new Date(1110416580000L)), 178);
    s1.add(new Second(new Date(1110416830000L)), 163);
    s1.add(new Second(new Date(1110417080000L)), 157);
    s1.add(new Second(new Date(1110417330000L)), 152);
    s1.add(new Second(new Date(1110417580000L)), 148);
    s1.add(new Second(new Date(1110417830000L)), 162);
    s1.add(new Second(new Date(1110418080000L)), 176);
    s1.add(new Second(new Date(1110418330000L)), 168);
    s1.add(new Second(new Date(1110418580000L)), 167);
    s1.add(new Second(new Date(1110418830000L)), 170);
    s1.add(new Second(new Date(1110419080000L)), 161);
    s1.add(new Second(new Date(1110419330000L)), 150);
    s1.add(new Second(new Date(1110419580000L)), 157);
    s1.add(new Second(new Date(1110419830000L)), 164);
    s1.add(new Second(new Date(1110420080000L)), 156);
    s1.add(new Second(new Date(1110420330000L)), 155);
    s1.add(new Second(new Date(1110420580000L)), 150);
    s1.add(new Second(new Date(1110420830000L)), 160);
    s1.add(new Second(new Date(1110421080000L)), 168);
    s1.add(new Second(new Date(1110421330000L)), 160);
    s1.add(new Second(new Date(1110421580000L)), 162);
    s1.add(new Second(new Date(1110421830000L)), 152);
    s1.add(new Second(new Date(1110422080000L)), 148);
    s1.add(new Second(new Date(1110422330000L)), 141);
    s1.add(new Second(new Date(1110422580000L)), 140);
    s1.add(new Second(new Date(1110422830000L)), 145);
    s1.add(new Second(new Date(1110423080000L)), 152);
    s1.add(new Second(new Date(1110423330000L)), 152);
    s1.add(new Second(new Date(1110423580000L)), 143);
    s1.add(new Second(new Date(1110423830000L)), 164);
    s1.add(new Second(new Date(1110424080000L)), 177);
    s1.add(new Second(new Date(1110424330000L)), 161);
    s1.add(new Second(new Date(1110424580000L)), 166);
    s1.add(new Second(new Date(1110424830000L)), 177);
    s1.add(new Second(new Date(1110425080000L)), 177);
    s1.add(new Second(new Date(1110425330000L)), 183);
    s1.add(new Second(new Date(1110425580000L)), 196);
    s1.add(new Second(new Date(1110425830000L)), 198);
    s1.add(new Second(new Date(1110426080000L)), 197);
    s1.add(new Second(new Date(1110426330000L)), 189);
    s1.add(new Second(new Date(1110426580000L)), 201);
    s1.add(new Second(new Date(1110426830000L)), 193);
    s1.add(new Second(new Date(1110427080000L)), 200);
    s1.add(new Second(new Date(1110427330000L)), 210);
    s1.add(new Second(new Date(1110427580000L)), 214);
    s1.add(new Second(new Date(1110427830000L)), 204);
    s1.add(new Second(new Date(1110428080000L)), 196);
    s1.add(new Second(new Date(1110428330000L)), 199);
    s1.add(new Second(new Date(1110428580000L)), 202);
    s1.add(new Second(new Date(1110428830000L)), 215);
    s1.add(new Second(new Date(1110429080000L)), 220);
    s1.add(new Second(new Date(1110429330000L)), 236);
    s1.add(new Second(new Date(1110429580000L)), 238);
    s1.add(new Second(new Date(1110429830000L)), 246);
    s1.add(new Second(new Date(1110430080000L)), 240);
    s1.add(new Second(new Date(1110430330000L)), 242);
    s1.add(new Second(new Date(1110430580000L)), 232);
    s1.add(new Second(new Date(1110430830000L)), 233);
    s1.add(new Second(new Date(1110431080000L)), 233);
    s1.add(new Second(new Date(1110431330000L)), 227);
    s1.add(new Second(new Date(1110431580000L)), 199);
    s1.add(new Second(new Date(1110431830000L)), 218);
    s1.add(new Second(new Date(1110432080000L)), 212);
    s1.add(new Second(new Date(1110432330000L)), 220);
    s1.add(new Second(new Date(1110432580000L)), 205);
    s1.add(new Second(new Date(1110432830000L)), 188);
    s1.add(new Second(new Date(1110433080000L)), 185);
    s1.add(new Second(new Date(1110433330000L)), 172);
    s1.add(new Second(new Date(1110433580000L)), 168);
    s1.add(new Second(new Date(1110433830000L)), 173);
    s1.add(new Second(new Date(1110434080000L)), 175);
    s1.add(new Second(new Date(1110434330000L)), 160);
    s1.add(new Second(new Date(1110434580000L)), 138);
    s1.add(new Second(new Date(1110434830000L)), 112);
    s1.add(new Second(new Date(1110435080000L)), 89);
    s1.add(new Second(new Date(1110435330000L)), 72);
    s1.add(new Second(new Date(1110435580000L)), 54);
    s1.add(new Second(new Date(1110435830000L)), 44);
    s1.add(new Second(new Date(1110436080000L)), 51);
    s1.add(new Second(new Date(1110436330000L)), 77);
    s1.add(new Second(new Date(1110436580000L)), 105);
    s1.add(new Second(new Date(1110436830000L)), 126);
    s1.add(new Second(new Date(1110437080000L)), 136);
    s1.add(new Second(new Date(1110437330000L)), 142);
    s1.add(new Second(new Date(1110437580000L)), 152);
    s1.add(new Second(new Date(1110437830000L)), 153);
    s1.add(new Second(new Date(1110438080000L)), 141);
    s1.add(new Second(new Date(1110438330000L)), 127);
    s1.add(new Second(new Date(1110438580000L)), 17);
    s1.add(new Second(new Date(1110438830000L)), 18);
    s1.add(new Second(new Date(1110439080000L)), 18);
    s1.add(new Second(new Date(1110439330000L)), 18);
    s1.add(new Second(new Date(1110439580000L)), 18);
    s1.add(new Second(new Date(1110439830000L)), 18);
    s1.add(new Second(new Date(1110440080000L)), 19);
    s1.add(new Second(new Date(1110440330000L)), 18);
    s1.add(new Second(new Date(1110440580000L)), 18);
    s1.add(new Second(new Date(1110440830000L)), 40);
    s1.add(new Second(new Date(1110441080000L)), 108);
    s1.add(new Second(new Date(1110441330000L)), 157);
    s1.add(new Second(new Date(1110441580000L)), 153);
    s1.add(new Second(new Date(1110441830000L)), 124);
    s1.add(new Second(new Date(1110442080000L)), 173);
    s1.add(new Second(new Date(1110442330000L)), 171);
    s1.add(new Second(new Date(1110442580000L)), 168);
    s1.add(new Second(new Date(1110442830000L)), 168);
    s1.add(new Second(new Date(1110443080000L)), 169);
    s1.add(new Second(new Date(1110443330000L)), 167);
    s1.add(new Second(new Date(1110443580000L)), 168);
    s1.add(new Second(new Date(1110443830000L)), 171);
    s1.add(new Second(new Date(1110444080000L)), 172);
    s1.add(new Second(new Date(1110444330000L)), 172);
    s1.add(new Second(new Date(1110444580000L)), 170);
    s1.add(new Second(new Date(1110444830000L)), 173);
    s1.add(new Second(new Date(1110445080000L)), 173);
    s1.add(new Second(new Date(1110445330000L)), 174);
    s1.add(new Second(new Date(1110445580000L)), 172);
    s1.add(new Second(new Date(1110445830000L)), 173);
    s1.add(new Second(new Date(1110446080000L)), 172);
    s1.add(new Second(new Date(1110446330000L)), 172);
    s1.add(new Second(new Date(1110446580000L)), 171);
    s1.add(new Second(new Date(1110446830000L)), 171);
    s1.add(new Second(new Date(1110447080000L)), 171);
    s1.add(new Second(new Date(1110447330000L)), 172);
    s1.add(new Second(new Date(1110447580000L)), 174);
    s1.add(new Second(new Date(1110447830000L)), 173);
    s1.add(new Second(new Date(1110448080000L)), 173);
    s1.add(new Second(new Date(1110448330000L)), 171);
    s1.add(new Second(new Date(1110448580000L)), 170);
    s1.add(new Second(new Date(1110448830000L)), 172);
    s1.add(new Second(new Date(1110449080000L)), 172);
    s1.add(new Second(new Date(1110449330000L)), 172);
    s1.add(new Second(new Date(1110449580000L)), 170);
    s1.add(new Second(new Date(1110449830000L)), 167);
    s1.add(new Second(new Date(1110450080000L)), 165);
    s1.add(new Second(new Date(1110450330000L)), 166);
    s1.add(new Second(new Date(1110450580000L)), 165);
    s1.add(new Second(new Date(1110450830000L)), 163);
    s1.add(new Second(new Date(1110451080000L)), 163);
    s1.add(new Second(new Date(1110451330000L)), 160);
    s1.add(new Second(new Date(1110451580000L)), 160);
    s1.add(new Second(new Date(1110451830000L)), 160);
    s1.add(new Second(new Date(1110452080000L)), 160);
    s1.add(new Second(new Date(1110452330000L)), 159);
    s1.add(new Second(new Date(1110452580000L)), 159);
    s1.add(new Second(new Date(1110452830000L)), 158);
    s1.add(new Second(new Date(1110453080000L)), 158);
    s1.add(new Second(new Date(1110453330000L)), 159);
    s1.add(new Second(new Date(1110453580000L)), 159);
    s1.add(new Second(new Date(1110453830000L)), 158);
    s1.add(new Second(new Date(1110454080000L)), 154);
    s1.add(new Second(new Date(1110454330000L)), 151);
    s1.add(new Second(new Date(1110454580000L)), 151);
    s1.add(new Second(new Date(1110454830000L)), 102);
    s1.add(new Second(new Date(1110455080000L)), 90);
    s1.add(new Second(new Date(1110455330000L)), 95);
    s1.add(new Second(new Date(1110455580000L)), 102);
    s1.add(new Second(new Date(1110455830000L)), 107);
    s1.add(new Second(new Date(1110456080000L)), 113);
    s1.add(new Second(new Date(1110456330000L)), 119);
    s1.add(new Second(new Date(1110456580000L)), 123);
    s1.add(new Second(new Date(1110456830000L)), 127);
    s1.add(new Second(new Date(1110457080000L)), 131);
    s1.add(new Second(new Date(1110457330000L)), 134);
    s1.add(new Second(new Date(1110457580000L)), 137);
    s1.add(new Second(new Date(1110457830000L)), 138);
    s1.add(new Second(new Date(1110458080000L)), 140);
    s1.add(new Second(new Date(1110458330000L)), 142);
    s1.add(new Second(new Date(1110458580000L)), 142);
    s1.add(new Second(new Date(1110458830000L)), 141);
    s1.add(new Second(new Date(1110459080000L)), 144);
    s1.add(new Second(new Date(1110459330000L)), 145);
    s1.add(new Second(new Date(1110459580000L)), 146);
    s1.add(new Second(new Date(1110459830000L)), 149);
    s1.add(new Second(new Date(1110460080000L)), 149);
    s1.add(new Second(new Date(1110460330000L)), 149);
    s1.add(new Second(new Date(1110460580000L)), 150);
    s1.add(new Second(new Date(1110460830000L)), 152);
    s1.add(new Second(new Date(1110461080000L)), 151);
    s1.add(new Second(new Date(1110461330000L)), 151);
    s1.add(new Second(new Date(1110461580000L)), 151);
    s1.add(new Second(new Date(1110461830000L)), 151);
    s1.add(new Second(new Date(1110462080000L)), 151);
    s1.add(new Second(new Date(1110462330000L)), 153);
    s1.add(new Second(new Date(1110462580000L)), 152);
    s1.add(new Second(new Date(1110462830000L)), 152);
    s1.add(new Second(new Date(1110463080000L)), 152);
    s1.add(new Second(new Date(1110463330000L)), 151);
    s1.add(new Second(new Date(1110463580000L)), 152);
    s1.add(new Second(new Date(1110463830000L)), 152);
    s1.add(new Second(new Date(1110464080000L)), 152);
    s1.add(new Second(new Date(1110464330000L)), 151);
    s1.add(new Second(new Date(1110464580000L)), 150);
    s1.add(new Second(new Date(1110464830000L)), 148);
    s1.add(new Second(new Date(1110465080000L)), 147);
    s1.add(new Second(new Date(1110465330000L)), 145);
    s1.add(new Second(new Date(1110465580000L)), 145);
    s1.add(new Second(new Date(1110465830000L)), 145);
    s1.add(new Second(new Date(1110466080000L)), 146);
    s1.add(new Second(new Date(1110466330000L)), 147);
    s1.add(new Second(new Date(1110466580000L)), 147);
    s1.add(new Second(new Date(1110466830000L)), 145);
    s1.add(new Second(new Date(1110467080000L)), 143);
    s1.add(new Second(new Date(1110467330000L)), 142);
    s1.add(new Second(new Date(1110467580000L)), 141);
    s1.add(new Second(new Date(1110467830000L)), 143);
    s1.add(new Second(new Date(1110468080000L)), 144);
    s1.add(new Second(new Date(1110468330000L)), 143);
    s1.add(new Second(new Date(1110468580000L)), 143);
    s1.add(new Second(new Date(1110468830000L)), 141);
    s1.add(new Second(new Date(1110469080000L)), 140);
    s1.add(new Second(new Date(1110469330000L)), 140);
    s1.add(new Second(new Date(1110469580000L)), 141);
    s1.add(new Second(new Date(1110469830000L)), 143);
    s1.add(new Second(new Date(1110470080000L)), 146);
    s1.add(new Second(new Date(1110470330000L)), 150);
    s1.add(new Second(new Date(1110470580000L)), 153);
    s1.add(new Second(new Date(1110470830000L)), 155);
    s1.add(new Second(new Date(1110471080000L)), 157);
    s1.add(new Second(new Date(1110471330000L)), 156);
    s1.add(new Second(new Date(1110471580000L)), 154);
    s1.add(new Second(new Date(1110471830000L)), 155);
    s1.add(new Second(new Date(1110472080000L)), 153);
    s1.add(new Second(new Date(1110472330000L)), 150);
    s1.add(new Second(new Date(1110472580000L)), 145);
    s1.add(new Second(new Date(1110472830000L)), 144);
    s1.add(new Second(new Date(1110473080000L)), 148);
    s1.add(new Second(new Date(1110473330000L)), 152);
    s1.add(new Second(new Date(1110473580000L)), 154);
    s1.add(new Second(new Date(1110473830000L)), 157);
    s1.add(new Second(new Date(1110474080000L)), 160);
    s1.add(new Second(new Date(1110474330000L)), 159);
    s1.add(new Second(new Date(1110474580000L)), 161);
    s1.add(new Second(new Date(1110474830000L)), 156);
    s1.add(new Second(new Date(1110475080000L)), 142);
    s1.add(new Second(new Date(1110475330000L)), 140);
    s1.add(new Second(new Date(1110475580000L)), 136);
    s1.add(new Second(new Date(1110475830000L)), 127);
    s1.add(new Second(new Date(1110476080000L)), 113);
    s1.add(new Second(new Date(1110476330000L)), 105);
    s1.add(new Second(new Date(1110476580000L)), 107);
    s1.add(new Second(new Date(1110476830000L)), 103);
    s1.add(new Second(new Date(1110477080000L)), 97);
    s1.add(new Second(new Date(1110477330000L)), 102);
    s1.add(new Second(new Date(1110477580000L)), 111);
    s1.add(new Second(new Date(1110477830000L)), 127);
    s1.add(new Second(new Date(1110478080000L)), 149);
    s1.add(new Second(new Date(1110478330000L)), 166);
    s1.add(new Second(new Date(1110478580000L)), 181);
    s1.add(new Second(new Date(1110478830000L)), 189);
    s1.add(new Second(new Date(1110479080000L)), 203);
    s1.add(new Second(new Date(1110479330000L)), 224);
    s1.add(new Second(new Date(1110479580000L)), 234);
    s1.add(new Second(new Date(1110479830000L)), 237);
    s1.add(new Second(new Date(1110480080000L)), 229);
    s1.add(new Second(new Date(1110480330000L)), 228);
    s1.add(new Second(new Date(1110480580000L)), 222);
    s1.add(new Second(new Date(1110480830000L)), 205);
    s1.add(new Second(new Date(1110481080000L)), 222);
    s1.add(new Second(new Date(1110481330000L)), 226);
    s1.add(new Second(new Date(1110481580000L)), 222);
    s1.add(new Second(new Date(1110481830000L)), 229);
    s1.add(new Second(new Date(1110482080000L)), 247);
    s1.add(new Second(new Date(1110482330000L)), 240);
    s1.add(new Second(new Date(1110482580000L)), 251);
    s1.add(new Second(new Date(1110482830000L)), 240);
    s1.add(new Second(new Date(1110483080000L)), 242);
    s1.add(new Second(new Date(1110483330000L)), 241);
    s1.add(new Second(new Date(1110483580000L)), 250);
    s1.add(new Second(new Date(1110483830000L)), 255);
    s1.add(new Second(new Date(1110484080000L)), 255);
    s1.add(new Second(new Date(1110484330000L)), 255);
    s1.add(new Second(new Date(1110484580000L)), 255);
    s1.add(new Second(new Date(1110484830000L)), 255);
    s1.add(new Second(new Date(1110485080000L)), 255);
    s1.add(new Second(new Date(1110485330000L)), 254);
    s1.add(new Second(new Date(1110485580000L)), 253);
    s1.add(new Second(new Date(1110485830000L)), 254);
    s1.add(new Second(new Date(1110486080000L)), 59);

    // We may as well use the default TimeZone
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(s1);

    dataset.setDomainIsPointsInTime(true);

    return (dataset);
}

From source file:com.redhat.rhn.manager.system.SystemManager.java

private static List<DuplicateSystemGrouping> listDuplicates(User user, String query, List<String> ignored,
        Long inactiveHours) {//from   www. j a  v  a2 s .  c  om

    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.HOUR, (0 - inactiveHours.intValue()));

    SelectMode ipMode = ModeFactory.getMode("System_queries", query);

    Date d = new Date(cal.getTimeInMillis());

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("uid", user.getId());
    params.put("inactive_date", d);
    DataResult<NetworkDto> nets;
    if (ignored.isEmpty()) {
        nets = ipMode.execute(params);
    } else {
        nets = ipMode.execute(params, ignored);
    }

    List<DuplicateSystemGrouping> nodes = new ArrayList<DuplicateSystemGrouping>();
    for (NetworkDto net : nets) {
        boolean found = false;
        for (DuplicateSystemGrouping node : nodes) {
            if (node.addIfMatch(net)) {
                found = true;
                break;
            }
        }
        if (!found) {
            nodes.add(new DuplicateSystemGrouping(net));
        }
    }
    return nodes;
}

From source file:com.facebook.presto.tests.AbstractTestQueries.java

@Test
public void testTimeLiterals() throws Exception {
    MaterializedResult.Builder builder = resultBuilder(getSession(), DATE, TIME, TIME_WITH_TIME_ZONE, TIMESTAMP,
            TIMESTAMP_WITH_TIME_ZONE);/* w  w w . j av a  2s .c om*/

    DateTimeZone sessionTimeZone = DateTimeZoneIndex.getDateTimeZone(getSession().getTimeZoneKey());
    DateTimeZone utcPlus6 = DateTimeZoneIndex.getDateTimeZone(TimeZoneKey.getTimeZoneKeyForOffset(6 * 60));

    builder.row(new Date(new DateTime(2013, 3, 22, 0, 0, sessionTimeZone).getMillis()),
            new Time(new DateTime(1970, 1, 1, 3, 4, 5, sessionTimeZone).getMillisOfDay()),
            new Time(new DateTime(1970, 1, 1, 3, 4, 5, utcPlus6).getMillis()), // hack because java.sql.Time compares based on actual number of ms since epoch instead of ms since midnight
            new Timestamp(new DateTime(1960, 1, 22, 3, 4, 5, sessionTimeZone).getMillis()),
            new Timestamp(new DateTime(1960, 1, 22, 3, 4, 5, utcPlus6).getMillis()));

    MaterializedResult actual = computeActual(
            "SELECT DATE '2013-03-22', TIME '3:04:05', TIME '3:04:05 +06:00', TIMESTAMP '1960-01-22 3:04:05', TIMESTAMP '1960-01-22 3:04:05 +06:00'");

    assertEquals(actual, builder.build());
}