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:com.cloud.configuration.ConfigurationManagerImpl.java

@Override
@DB/*from   w  w  w  .  java 2  s.c om*/
public String updateConfiguration(final long userId, final String name, final String category,
        final String value, final String scope, final Long resourceId) {
    final String validationMsg = validateConfigurationValue(name, value, scope);

    if (validationMsg != null) {
        s_logger.error("Invalid configuration option, name: " + name + ", value:" + value);
        throw new InvalidParameterValueException(validationMsg);
    }

    // If scope of the parameter is given then it needs to be updated in the
    // corresponding details table,
    // if scope is mentioned as global or not mentioned then it is normal
    // global parameter updation
    if (scope != null && !scope.isEmpty() && !ConfigKey.Scope.Global.toString().equalsIgnoreCase(scope)) {
        switch (ConfigKey.Scope.valueOf(scope)) {
        case Zone:
            final DataCenterVO zone = _zoneDao.findById(resourceId);
            if (zone == null) {
                throw new InvalidParameterValueException("unable to find zone by id " + resourceId);
            }
            _dcDetailsDao.addDetail(resourceId, name, value, true);
            break;
        case Cluster:
            final ClusterVO cluster = _clusterDao.findById(resourceId);
            if (cluster == null) {
                throw new InvalidParameterValueException("unable to find cluster by id " + resourceId);
            }
            ClusterDetailsVO clusterDetailsVO = _clusterDetailsDao.findDetail(resourceId, name);
            if (clusterDetailsVO == null) {
                clusterDetailsVO = new ClusterDetailsVO(resourceId, name, value);
                _clusterDetailsDao.persist(clusterDetailsVO);
            } else {
                clusterDetailsVO.setValue(value);
                _clusterDetailsDao.update(clusterDetailsVO.getId(), clusterDetailsVO);
            }
            break;

        case StoragePool:
            final StoragePoolVO pool = _storagePoolDao.findById(resourceId);
            if (pool == null) {
                throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
            }
            if (name.equals(CapacityManager.StorageOverprovisioningFactor.key())) {
                if (pool.getPoolType() != StoragePoolType.NetworkFilesystem
                        && pool.getPoolType() != StoragePoolType.VMFS) {
                    throw new InvalidParameterValueException("Unable to update  storage pool with id "
                            + resourceId + ". Overprovision not supported for " + pool.getPoolType());
                }
            }

            _storagePoolDetailsDao.addDetail(resourceId, name, value, true);

            break;

        case Account:
            final AccountVO account = _accountDao.findById(resourceId);
            if (account == null) {
                throw new InvalidParameterValueException("unable to find account by id " + resourceId);
            }
            AccountDetailVO accountDetailVO = _accountDetailsDao.findDetail(resourceId, name);
            if (accountDetailVO == null) {
                accountDetailVO = new AccountDetailVO(resourceId, name, value);
                _accountDetailsDao.persist(accountDetailVO);
            } else {
                accountDetailVO.setValue(value);
                _accountDetailsDao.update(accountDetailVO.getId(), accountDetailVO);
            }
            break;

        case ImageStore:
            final ImageStoreVO imgStore = _imageStoreDao.findById(resourceId);
            Preconditions.checkState(imgStore != null);
            _imageStoreDetailsDao.addDetail(resourceId, name, value, true);
            break;

        default:
            throw new InvalidParameterValueException("Scope provided is invalid");
        }
        return value;
    }

    // Execute all updates in a single transaction
    final TransactionLegacy txn = TransactionLegacy.currentTxn();
    txn.start();

    if (!_configDao.update(name, category, value)) {
        s_logger.error("Failed to update configuration option, name: " + name + ", value:" + value);
        throw new CloudRuntimeException("Failed to update configuration value. Please contact Cloud Support.");
    }

    PreparedStatement pstmt = null;
    if (Config.XenServerGuestNetwork.key().equalsIgnoreCase(name)) {
        final String sql = "update host_details set value=? where name=?";
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setString(1, value);
            pstmt.setString(2, "guest.network.device");

            pstmt.executeUpdate();
        } catch (final Throwable e) {
            throw new CloudRuntimeException(
                    "Failed to update guest.network.device in host_details due to exception ", e);
        }
    } else if (Config.XenServerPrivateNetwork.key().equalsIgnoreCase(name)) {
        final String sql = "update host_details set value=? where name=?";
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setString(1, value);
            pstmt.setString(2, "private.network.device");

            pstmt.executeUpdate();
        } catch (final Throwable e) {
            throw new CloudRuntimeException(
                    "Failed to update private.network.device in host_details due to exception ", e);
        }
    } else if (Config.XenServerPublicNetwork.key().equalsIgnoreCase(name)) {
        final String sql = "update host_details set value=? where name=?";
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setString(1, value);
            pstmt.setString(2, "public.network.device");

            pstmt.executeUpdate();
        } catch (final Throwable e) {
            throw new CloudRuntimeException(
                    "Failed to update public.network.device in host_details due to exception ", e);
        }
    } else if (Config.XenServerStorageNetwork1.key().equalsIgnoreCase(name)) {
        final String sql = "update host_details set value=? where name=?";
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setString(1, value);
            pstmt.setString(2, "storage.network.device1");

            pstmt.executeUpdate();
        } catch (final Throwable e) {
            throw new CloudRuntimeException(
                    "Failed to update storage.network.device1 in host_details due to exception ", e);
        }
    } else if (Config.XenServerStorageNetwork2.key().equals(name)) {
        final String sql = "update host_details set value=? where name=?";
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setString(1, value);
            pstmt.setString(2, "storage.network.device2");

            pstmt.executeUpdate();
        } catch (final Throwable e) {
            throw new CloudRuntimeException(
                    "Failed to update storage.network.device2 in host_details due to exception ", e);
        }
    } else if (Config.SecStorageSecureCopyCert.key().equalsIgnoreCase(name)) {
        //FIXME - Ideally there should be a listener model to listen to global config changes and be able to take action gracefully.
        //Expire the download urls
        final String sqlTemplate = "update template_store_ref set download_url_created=?";
        final String sqlVolume = "update volume_store_ref set download_url_created=?";
        try {
            // Change for templates
            pstmt = txn.prepareAutoCloseStatement(sqlTemplate);
            pstmt.setDate(1, new Date(-1l));// Set the time before the epoch time.
            pstmt.executeUpdate();
            // Change for volumes
            pstmt = txn.prepareAutoCloseStatement(sqlVolume);
            pstmt.setDate(1, new Date(-1l));// Set the time before the epoch time.
            pstmt.executeUpdate();
            // Cleanup the download urls
            _storageManager.cleanupDownloadUrls();
        } catch (final Throwable e) {
            throw new CloudRuntimeException(
                    "Failed to clean up download URLs in template_store_ref or volume_store_ref due to exception ",
                    e);
        }
    }

    txn.commit();
    return _configDao.getValue(name);
}

