X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fmusic%2Fdatastore%2Fjsonobjects%2FJsonInsert.java;h=57ff245a4da8d99cbd62925cb1703481cac8b04b;hb=6aad1c6198726b0e7963db363ea0cfc28e93fcd5;hp=8e8404b795aede8ccd0472f3abf42dac030a478c;hpb=85e7c6bb431ee849eab28b3fa6e9de9b40b7863a;p=music.git diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java index 8e8404b7..57ff245a 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java @@ -44,7 +44,6 @@ import org.onap.music.eelf.logging.format.ErrorTypes; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; import org.onap.music.main.MusicUtil; -import org.onap.music.main.ReturnType; import com.datastax.driver.core.DataType; import com.datastax.driver.core.TableMetadata; @@ -184,13 +183,11 @@ public class JsonInsert implements Serializable { try { tableInfo = MusicDataStoreHandle.returnColumnMetadata(this.getKeyspaceName(), this.getTableName()); if(tableInfo == null) { - //return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError("Table name doesn't exists. Please check the table name.").toMap()).build(); throw new MusicQueryException("Table name doesn't exists. Please check the table name.", Status.BAD_REQUEST.getStatusCode()); } } catch (MusicServiceException e) { logger.error(EELFLoggerDelegate.errorLogger, e, AppMessages.UNKNOWNERROR ,ErrorSeverity.CRITICAL, ErrorTypes.GENERALSERVICEERROR); - //return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError(e.getMessage()).toMap()).build(); throw new MusicQueryException(e.getMessage(),Status.BAD_REQUEST.getStatusCode()); } @@ -203,8 +200,6 @@ public class JsonInsert implements Serializable { Map valuesMap = this.getValues(); if (valuesMap==null) { - //return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE) - //.setError("Nothing to insert. No values provided in request.").toMap()).build(); throw new MusicQueryException("Nothing to insert. No values provided in request.", Status.BAD_REQUEST.getStatusCode()); } @@ -223,7 +218,6 @@ public class JsonInsert implements Serializable { } catch(NullPointerException ex) { logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage() +" Invalid column name : "+entry.getKey (), AppMessages.INCORRECTDATA ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR, ex); - //return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError("Invalid column name : "+entry.getKey()).toMap()).build(); throw new MusicQueryException("Invalid column name : " + entry.getKey(), Status.BAD_REQUEST.getStatusCode()); } @@ -277,7 +271,6 @@ public class JsonInsert implements Serializable { this.setPrimaryKeyVal(primaryKey); if(primaryKey == null || primaryKey.length() <= 0) { logger.error(EELFLoggerDelegate.errorLogger, "Some required partition key parts are missing: "+primaryKeyName ); - //return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.SYNTAXERROR).setError("Some required partition key parts are missing: "+primaryKeyName).toMap()).build(); throw new MusicQueryException("Some required partition key parts are missing: " + primaryKeyName, Status.BAD_REQUEST.getStatusCode()); } @@ -312,13 +305,11 @@ public class JsonInsert implements Serializable { queryObject.appendQueryString(";"); - ReturnType result = null; String consistency = this.getConsistencyInfo().get("type"); if(consistency.equalsIgnoreCase(MusicUtil.EVENTUAL) && this.getConsistencyInfo().get("consistency") != null) { if(MusicUtil.isValidConsistency(this.getConsistencyInfo().get("consistency"))) { queryObject.setConsistency(this.getConsistencyInfo().get("consistency")); } else { - // return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.SYNTAXERROR).setError("Invalid Consistency type").toMap()).build(); throw new MusicQueryException("Invalid Consistency type", Status.BAD_REQUEST.getStatusCode()); } } @@ -341,9 +332,6 @@ public class JsonInsert implements Serializable { if((this.getKeyspaceName() == null || this.getKeyspaceName().isEmpty()) || (this.getTableName() == null || this.getTableName().isEmpty())){ - /* return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE) - .setError("one or more path parameters are not set, please check and try again") - .toMap()).build();*/ throw new MusicQueryException("one or more path parameters are not set, please check and try again", Status.BAD_REQUEST.getStatusCode()); } @@ -355,7 +343,6 @@ public class JsonInsert implements Serializable { } catch (MusicServiceException ex) { logger.error(EELFLoggerDelegate.errorLogger,ex, AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes .GENERALSERVICEERROR, ex); - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError(ex.getMessage()).toMap()).build();*/ throw new MusicQueryException(ex.getMessage(), Status.BAD_REQUEST.getStatusCode()); }