working on address card editor

This commit is contained in:
2025-10-08 22:16:35 +02:00
parent 2f3a29d606
commit c888845191
14 changed files with 148 additions and 50 deletions

View File

@@ -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;
}
}