From source file:joshuatee.wx.ModelInterfaceActivity.java

private String ConvertTimeRuntoTimeString(String run_str, String time_str) {

    int run_int = Integer.parseInt(run_str);
    int time_int = Integer.parseInt(time_str);
    int real_time_gmt = run_int + time_int;
    TimeZone tz = TimeZone.getDefault();
    Date now = new Date(System.currentTimeMillis());
    int offsetFromUtc = tz.getOffset(now.getTime()) / 1000;
    int real_time = real_time_gmt + offsetFromUtc / 60 / 60;
    int hour_of_day = real_time % 24;
    String am_pm = "";
    if (hour_of_day > 11) {
        am_pm = "pm";
        if (hour_of_day > 12) {
            hour_of_day = hour_of_day - 12;
        }//from  w ww  .  j av a  2s. co m
    } else {
        am_pm = "am";
    }

    int day = (int) real_time / 24;

    if (hour_of_day < 0) {
        hour_of_day = 12 + hour_of_day;
        am_pm = "pm";
        day--;
    }

    Calendar calendar = Calendar.getInstance();
    int day_of_week = calendar.get(Calendar.DAY_OF_WEEK);
    int hour_of_day_local = calendar.get(Calendar.HOUR_OF_DAY);

    if (run_int >= 0 && run_int < -offsetFromUtc / 60 / 60
            && (hour_of_day_local - offsetFromUtc / 60 / 60) >= 24) {
        day++;
    }

    String future_day = "";

    switch ((day_of_week + day) % 7) {
    case Calendar.SUNDAY:
        future_day = "Sun";
        break;
    case Calendar.MONDAY:
        future_day = "Mon";
        break;
    case Calendar.TUESDAY:
        future_day = "Tue";
        break;
    case Calendar.WEDNESDAY:
        future_day = "Wed";
        break;
    case Calendar.THURSDAY:
        future_day = "Thu";
        break;
    case Calendar.FRIDAY:
        future_day = "Fri";
        break;
    case 0:

        future_day = "Sat";
        break;
    }

    //return  future_day + "  "+hour_of_day.toString()+ am_pm;
    return future_day + "  " + Integer.toString(hour_of_day) + am_pm;

}

