Browse Source

Add unregister

Deben Oldert 10 years ago
parent
commit
8e64912784
1 changed files with 23 additions and 0 deletions
  1. 23 0
      SAS:APS Server/APS.java

+ 23 - 0
SAS:APS Server/APS.java

@@ -162,6 +162,29 @@ public class APS extends HttpServlet {
                         outputResult(response, ldapError, requestId, null);
                     }
                     break;
+                case "unregister":
+                    System.out.println("##### APS >> UNREGISTER");
+                    if((ldapError = ldap.userCheck()) == 0) {
+                        String[] keys = {"serviceType",
+                                         "serviceNumber",
+                                         "notificationId",
+                                         "apiKey",
+                                         "deviceId"};
+                        boolean state;
+                        for(String key : keys) {
+                            System.out.println("TRY: "+key);
+                            state = ldap.deleteInfo(key);
+                            if(!state) {
+                                outputResult(response, 82, requestId, null);
+                                return;
+                            }
+                        }
+                        outputResult(response, 0, requestId, null);
+                    }
+                    else {
+                        outputResult(response, ldapError, requestId, null);
+                    }
+                    break;
             }
         } catch (ParseException | NamingException ex) {
             Logger.getLogger(APS.class.getName()).log(Level.SEVERE, null, ex);