}
- public CertificateStatus getStatus() {
+ public synchronized CertificateStatus getStatus() {
if (id == 0) {
return CertificateStatus.DRAFT;
}
}
protected int insert() {
- if (id != 0) {
- throw new Error("refusing to insert");
- }
synchronized (User.class) {
+ if (id != 0) {
+ throw new Error("refusing to insert");
+ }
GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO certOwners() VALUES()");
ps.execute();
id = ps.lastInsertId();
}
public void insert() throws GigiApiException {
- if (id != 0) {
- throw new GigiApiException("already inserted.");
- }
synchronized (Domain.class) {
+ if (id != 0) {
+ throw new GigiApiException("already inserted.");
+ }
checkInsert(suffix);
GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO `domains` SET memid=?, domain=?");
ps.setInt(1, owner.getId());
}
public void insert(Language l) throws GigiApiException {
- if (id != 0) {
- throw new IllegalStateException("already inserted.");
- }
try {
+ if (id != 0) {
+ throw new IllegalStateException("already inserted.");
+ }
GigiPreparedStatement psCheck = DatabaseConnection.getInstance().prepare("SELECT 1 FROM `emails` WHERE email=? AND deleted is NULL");
GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO `emails` SET memid=?, hash=?, email=?");
ps.setInt(1, owner.getId());