From source file:org.apache.phoenix.end2end.DateTimeIT.java

@Test
public void testNowFunction() throws Exception {
    String tableName = generateUniqueName();
    Date date = new Date(System.currentTimeMillis());
    String ddl = "CREATE TABLE IF NOT EXISTS " + tableName
            + " (k1 INTEGER NOT NULL, timestamps TIMESTAMP CONSTRAINT pk PRIMARY KEY (k1))";
    conn.createStatement().execute(ddl);
    String dml = "UPSERT INTO " + tableName + " VALUES (?, ?)";
    PreparedStatement stmt = conn.prepareStatement(dml);
    stmt.setInt(1, 1);/*from   w  ww  . j a  va 2 s.c  om*/
    stmt.setDate(2, new Date(date.getTime() - 500));
    stmt.execute();
    stmt.setInt(1, 2);
    stmt.setDate(2, new Date(date.getTime() + 600000));
    stmt.execute();
    conn.commit();

    ResultSet rs = conn.createStatement()
            .executeQuery("SELECT * from " + tableName + "  where now() > timestamps");
    assertTrue(rs.next());
    assertEquals(1, rs.getInt(1));
    assertEquals(new Date(date.getTime() - 500), rs.getDate(2));
    assertFalse(rs.next());
}

From source file:org.ednovo.gooru.controllers.v2.api.CollectionRestV2Controller.java

private Collection buildCollectionFromInputParameters(final String data, final User user,
        final HttpServletRequest request) {
    final Collection collection = JsonDeserializer.deserialize(data, Collection.class);
    collection.setGooruOid(UUID.randomUUID().toString());
    collection.setLastModified(new Date(System.currentTimeMillis()));
    collection.setCreatedOn(new Date(System.currentTimeMillis()));

    collection.setSharing(collection.getSharing() != null
            && (collection.getSharing().equalsIgnoreCase(Sharing.PRIVATE.getSharing())
                    || collection.getSharing().equalsIgnoreCase(Sharing.PUBLIC.getSharing())
                    || collection.getSharing().equalsIgnoreCase(Sharing.ANYONEWITHLINK.getSharing()))
                            ? collection.getSharing()
                            : Sharing.ANYONEWITHLINK.getSharing());

    collection.setUser(user);/*ww  w .jav a2s  .com*/
    collection.setOrganization(user.getPrimaryOrganization());
    collection.setCreator(user);
    collection.setLastUpdatedUserUid(user.getGooruUId());
    if (collection.getCollectionType() == null) {
        collection.setCollectionType(getCollectionType(request));
    }
    final ContentType contentType = getCollectionService().getContentType(collection.getCollectionType());
    collection.setContentType(contentType);

    return collection;
}

