diff options
Diffstat (limited to 'src/main/java/org/onap/music/rest/RestMusicAdminAPI.java')
-rwxr-xr-x | src/main/java/org/onap/music/rest/RestMusicAdminAPI.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java index 0265d039..cbe9ec9c 100755 --- a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java +++ b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java @@ -39,6 +39,9 @@ import javax.ws.rs.core.MediaType; import org.onap.music.datastore.PreparedQueryObject; import org.onap.music.datastore.jsonobjects.JsonOnboard; import org.onap.music.eelf.logging.EELFLoggerDelegate; +import org.onap.music.eelf.logging.format.AppMessages; +import org.onap.music.eelf.logging.format.ErrorSeverity; +import org.onap.music.eelf.logging.format.ErrorTypes; import org.onap.music.main.CachingUtil; import org.onap.music.main.MusicCore; import org.onap.music.main.MusicUtil; @@ -72,6 +75,7 @@ public class RestMusicAdminAPI { String password = jsonObj.getPassword(); response.addHeader("X-latestVersion", MusicUtil.getVersion()); if (appName == null || userId == null || isAAF == null || password == null) { + logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.MISSINGINFO ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR); resultMap.put("Exception", "Please check the request parameters. Some of the required values appName(ns), userId, password, isAAF are missing."); return resultMap; @@ -163,8 +167,14 @@ public class RestMusicAdminAPI { Row row = (Row) it.next(); resultMap.put( row.getUUID("uuid").toString(),row.getString("keyspace_name")); } - if (resultMap.isEmpty()) - resultMap.put("ERROR", "Application is not onboarded. Please contact admin."); + if (resultMap.isEmpty()) { + if(uuid != null) + resultMap.put("Exception", "Please make sure Aid is correct and application is onboarded."); + else { + resultMap.put("Exception", + "Application is not onboarded. Please make sure all the information is correct."); + } + } return resultMap; } @@ -195,7 +205,7 @@ public class RestMusicAdminAPI { String ks = row.getString("keyspace_name"); if (!ks.equals(MusicUtil.DEFAULTKEYSPACENAME)) { PreparedQueryObject queryObject = new PreparedQueryObject(); - queryObject.appendQueryString("DROP KEYSPACE " + ks + ";"); + queryObject.appendQueryString("DROP KEYSPACE IF EXISTS " + ks + ";"); MusicCore.nonKeyRelatedPut(queryObject, consistency); } } @@ -208,7 +218,7 @@ public class RestMusicAdminAPI { resultMap.put("Success", "Your application has been deleted successfully"); } else { resultMap.put("Exception", - "Oops. Spomething went wrong. Please make sure Aid is correct or Application is onboarded"); + "Oops. Something went wrong. Please make sure Aid is correct or Application is onboarded"); } return resultMap; } @@ -325,7 +335,7 @@ public class RestMusicAdminAPI { resultMap.put("Success", "Your application has been updated successfully"); } else { resultMap.put("Exception", - "Oops. Spomething went wrong. Please make sure Aid is correct and application is onboarded"); + "Oops. Something went wrong. Please make sure Aid is correct and application is onboarded"); } return resultMap; |