use of net.javadiscord.javabot.systems.jam.model.JamSubmission in project JavaBot by Java-Discord.
the class JamSubmissionRepository method readSubmission.
private JamSubmission readSubmission(ResultSet rs, Jam jam) throws SQLException {
JamSubmission submission = new JamSubmission();
submission.setId(rs.getLong("id"));
submission.setCreatedAt(rs.getTimestamp("created_at").toLocalDateTime());
submission.setJam(jam);
submission.setThemeName(rs.getString("theme_name"));
submission.setUserId(rs.getLong("user_id"));
submission.setSourceLink(rs.getString("source_link"));
submission.setDescription(rs.getString("description"));
return submission;
}
use of net.javadiscord.javabot.systems.jam.model.JamSubmission in project JavaBot by Java-Discord.
the class JamSubmissionRepository method getSubmission.
/**
* Gets a single submission based on the given submission id.
*
* @param jam The {@link Jam}.
* @param submissionId The submission's id.
* @return The {@link JamSubmission}.
* @throws SQLException If an error occurs.
*/
public JamSubmission getSubmission(Jam jam, long submissionId) throws SQLException {
PreparedStatement stmt = con.prepareStatement("SELECT * FROM jam_submission WHERE jam_id = ? AND id = ?");
stmt.setLong(1, jam.getId());
stmt.setLong(2, submissionId);
ResultSet rs = stmt.executeQuery();
JamSubmission submission = null;
if (rs.next()) {
submission = this.readSubmission(rs, jam);
}
stmt.close();
return submission;
}
Aggregations