From 95695a003402149799c33a29fa571251d59573b0 Mon Sep 17 00:00:00 2001 From: hilgeru <hilgeru@msgn07482.int.root.msg.ag> Date: Tue, 27 Feb 2018 15:17:49 +0000 Subject: [PATCH] Logging und Lizenz hinzugefuegt, Doku ergaenzt --- src/java/de/uhilger/radiozentrale/api/SenderApi.java | 34 +++++++++++++++++++--------------- 1 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/java/de/uhilger/radiozentrale/api/SenderApi.java b/src/java/de/uhilger/radiozentrale/api/SenderApi.java index 728ffad..8937d19 100644 --- a/src/java/de/uhilger/radiozentrale/api/SenderApi.java +++ b/src/java/de/uhilger/radiozentrale/api/SenderApi.java @@ -18,7 +18,6 @@ package de.uhilger.radiozentrale.api; -import de.uhilger.baselink.GenericRecord; import de.uhilger.baselink.PersistenceManager; import de.uhilger.radiozentrale.daten.Sender; import de.uhilger.radiozentrale.web.Initialiser; @@ -28,11 +27,9 @@ /** * */ -public class SenderApi extends Api { +public class SenderApi extends DbApi { public static final String SQL_GET_SENDER = "getSender"; - public static final String SQL_GET_NEXT_KEY = "getNextKey"; - public static final String SQL_INCREMENT_KEY = "incrementKey"; public static final String KEY_SENDER_ID = "sender_id"; @@ -56,19 +53,26 @@ return neuerSender; } + public Sender senderAendern(Sender sender) { + Sender geaendert = null; + Object o = getDb().update(sender, getMapper(Initialiser.MP_SENDER)); + if(o instanceof Sender) { + geaendert = (Sender) o; + } + return geaendert; + } + + public Sender senderLoeschen(Sender sender) { + Sender geloescht = null; + Object o = getDb().delete(sender, getMapper(Initialiser.MP_SENDER)); + if(o instanceof Sender) { + geloescht = (Sender) o; + } + return geloescht; + } + public List senderliste() { return getDb().select(getSql(SQL_GET_SENDER), getMapper(Initialiser.MP_SENDER)); } - private int getNextId(PersistenceManager db, String key) { - int nextKey = -1; - List<List<String>> list = db.select(getSql(SQL_GET_NEXT_KEY), GenericRecord.WITHOUT_BLOBS, key); - if(list != null && list.size() > 1) { - nextKey = Integer.parseInt(list.get(1).get(0)); // erster Datensatz ist Ueberschrift - if(nextKey > -1) { - db.execute(getSql(SQL_INCREMENT_KEY), nextKey+1, key, nextKey); - } - } - return nextKey; - } } -- Gitblit v1.9.3