From source file:mobile.tiis.appv2.LoginActivity.java

private void evaluateIfFirstLogin(String userID) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    SharedPreferences.Editor editor = prefs.edit();
    boolean sameDate = false;

    long mostRecentLoginDay = prefs.getLong("mostRecentLoginDay", 0);
    Calendar mostRecentDate = Calendar.getInstance();
    mostRecentDate.setTime(new Date(mostRecentLoginDay));
    Calendar today = Calendar.getInstance();
    if (mostRecentDate.get(Calendar.DAY_OF_MONTH) == today.get(Calendar.DAY_OF_MONTH)
            && mostRecentDate.get(Calendar.MONTH) == today.get(Calendar.MONTH)
            && mostRecentDate.get(Calendar.YEAR) == today.get(Calendar.YEAR)) {
        sameDate = true;//from   ww  w .  java  2 s .c o m
    } else {
        sameDate = false;
    }

    if (!sameDate) {
        editor.putLong("mostRecentLoginDay", today.getTimeInMillis());
        editor.putBoolean("firstLoginOfDaySyncNeeded", true);
        editor.apply();
    }
}

From source file:com.sfs.whichdoctor.dao.RotationDAOImpl.java

/**
 * Save the RotationBean./*from   www.  ja v a  2 s  .  c om*/
 *
 * @param rotation the rotation
 * @param checkUser the check user
 * @param privileges the privileges
 * @param action the action
 *
 * @return the int
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
private int save(final RotationBean rotation, final UserBean checkUser, final PrivilegesBean privileges,
        final String action) throws WhichDoctorDaoException {

    /* Create rotation requires all the essential rotation information */
    if (StringUtils.isBlank(rotation.getDescription())) {
        throw new NullPointerException("Rotation description field cannot be an empty string");
    }
    if (StringUtils.isBlank(rotation.getRotationType())) {
        throw new WhichDoctorDaoException("Rotation type field cannot be an empty string");
    }
    if (rotation.getStartDate() == null) {
        throw new WhichDoctorDaoException("Rotation requires a start date");
    }
    if (rotation.getEndDate() == null) {
        throw new WhichDoctorDaoException("Rotation requires an end date");
    }
    if (rotation.getPersonId() == 0) {
        throw new WhichDoctorDaoException("Rotation requires a valid person GUID");
    }
    if (!privileges.getPrivilege(checkUser, "rotations", action)) {
        throw new WhichDoctorDaoException("Insufficient user credentials to " + action + " rotation");
    }

    int rotationTypeId = 0;
    int trainingTypeId = 0;
    int organisation1TypeId = 0;
    int organisation2TypeId = 0;

    if (StringUtils.isNotBlank(rotation.getOrganisation1Type())) {
        try {
            ObjectTypeBean object = this.getObjectTypeDAO().load("Rotation Site Type", "",
                    rotation.getOrganisation1Type());
            organisation1TypeId = object.getObjectTypeId();
        } catch (SFSDaoException sfe) {
            dataLogger.error("Error loading objecttype for the rotation site type: " + sfe.getMessage());
        }
    }

    if (StringUtils.isNotBlank(rotation.getTrainingClass())) {
        try {
            ObjectTypeBean object = this.getObjectTypeDAO().load("Rotation Training Type",
                    rotation.getTrainingType(), rotation.getTrainingClass());
            trainingTypeId = object.getObjectTypeId();
        } catch (SFSDaoException sfe) {
            dataLogger.error("Error loading objecttype for the training type: " + sfe.getMessage());
        }
    }

    try {
        ObjectTypeBean object = this.getObjectTypeDAO().load("Rotation Type", "", rotation.getRotationType());
        rotationTypeId = object.getObjectTypeId();
    } catch (Exception e) {
        dataLogger.error("Error loading objecttype for rotation type: " + e.getMessage());
        throw new WhichDoctorDaoException("Rotation requires a valid type");
    }

    if (StringUtils.isNotBlank(rotation.getOrganisation2Type())) {
        try {
            ObjectTypeBean object = this.getObjectTypeDAO().load("Rotation Site Type", "",
                    rotation.getOrganisation2Type());
            organisation2TypeId = object.getObjectTypeId();
        } catch (SFSDaoException sfe) {
            dataLogger.error("Error loading objecttype for the rotation site type: " + sfe.getMessage());
        }
    }

    /* Load the current rotation to get the existing organisations */
    Collection<Integer> existingOrganisations = new ArrayList<Integer>();
    if (rotation.getGUID() > 0) {
        try {
            RotationBean existing = this.loadGUID(rotation.getGUID());
            if (existing.getOrganisation1Id() > 0) {
                existingOrganisations.add(existing.getOrganisation1Id());
            }
            if (existing.getOrganisation2Id() > 0) {
                existingOrganisations.add(existing.getOrganisation2Id());
            }
        } catch (WhichDoctorDaoException wde) {
            dataLogger.error("Error loading existing rotation: " + wde.getMessage());
        }
    }

    int rotationId = 0;

    Timestamp sqlTimeStamp = new Timestamp(Calendar.getInstance().getTimeInMillis());
    Date startDate = new Date(Calendar.getInstance().getTimeInMillis());
    if (rotation.getStartDate() != null) {
        startDate = new Date(rotation.getStartDate().getTime());
    }
    Date endDate = new Date(Calendar.getInstance().getTimeInMillis());
    if (rotation.getEndDate() != null) {
        endDate = new Date(rotation.getEndDate().getTime());
    }
    String organisation1Name = "";
    String organisation2Name = "";
    if (rotation.getOrganisation1() == null) {
        organisation1Name = rotation.getOrganisation1Name();
    }
    if (rotation.getOrganisation2() == null) {
        organisation2Name = rotation.getOrganisation2Name();
    }

    ArrayList<Object> parameters = new ArrayList<Object>();
    parameters.add(rotation.getDescription());
    parameters.add(rotationTypeId);
    parameters.add(trainingTypeId);
    parameters.add(startDate);
    parameters.add(endDate);
    parameters.add(getRotationYear(rotation.getStartDate(), rotation.getEndDate()));
    parameters.add(rotation.getOrganisation1Id());
    parameters.add(rotation.getOrganisation2Id());
    parameters.add(organisation1TypeId);
    parameters.add(organisation2TypeId);
    parameters.add(organisation1Name);
    parameters.add(organisation2Name);
    parameters.add(rotation.getPersonId());
    parameters.add(rotation.getLeaveDays());
    parameters.add(rotation.getTrainingTime());
    parameters.add(rotation.getCommitteeName());
    parameters.add(rotation.getActive());
    parameters.add(sqlTimeStamp);
    parameters.add(checkUser.getDN());
    parameters.add(rotation.getLogMessage(action));

    try {
        Integer[] result = this.performUpdate("rotation", rotation.getGUID(), parameters, "Rotation", checkUser,
                action);
        /* Set the returned guid and id values */
        rotation.setGUID(result[0]);
        rotationId = result[1];
    } catch (Exception e) {
        dataLogger.error("Error processing rotation record: " + e.getMessage());
        throw new WhichDoctorDaoException("Error processing rotation record: " + e.getMessage());
    }

    if (rotationId > 0) {
        dataLogger.info(checkUser.getDN() + " created rotationId: " + String.valueOf(rotationId));

        postProcessRotationChange(action, checkUser, privileges, rotation, existingOrganisations);
    }

    return rotationId;
}

