package uk.gov.register.presentation.dao;

import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.TimeZone;

public class EntryMapper implements ResultSetMapper<Entry> {
    @Override
    public Entry map(int index, ResultSet r, StatementContext ctx) throws SQLException {
        Calendar cal = Calendar.getInstance();
        cal.setTimeZone(TimeZone.getTimeZone("UTC"));

        return new Entry(r.getString("entry_number"), r.getString("sha256hex"), r.getTimestamp("timestamp", cal).toInstant());
    }
}

@@ -452,35 +452,8 @@
 nce(
-);%0A        cal.setTimeZone(
 Time
@@ -478,17 +478,16 @@
 UTC%22));%0A
-%0A
         

Simplify calendar creation in EntryMapper