+ return response.status(Status.OK).entity(resultMap).build();
+ }
+
+
+
+ //Dashboard related calls
+ @GET
+ @Path("/getall")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public List<Application> getall(@ApiParam(value = "Authorization", required = true) @HeaderParam(MusicUtil.AUTHORIZATION) String authorization) throws MusicServiceException{
+ List<Application> appList = new ArrayList<>();
+ ResponseBuilder response =
+ Response.noContent().header("X-latestVersion", MusicUtil.getVersion());
+ if (!authenticator.authenticateAdmin(authorization)) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Unauthorized: Please check admin username,password and try again", AppMessages.AUTHENTICATIONERROR, ErrorSeverity.CRITICAL,
+ ErrorTypes.AUTHENTICATIONERROR);
+ return appList;
+ }
+
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString("SELECT * FROM " + "admin" + "." + "keyspace_master" + ";");
+ ResultSet results = MusicCore.get(queryObject);
+ for(Row row : results) {
+ Application app = new Application();
+ app.setApplication_name(row.getString("application_name"));
+ app.setIs_aaf(row.getBool("is_aaf"));
+ app.setIs_api(row.getBool("is_api"));
+ app.setUsername(row.getString("username"));
+ app.setKeyspace_name(row.getString("keyspace_name"));
+ app.setUuid(row.getUUID("uuid").toString());
+ appList.add(app);
+ }
+ return appList;
+
+ //return app;
+
+ }
+ @DELETE
+ @Path("/delete")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public boolean delete(@ApiParam(value = "Authorization", required = true) @HeaderParam(MusicUtil.AUTHORIZATION) String authorization,
+ @ApiParam(value = "uuid", required = true) @HeaderParam("uuid") String uuid) throws Exception {
+ ResponseBuilder response =
+ Response.noContent().header("X-latestVersion", MusicUtil.getVersion());
+ if (!authenticator.authenticateAdmin(authorization)) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Unauthorized: Please check admin username,password and try again", AppMessages.AUTHENTICATIONERROR, ErrorSeverity.CRITICAL,
+ ErrorTypes.AUTHENTICATIONERROR);
+ return false;
+ }
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString("delete from admin.keyspace_master where uuid=?");
+ queryObject.addValue(MusicUtil.convertToActualDataType(DataType.uuid(),uuid));
+ ResultType result;
+ try {
+ result = MusicCore.nonKeyRelatedPut(queryObject, "eventual");
+ }catch(Exception ex) {
+ return false;
+ }
+ return true;