List of usage examples for com.mongodb MongoClient getDatabase
public MongoDatabase getDatabase(final String databaseName)
From source file:eu.vital.vitalcep.restApp.alert.Alerts.java
/** * Gets the filters./*from ww w . ja v a 2s . co m*/ * * @return the filters */ @GET @Path("getalerts") @Produces(MediaType.APPLICATION_JSON) public String getAlerts() { MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); BasicDBObject query = new BasicDBObject(); BasicDBObject fields = new BasicDBObject().append("_id", false); fields.append("dolceSpecification", false); FindIterable<Document> coll = db.getCollection("alerts").find(query).projection(fields); final JSONArray AllJson = new JSONArray(); coll.forEach(new Block<Document>() { @Override public void apply(final Document document) { AllJson.put(document); } }); if (db != null) db = null; if (mongo != null) { mongo.close(); mongo = null; } return AllJson.toString(); }
From source file:eu.vital.vitalcep.restApp.alert.Alerts.java
/** * Creates a filter.//w ww. j av a 2 s. co m * * @param cepico * @param req * @return the filter id * @throws java.io.IOException */ @PUT @Path("createalert") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createAlert(String cepico, @Context HttpServletRequest req) throws IOException { StringBuilder ck = new StringBuilder(); Security slogin = new Security(); JSONObject credentials = new JSONObject(); Boolean token = slogin.login(req.getHeader("name"), req.getHeader("password"), false, ck); credentials.put("username", req.getHeader("name")); credentials.put("password", req.getHeader("password")); if (!token) { return Response.status(Response.Status.UNAUTHORIZED).build(); } this.cookie = ck.toString(); JSONObject jo = new JSONObject(cepico); if (!jo.has("source")) { return Response.status(Response.Status.BAD_REQUEST).build(); } MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("alerts"); } catch (Exception e) { //System.out.println("Mongo is down"); mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } finally { if (db != null) db = null; if (mongo != null) { mongo.close(); mongo = null; } } // create an empty query BasicDBObject query = new BasicDBObject(); BasicDBObject fields = new BasicDBObject().append("_id", false); fields.append("dolceSpecification", false); if (jo.has("dolceSpecification")) { //Filter oFilter = new Filter(filter); JSONObject dsjo = jo.getJSONObject("dolceSpecification"); String str = dsjo.toString();//"{\"dolceSpecification\": "+ dsjo.toString()+"}"; try { DolceSpecification ds = new DolceSpecification(str); if (ds instanceof DolceSpecification) { UUID uuid = UUID.randomUUID(); String randomUUIDString = uuid.toString(); String mqin = RandomStringUtils.randomAlphanumeric(8); String mqout = RandomStringUtils.randomAlphanumeric(8); Date NOW = new Date(); JSONArray requestArray; try { requestArray = createAlertRequests(jo.getJSONArray("source"), ds.getEvents(), getXSDDateTime(NOW)); } catch (Exception e) { return Response.status(Response.Status.BAD_REQUEST) .entity("not available getObservation Service for this sensor ").build(); } CEP cepProcess = new CEP(); if (!(cepProcess.CEPStart(CEP.CEPType.ALERT, ds, mqin, mqout, confFile, requestArray.toString(), credentials))) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } String clientName = cepProcess.fileName; if (cepProcess.PID < 1) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } DBObject dbObject = createAlertSensor(cepico, randomUUIDString, dsjo, cepProcess.id); Document doc = new Document(dbObject.toMap()); try { db.getCollection("alerts").insertOne(doc); JSONObject opState = createOperationalStateObservation(randomUUIDString); String sensorId = host + "/sensor/" + randomUUIDString; MessageProcessor_publisher Publisher_MsgProcc = new MessageProcessor_publisher(this.dmsURL, cookie, sensorId, "alertsobservations", mongoURL, mongoDB);//555 MQTT_connector_subscriper publisher = new MQTT_connector_subscriper(mqout, Publisher_MsgProcc); MqttConnectorContainer.addConnector(publisher.getClientName(), publisher); DBObject oPut = (DBObject) JSON.parse(opState.toString()); Document doc1 = new Document(oPut.toMap()); try { db.getCollection("alertsobservations").insertOne(doc1); String id = doc1.get("_id").toString(); } catch (MongoException ex) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } JSONObject aOutput = new JSONObject(); aOutput.put("id", host + "/sensor/" + randomUUIDString); return Response.status(Response.Status.OK).entity(aOutput.toString()).build(); } catch (MongoException ex) { return Response.status(Response.Status.BAD_REQUEST).build(); } } else { return Response.status(Response.Status.BAD_REQUEST).build(); } } catch (JSONException | IOException e) { return Response.status(Response.Status.BAD_REQUEST).build(); } } return Response.status(Response.Status.BAD_REQUEST).build(); }
From source file:eu.vital.vitalcep.restApp.alert.Alerts.java
/** * Gets a filter./* ww w. j a v a 2 s .c om*/ * * @return the filter */ @POST @Path("getAlert") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response getAlert(String id) { JSONObject jo = new JSONObject(id); String idjo = jo.getString("id"); MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("alerts"); } catch (Exception e) { //System.out.println("Mongo is down"); mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } BasicDBObject searchById = new BasicDBObject("id", idjo); String found = null; BasicDBObject fields = new BasicDBObject().append("_id", false); FindIterable<Document> coll = db.getCollection("alerts").find(searchById).projection(fields); try { found = coll.first().toJson(); } catch (Exception e) { return Response.status(Response.Status.NOT_FOUND).build(); } finally { db = null; if (mongo != null) { mongo.close(); mongo = null; } } if (found == null) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.status(Response.Status.OK).entity(found.toString()).build(); } }
From source file:eu.vital.vitalcep.restApp.alert.Alerts.java
/** * Gets a filter.//from w ww . j a v a 2 s . c o m * * @param filterId * @param req * @return the filter */ @DELETE @Path("deletealert") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteAlert(String filterId, @Context HttpServletRequest req) throws IOException { MongoClient mongo = null; MongoDatabase db = null; try { StringBuilder ck = new StringBuilder(); Security slogin = new Security(); Boolean token = slogin.login(req.getHeader("name"), req.getHeader("password"), false, ck); if (!token) { return Response.status(Response.Status.UNAUTHORIZED).build(); } this.cookie = ck.toString(); JSONObject jo = new JSONObject(filterId); String idjo = jo.getString("id"); mongo = new MongoClient(new MongoClientURI(mongoURL)); db = mongo.getDatabase(mongoDB); try { db.getCollection("alerts"); } catch (Exception e) { //System.out.println("Mongo is down"); mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } MongoCollection<Document> coll = db.getCollection("alerts"); Bson filter = Filters.eq("id", idjo); FindIterable<Document> iterable = coll.find(filter); String cepInstance; CEP cepProcess = new CEP(); if (iterable != null && iterable.first() != null) { Document doc = iterable.first(); cepInstance = doc.getString("cepinstance"); MongoCollection<Document> collInstances = db.getCollection("cepinstances"); ObjectId ci = new ObjectId(cepInstance); Bson filterInstances = Filters.eq("_id", ci); FindIterable<Document> iterable2 = collInstances.find(filterInstances); if (iterable2 != null) { Document doc2 = iterable2.first(); cepProcess.PID = doc2.getInteger("PID"); cepProcess.fileName = doc2.getString("fileName"); cepProcess.cepFolder = doc2.getString("cepFolder"); cepProcess.type = CEP.CEPType.ALERT.toString(); CepProcess cp = new CepProcess(null, null, null, null); cp.PID = doc2.getInteger("PID"); cepProcess.cp = cp; if (!cepProcess.cepDispose()) { java.util.logging.Logger.getLogger(Alerts.class.getName()).log(Level.SEVERE, "bcep Instance not terminated"); } else { Bson filter1 = Filters.eq("_id", ci); Bson update = new Document("$set", new Document("status", "terminated")); UpdateOptions options = new UpdateOptions().upsert(false); UpdateResult updateDoc = db.getCollection("cepinstances").updateOne(filter1, update, options); } ; CepContainer.deleteCepProcess(cp.PID); } } else { return Response.status(Response.Status.NOT_FOUND).build(); } DeleteResult deleteResult = coll.deleteOne(eq("id", idjo)); if (deleteResult.getDeletedCount() < 1) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.status(Response.Status.OK).build(); } } catch (Exception e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } finally { db = null; if (mongo != null) { mongo.close(); mongo = null; } } }
From source file:eu.vital.vitalcep.restApp.cepRESTApi.CEPICO.java
/** * Gets the filters./* ww w . j a v a2 s . c o m*/ * * @return the filters */ @GET @Path("getcepicos") @Produces(MediaType.APPLICATION_JSON) public Response getCEPICOs() { MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); BasicDBObject query = new BasicDBObject(); BasicDBObject fields = new BasicDBObject().append("_id", false).append("cepinstance", false); fields.append("dolceSpecification", false); FindIterable<Document> coll = db.getCollection("cepicos").find(query).projection(fields); final JSONArray AllJson = new JSONArray(); coll.forEach(new Block<Document>() { @Override public void apply(final Document document) { AllJson.put(document); } }); db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.OK).entity(AllJson.toString()).build(); }
From source file:eu.vital.vitalcep.restApp.cepRESTApi.CEPICO.java
/** * Creates a filter.// www. j a v a2s.c o m * * @param cepico * @param req * @return the filter id * @throws java.io.IOException */ @PUT @Path("createcepico") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createCEPICO(String cepico, @Context HttpServletRequest req) throws IOException { StringBuilder ck = new StringBuilder(); Security slogin = new Security(); JSONObject credentials = new JSONObject(); Boolean token = slogin.login(req.getHeader("name"), req.getHeader("password"), false, ck); credentials.put("username", req.getHeader("name")); credentials.put("password", req.getHeader("password")); if (!token) { return Response.status(Response.Status.UNAUTHORIZED).build(); } this.cookie = ck.toString(); JSONObject jo = new JSONObject(cepico); if (!jo.has("source")) { return Response.status(Response.Status.BAD_REQUEST).build(); } MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("cepicos"); } catch (Exception e) { //System.out.println("Mongo is down"); mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } if (jo.has("dolceSpecification")) { //Filter oFilter = new Filter(filter); JSONObject dsjo = jo.getJSONObject("dolceSpecification"); String str = dsjo.toString();//"{\"dolceSpecification\": "+ dsjo.toString()+"}"; try { DolceSpecification ds = new DolceSpecification(str); if (ds instanceof DolceSpecification) { UUID uuid = UUID.randomUUID(); String randomUUIDString = uuid.toString(); String mqin = RandomStringUtils.randomAlphanumeric(8); String mqout = RandomStringUtils.randomAlphanumeric(8); Date NOW = new Date(); JSONArray requestArray; try { requestArray = createCEPICORequests(jo.getJSONArray("source"), ds.getEvents(), getXSDDateTime(NOW)); } catch (Exception e) { mongo.close(); return Response.status(Response.Status.BAD_REQUEST) .entity("not available getObservation Service for this sensor ").build(); } CEP cepProcess = new CEP(); if (!(cepProcess.CEPStart(CEP.CEPType.CEPICO, ds, mqin, mqout, confFile, requestArray.toString(), credentials))) { mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } if (cepProcess.PID < 1) { mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } DBObject dbObject = createCEPSensor(cepico, randomUUIDString, dsjo, cepProcess.id); Document doc = new Document(dbObject.toMap()); try { db.getCollection("cepicos").insertOne(doc); JSONObject opState = createOperationalStateObservation(randomUUIDString); String sensorId = host + "/sensor/" + randomUUIDString; MessageProcessor_publisher Publisher_MsgProcc = new MessageProcessor_publisher(this.dmsURL, cookie, sensorId, "cepicosobservations", mongoURL, mongoDB);//555 MQTT_connector_subscriper publisher = new MQTT_connector_subscriper(mqout, Publisher_MsgProcc); MqttConnectorContainer.addConnector(publisher.getClientName(), publisher); DBObject oPut = (DBObject) JSON.parse(opState.toString()); Document doc1 = new Document(oPut.toMap()); try { db.getCollection("cepicosobservations").insertOne(doc1); String id = doc1.get("_id").toString(); } catch (MongoException ex) { mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } JSONObject aOutput = new JSONObject(); aOutput.put("id", host + "/sensor/" + randomUUIDString); return Response.status(Response.Status.OK).entity(aOutput.toString()).build(); } catch (MongoException ex) { return Response.status(Response.Status.BAD_REQUEST).build(); } } else { mongo.close(); return Response.status(Response.Status.BAD_REQUEST).build(); } } catch (MongoException ex) { return Response.status(Response.Status.BAD_REQUEST).build(); } } else { mongo.close(); return Response.status(Response.Status.BAD_REQUEST).build(); } }
From source file:eu.vital.vitalcep.restApp.cepRESTApi.CEPICO.java
/** * Gets a filter.//from ww w .j ava 2s.com * * @return the filter */ @POST @Path("getcepico") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response getCEPICO(String id) { JSONObject jo = new JSONObject(id); String idjo = jo.getString("id"); MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("cepicos"); } catch (Exception e) { //System.out.println("Mongo is down"); db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } BasicDBObject searchById = new BasicDBObject("id", idjo); String found = null; BasicDBObject fields = new BasicDBObject().append("_id", false).append("cepinstance", false); FindIterable<Document> coll = db.getCollection("cepicos").find(searchById).projection(fields); try { found = coll.first().toJson(); } catch (Exception e) { db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.NOT_FOUND).build(); } if (found == null) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.status(Response.Status.OK).entity(found).build(); } }
From source file:eu.vital.vitalcep.restApp.cepRESTApi.CEPICO.java
/** * Gets a filter.//from w w w.j a v a 2s .c o m * * @param filterId * @param req * @return the filter */ @DELETE @Path("deletecepico") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteCEPICO(String filterId, @Context HttpServletRequest req) throws IOException { StringBuilder ck = new StringBuilder(); Security slogin = new Security(); Boolean token = slogin.login(req.getHeader("name"), req.getHeader("password"), false, ck); if (!token) { return Response.status(Response.Status.UNAUTHORIZED).build(); } this.cookie = ck.toString(); JSONObject jo = new JSONObject(filterId); String idjo = jo.getString("id"); MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("cepicos"); } catch (Exception e) { //System.out.println("Mongo is down"); mongo.close(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } MongoCollection<Document> coll = db.getCollection("cepicos"); Bson filter = Filters.eq("id", idjo); FindIterable<Document> iterable = coll.find(filter); String cepInstance; CEP cepProcess = new CEP(); if (iterable != null && iterable.first() != null) { Document doc = iterable.first(); cepInstance = doc.getString("cepinstance"); MongoCollection<Document> collInstances = db.getCollection("cepinstances"); ObjectId ci = new ObjectId(cepInstance); Bson filterInstances = Filters.eq("_id", ci); FindIterable<Document> iterable2 = collInstances.find(filterInstances); if (iterable2 != null) { Document doc2 = iterable2.first(); cepProcess.PID = doc2.getInteger("PID"); cepProcess.fileName = doc2.getString("fileName"); cepProcess.cepFolder = doc2.getString("cepFolder"); cepProcess.type = CEP.CEPType.CEPICO.toString(); CepProcess cp = new CepProcess(null, null, null, null); cp.PID = doc2.getInteger("PID"); cepProcess.cp = cp; if (!cepProcess.cepDispose()) { java.util.logging.Logger.getLogger(CEPICO.class.getName()).log(Level.SEVERE, "bcep Instance not terminated"); } else { Bson filter1 = Filters.eq("_id", ci); Bson update = new Document("$set", new Document("status", "terminated")); UpdateOptions options = new UpdateOptions().upsert(false); UpdateResult updateDoc = db.getCollection("cepinstances").updateOne(filter1, update, options); } ; CepContainer.deleteCepProcess(cp.PID); } } else { return Response.status(Response.Status.NOT_FOUND).build(); } DeleteResult deleteResult = coll.deleteOne(eq("id", idjo)); if (deleteResult.getDeletedCount() < 1) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.status(Response.Status.OK).build(); } }
From source file:eu.vital.vitalcep.restApp.filteringApi.ContinuosFiltering.java
/** * Gets the filters./*from ww w.j ava 2 s . com*/ * * @return the filters */ @GET @Path("getcontinuousfilters") @Produces(MediaType.APPLICATION_JSON) public Response getFilterings(@Context HttpServletRequest req) { // StringBuilder ck = new StringBuilder(); // Security slogin = new Security(); // // Boolean token = slogin.login(req.getHeader("name") // ,req.getHeader("password"),false,ck); // if (!token){ // return Response.status(Response.Status.UNAUTHORIZED).build(); // } // this.cookie = ck.toString(); MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("continuousfilters"); } catch (Exception e) { //System.out.println("Mongo is down"); db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } // create an empty query BasicDBObject query = new BasicDBObject(); BasicDBObject fields = new BasicDBObject().append("_id", false); fields.append("dolceSpecification", false); FindIterable<Document> coll = db.getCollection("continuousfilters").find(query).projection(fields); final JSONArray AllJson = new JSONArray(); coll.forEach(new Block<Document>() { @Override public void apply(final Document document) { String aux = document.toJson(); JSONObject sensoraux = new JSONObject(aux); AllJson.put(sensoraux); } }); db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.OK).entity(AllJson.toString()).build(); }
From source file:eu.vital.vitalcep.restApp.filteringApi.ContinuosFiltering.java
/** * Creates a filter.// w w w . ja va 2s . co m * * @param filter * @param req * @return the filter id * @throws java.io.IOException */ @PUT @Path("createcontinuousfilter") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createcontinuousfilter(String filter, @Context HttpServletRequest req) throws IOException { StringBuilder ck = new StringBuilder(); Security slogin = new Security(); JSONObject credentials = new JSONObject(); Boolean token = slogin.login(req.getHeader("name"), req.getHeader("password"), false, ck); credentials.put("username", req.getHeader("name")); credentials.put("password", req.getHeader("password")); if (!token) { return Response.status(Response.Status.UNAUTHORIZED).build(); } this.cookie = ck.toString(); JSONObject jo = new JSONObject(filter); MongoClient mongo = new MongoClient(new MongoClientURI(mongoURL)); MongoDatabase db = mongo.getDatabase(mongoDB); try { db.getCollection("continuousfilters"); } catch (Exception e) { //System.out.println("Mongo is down"); db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } if (jo.has("dolceSpecification")) { JSONObject dsjo = jo.getJSONObject("dolceSpecification"); String str = dsjo.toString();//"{\"dolceSpecification\": "+ dsjo.toString()+"}"; try { DolceSpecification ds = new DolceSpecification(str); if (ds instanceof DolceSpecification) { UUID uuid = UUID.randomUUID(); String randomUUIDString = uuid.toString(); String mqin = RandomStringUtils.randomAlphanumeric(8); String mqout = RandomStringUtils.randomAlphanumeric(8); CEP cepProcess = new CEP(); if (!(cepProcess.CEPStart(CEP.CEPType.CONTINUOUS, ds, mqin, mqout, confFile, jo.getJSONArray("source").toString(), credentials))) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } if (cepProcess.PID < 1) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } DBObject dbObject = createCEPFilterSensor(filter, randomUUIDString, dsjo, cepProcess.id); Document doc = new Document(dbObject.toMap()); try { db.getCollection("continuousfilters").insertOne(doc); JSONObject aOutput = new JSONObject(); String sensorId = host + "/sensor/" + randomUUIDString; aOutput.put("id", sensorId); //MIGUEL MessageProcessor_publisher Publisher_MsgProcc = new MessageProcessor_publisher(this.dmsURL, this.cookie, sensorId, "continuosfiltersobservations", this.mongoURL, this.mongoDB);//555 MQTT_connector_subscriper publisher = new MQTT_connector_subscriper(mqout, Publisher_MsgProcc); MqttConnectorContainer.addConnector(publisher.getClientName(), publisher); //TODO --> DESTROY DEL CONNECTOR. // MqttConnectorContainer.deleteConnector(publisher // .getClientName()); JSONObject opState = createOperationalStateObservation(randomUUIDString); DBObject oPut = (DBObject) JSON.parse(opState.toString()); Document doc1 = new Document(oPut.toMap()); try { db.getCollection("continuosfiltersobservations").insertOne(doc1); String id = doc1.get("_id").toString(); db = null; if (mongo != null) { mongo.close(); mongo = null; } } catch (MongoException ex) { db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } return Response.status(Response.Status.OK).entity(aOutput.toString()).build(); } catch (MongoException ex) { db = null; if (mongo != null) { mongo.close(); mongo = null; } return Response.status(Response.Status.BAD_REQUEST).build(); } } else { return Response.status(Response.Status.BAD_REQUEST).build(); } } catch (JSONException | IOException e) { return Response.status(Response.Status.BAD_REQUEST).build(); } } return Response.status(Response.Status.BAD_REQUEST).build(); }