Merge pull request 'lines formatted' (#16) from get_connection into master

Reviewed-on: #16
master
commit 3b62e5016c

@ -45,7 +45,9 @@ public class MailDAOImpl implements MailDAO {
try {
PreparedStatement stmt;
Connection conn = dataSource.getConnection();
stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT, PARAMETERS, TIME, FILENAME, EXPIRY_AT,UUID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", PreparedStatement.RETURN_GENERATED_KEYS);
stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT," +
" PARAMETERS, TIME, FILENAME, EXPIRY_AT,UUID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
PreparedStatement.RETURN_GENERATED_KEYS);
Timestamp current_time = new Timestamp(System.currentTimeMillis());
String parametersJson = new ObjectMapper().writeValueAsString(mailModel.getParameters());
stmt.setString(1, mailModel.getEmailAddress());
@ -86,7 +88,8 @@ public class MailDAOImpl implements MailDAO {
@Override
public List<MailModel> getUnsentMessages() {
String sql = "SELECT E.* FROM EMAIL E LEFT JOIN SENTEMAIL SE ON E.UUID = SE.UUID WHERE SE.UUID IS NULL AND (E.EXPIRY_AT IS NULL OR E.EXPIRY_AT > CURRENT_DATE)";
String sql = "SELECT E.* FROM EMAIL E LEFT JOIN SENTEMAIL SE ON E.UUID = SE.UUID WHERE SE.UUID IS NULL AND" +
"(E.EXPIRY_AT IS NULL OR E.EXPIRY_AT > CURRENT_DATE)";
List<MailModel> unsentMails = new ArrayList<>();
@ -171,6 +174,7 @@ public class MailDAOImpl implements MailDAO {
outputStream.write(buffer);
}
} catch (IOException e) {
logger.info(e.getMessage());
throw new FileConversionException("Error converting Blob to File", e);
}
return file;

@ -18,7 +18,8 @@ public class PriorityQueueHolder {
@Getter
private final AtomicLong insertionOrderCounter = new AtomicLong(1);
// PriorityBlockingQueue is thread-safe and supports ordering elements based on their natural order or a custom comparator.
// PriorityBlockingQueue is thread-safe and supports ordering elements based on their natural order or a
//custom comparator.
@Getter
private final BlockingQueue<MailModel> priorityQueue = new PriorityBlockingQueue<>(100, Comparator
.comparingLong(MailModel::getPriority)

Loading…
Cancel
Save