working on address card editor
This commit is contained in:
@@ -11,6 +11,7 @@ import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.notFound;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.text.MessageFormat.format;
|
||||
|
||||
import de.srsoftware.tools.jdbc.Query;
|
||||
import de.srsoftware.umbrella.core.BaseDb;
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
import de.srsoftware.umbrella.core.model.Contact;
|
||||
@@ -90,7 +91,13 @@ public class SqliteDb extends BaseDb implements ContactDb{
|
||||
|
||||
@Override
|
||||
public Contact save(Contact contact) {
|
||||
LOG.log(ERROR,"Save not implemented!");
|
||||
if (contact.id() == 0){ // new contact
|
||||
throw UmbrellaException.unprocessable("Storing of new contacts not implemented");
|
||||
} else try { // update
|
||||
Query.update(TABLE_CONTACTS).set(DATA).where(ID,equal(contact.id())).prepare(db).apply(contact.vcard()).execute();
|
||||
} catch (SQLException e) {
|
||||
throw databaseException("Failed to update vcard {0}",contact.id());
|
||||
}
|
||||
return contact;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user