@DELETE @Path("{route_id}") @Produces(MediaType.APPLICATION_JSON) public String deletePlace(@PathParam("route_id") String routeID) { syncCache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO)); JSONObject reply = new JSONObject(); try { syncCache.delete(routeID); return reply .append("status", "OK") .append("message", "successfully deleted route " + routeID + " from " + "memcache") .toString(); } catch (Exception e) { return new JSONObject().append("status", "fail").append("message", e.getMessage()).toString(); } }
@Override public Key add(Training object) { try { Entity training = new Entity(DatabaseInfo.TRAINING_DATABASE); training.setProperty(DatabaseInfo.TRAINING_TITLE, object.getTitle()); training.setProperty(DatabaseInfo.TRAINING_DOMAIN, object.getDomain()); training.setProperty(DatabaseInfo.TRAINING_DESCRIPTION, object.getDescription()); training.setProperty(DatabaseInfo.TRAINING_USER_MAIL, object.getUserMail()); training.setProperty(DatabaseInfo.TRAINING_TOTAL_DURATION, object.getTotalDuration()); Key trainingKey = dataStore.put(training); if (object.getExercises() != null && !object.getExercises().isEmpty()) { for (Exercise ex : object.getExercises()) { ex.setParentKey(trainingKey); exerciseDao.add(ex); } } return trainingKey; } catch (Exception e) { System.out.println(e.getMessage()); } return null; }