@Override public StoredWorkflowDefinitionWithProject map(int index, ResultSet r, StatementContext ctx) throws SQLException { String projName = r.getString("proj_name"); Optional<Instant> projDeletedAt = Optional.absent(); if (r.wasNull()) { projName = r.getString("proj_deleted_name"); projDeletedAt = Optional.of(getTimestampInstant(r, "proj_deleted_at")); } return ImmutableStoredWorkflowDefinitionWithProject.builder() .id(r.getLong("id")) .revisionId(r.getInt("revision_id")) .timeZone(ZoneId.of(r.getString("timezone"))) .name(r.getString("name")) .config(cfm.fromResultSetOrEmpty(r, "config")) .project( ImmutableStoredProject.builder() .id(r.getInt("proj_id")) .name(projName) .siteId(r.getInt("site_id")) .createdAt(getTimestampInstant(r, "proj_created_at")) .deletedAt(projDeletedAt) .build()) .revisionName(r.getString("rev_name")) .revisionDefaultParams(cfm.fromResultSetOrEmpty(r, "rev_default_params")) .build(); }
@Override public StoredProject map(int index, ResultSet r, StatementContext ctx) throws SQLException { String name = r.getString("name"); Optional<Instant> deletedAt = Optional.absent(); if (r.wasNull()) { name = r.getString("deleted_name"); deletedAt = Optional.of(getTimestampInstant(r, "deleted_at")); } return ImmutableStoredProject.builder() .id(r.getInt("id")) .name(name) .siteId(r.getInt("site_id")) .createdAt(getTimestampInstant(r, "created_at")) .deletedAt(deletedAt) .build(); }