From source file:com.hichinaschool.flashcards.libanki.Utils.java

/**
 * Return the date corresponding to the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1.
 * @param ordinal representing the days since 01/01/01
 * @return Date converted from the ordinal
 *//*from  w  ww .j  av a 2  s .  c  o m*/
public static Date ordinalToDate(int ordinal) {
    return new Date((new BigDate(ordinal - DAYS_BEFORE_1970)).getLocalDate().getTime());
}

From source file:org.kuali.coeus.common.budget.impl.calculator.AbstractBudgetCalculator.java

/**
 * Use the combined &amp; sorted Prop &amp; LA rates to create Boundary objects. Each Boundary will contain start date &amp; end date. Check
 * whether any rate changes, and break at this point to create a new boundary.
 * // w w w  .  j a  v a2 s  .  c o m
 * @return List of boundary objects
 */
public List<Boundary> createBreakupBoundaries(QueryList<AbstractBudgetRate> qlCombinedRates, Date liStartDate,
        Date liEndDate) {
    List<Boundary> boundaries = new ArrayList<Boundary>();
    if (qlCombinedRates != null && qlCombinedRates.size() > 0) {
        Date tempStartDate = liStartDate;
        Date tempEndDate = liEndDate;
        Date rateChangeDate;
        GreaterThan greaterThan = new GreaterThan(START_DATE, liStartDate);
        qlCombinedRates = qlCombinedRates.filter(greaterThan);
        qlCombinedRates.sort(START_DATE, true);
        for (AbstractBudgetRate laRate : qlCombinedRates) {
            rateChangeDate = laRate.getStartDate();
            if (rateChangeDate.after(tempStartDate)) {
                Calendar temEndCal = dateTimeService.getCalendar(rateChangeDate);
                temEndCal.add(Calendar.DAY_OF_MONTH, -1);
                try {
                    tempEndDate = dateTimeService.convertToSqlDate(temEndCal.get(Calendar.YEAR) + "-"
                            + (temEndCal.get(Calendar.MONTH) + 1) + "-" + temEndCal.get(Calendar.DAY_OF_MONTH));
                } catch (ParseException e) {
                    tempEndDate = new Date(rateChangeDate.getTime() - 86400000);
                }
                Boundary boundary = new Boundary(tempStartDate, tempEndDate);
                boundaries.add(boundary);
                tempStartDate = rateChangeDate;
            }
        }
        /**
         * add one more boundary if no rate change on endDate and atleast one boundary is present
         */
        if (boundaries.size() > 0) {
            Boundary boundary = new Boundary(tempStartDate, liEndDate);
            boundaries.add(boundary);
        }
        /**
         * if no rate changes during the period create one boundary with startDate &amp; endDate same as that for line item
         */
        if (boundaries.size() == 0) {
            Boundary boundary = new Boundary(liStartDate, liEndDate);
            boundaries.add(boundary);
        }
    }
    return boundaries;
}

