From d4d091e9c693f861fe9ad60a354897fd14a95808 Mon Sep 17 00:00:00 2001 From: ulrich Date: Sat, 10 Apr 2021 17:12:28 +0000 Subject: [PATCH] Sortierte Darstellung im Katalog --- src/de/uhilger/mediaz/api/ListHandler.java | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/src/de/uhilger/mediaz/api/ListHandler.java b/src/de/uhilger/mediaz/api/ListHandler.java index fe5c06e..781145e 100644 --- a/src/de/uhilger/mediaz/api/ListHandler.java +++ b/src/de/uhilger/mediaz/api/ListHandler.java @@ -95,9 +95,23 @@ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } + // DELETE /mz/api/alist/[pl-name]/[nr] den Titel an der Position [nr] aus der Liste [pl-name] entfernen @Override protected boolean delete(HttpExchange e) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + String path = e.getRequestURI().toString(); + String[] elems = path.split(Server.SLASH); + String listName = elems[elems.length - 2]; + + FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); + Entity entity = fs.read(Abspielliste.class.getSimpleName(), listName); + if(entity instanceof Abspielliste) { + Abspielliste liste = (Abspielliste) entity; + liste.getTitel().remove(Integer.parseInt(elems[elems.length-1])); + fs.write(liste, true); + return true; + } else { + return false; + } } } -- Gitblit v1.9.3