public class DomainPingConfiguration implements IdCachable {
- public static enum PingType {
- EMAIL, DNS, HTTP, SSL;
- }
-
private int id;
private Domain target;
- private PingType type;
+ private DomainPingType type;
private String info;
private DomainPingConfiguration(int id) {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id, domainid, type, info FROM pingconfig WHERE id=?");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `id`, `domainid`, `type`, `info` FROM `pingconfig` WHERE `id`=?");
ps.setInt(1, id);
GigiResultSet rs = ps.executeQuery();
}
this.id = rs.getInt("id");
target = Domain.getById(rs.getInt("domainid"));
- type = PingType.valueOf(rs.getString("type").toUpperCase());
+ type = DomainPingType.valueOf(rs.getString("type").toUpperCase());
info = rs.getString("info");
}
return target;
}
- public PingType getType() {
+ public DomainPingType getType() {
return type;
}
}
public Date getLastExecution() {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from domainPinglog WHERE configId=? ORDER BY `when` DESC LIMIT 1");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from `domainPinglog` WHERE `configId`=? ORDER BY `when` DESC LIMIT 1");
ps.setInt(1, id);
GigiResultSet rs = ps.executeQuery();
if (rs.next()) {
}
public Date getLastSuccess() {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from domainPinglog WHERE configId=? AND state='success' ORDER BY `when` DESC LIMIT 1");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from `domainPinglog` WHERE `configId`=? AND state='success' ORDER BY `when` DESC LIMIT 1");
ps.setInt(1, id);
GigiResultSet rs = ps.executeQuery();
if (rs.next()) {
}
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", new Date(lastExecution.getTime() + 5 * 60 * 1000));
- throw new GigiApiException(new Scope(new SprintfCommand("Reping is only allowed after 5 minutes, yours end at {0}.", Arrays.asList("$data")), data));
+ throw new GigiApiException(new Scope(new SprintfCommand("Reping is only allowed after 5 minutes, yours end at {0}.", Arrays.asList("${data}")), data));
}
}