From source file:org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpressionWriterFactory.java

private static VectorExpressionWriter genVectorExpressionWritableDate(
        SettableDateObjectInspector fieldObjInspector) throws HiveException {
    return new VectorExpressionWriterLong() {
        private Date dt;
        private Object obj;

        public VectorExpressionWriter init(SettableDateObjectInspector objInspector) throws HiveException {
            super.init(objInspector);
            dt = new Date(0);
            obj = initValue(null);//from   w w w.j a  v  a  2s .c om
            return this;
        }

        @Override
        public Object writeValue(long value) {
            dt.setTime(DateWritable.daysToMillis((int) value));
            ((SettableDateObjectInspector) this.objectInspector).set(obj, dt);
            return obj;
        }

        @Override
        public Object setValue(Object field, long value) {
            if (null == field) {
                field = initValue(null);
            }
            dt.setTime(DateWritable.daysToMillis((int) value));
            ((SettableDateObjectInspector) this.objectInspector).set(field, dt);
            return field;
        }

        @Override
        public Object initValue(Object ignored) {
            return ((SettableDateObjectInspector) this.objectInspector).create(new Date(0));
        }

    }.init(fieldObjInspector);
}

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

@Override
public void insertNummeraanduidingen(final List<Nummeraanduiding> nummeraanduidingen) throws DAOException {
    try {//from  ww  w.ja v  a  2 s. c o  m
        jdbcTemplate.batchUpdate("insert into bag_nummeraanduiding (" + "bag_nummeraanduiding_id,"
                + "aanduiding_record_inactief," + "aanduiding_record_correctie," + "huisnummer," + "officieel,"
                + "huisletter," + "huisnummertoevoeging," + "postcode," + "begindatum_tijdvak_geldigheid,"
                + "einddatum_tijdvak_geldigheid," + "in_onderzoek," + "type_adresseerbaar_object,"
                + "bron_documentdatum," + "bron_documentnummer," + "nummeraanduiding_status,"
                + "bag_woonplaats_id," + "bag_openbare_ruimte_id"
                + ") values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
                    @Override
                    public void setValues(PreparedStatement ps, int i) throws SQLException {
                        ps.setLong(1, nummeraanduidingen.get(i).getIdentificatie());
                        ps.setInt(2, nummeraanduidingen.get(i).getAanduidingRecordInactief().ordinal());
                        ps.setLong(3, nummeraanduidingen.get(i).getAanduidingRecordCorrectie());
                        ps.setInt(4, nummeraanduidingen.get(i).getHuisnummer());
                        ps.setInt(5, nummeraanduidingen.get(i).getOfficieel().ordinal());
                        if (nummeraanduidingen.get(i).getHuisletter() == null)
                            ps.setNull(6, Types.VARCHAR);
                        else
                            ps.setString(6, nummeraanduidingen.get(i).getHuisletter());
                        if (nummeraanduidingen.get(i).getHuisnummertoevoeging() == null)
                            ps.setNull(7, Types.VARCHAR);
                        else
                            ps.setString(7, nummeraanduidingen.get(i).getHuisnummertoevoeging());
                        if (nummeraanduidingen.get(i).getPostcode() == null)
                            ps.setNull(8, Types.VARCHAR);
                        else
                            ps.setString(8, nummeraanduidingen.get(i).getPostcode());
                        ps.setTimestamp(9, new Timestamp(
                                nummeraanduidingen.get(i).getBegindatumTijdvakGeldigheid().getTime()));
                        if (nummeraanduidingen.get(i).getEinddatumTijdvakGeldigheid() == null)
                            ps.setNull(10, Types.TIMESTAMP);
                        else
                            ps.setTimestamp(10, new Timestamp(
                                    nummeraanduidingen.get(i).getEinddatumTijdvakGeldigheid().getTime()));
                        ps.setInt(11, nummeraanduidingen.get(i).getInOnderzoek().ordinal());
                        ps.setInt(12, nummeraanduidingen.get(i).getTypeAdresseerbaarObject().ordinal());
                        ps.setDate(13, new Date(nummeraanduidingen.get(i).getDocumentdatum().getTime()));
                        ps.setString(14, nummeraanduidingen.get(i).getDocumentnummer());
                        ps.setInt(15, nummeraanduidingen.get(i).getNummeraanduidingStatus().ordinal());
                        if (nummeraanduidingen.get(i).getGerelateerdeWoonplaats() == null)
                            ps.setNull(16, Types.INTEGER);
                        else
                            ps.setLong(16, nummeraanduidingen.get(i).getGerelateerdeWoonplaats());
                        ps.setLong(17, nummeraanduidingen.get(i).getGerelateerdeOpenbareRuimte());
                    }

                    @Override
                    public int getBatchSize() {
                        return nummeraanduidingen.size();
                    }
                });
    } catch (DataAccessException e) {
        throw new DAOException("Error inserting nummeraanduidingen", e);
    }
}