@Test public void shouldDeleteTrajectory() throws Exception { ObjTrajectory traj = new ObjTrajectory(); traj.setUid("traj-a"); traj.setUidWellbore("wellbore-a"); traj.setUidWell("well-a"); String endpoint = this.url + this.trajectoryPath + traj.getUid(); HttpRequest req = Unirest.delete(endpoint); req.header("Content-Type", "application/json"); req.queryString("uidWellbore", traj.getUidWellbore()); req.queryString("uidWell", traj.getUidWell()); HttpResponse<String> resp = mock(HttpResponse.class); when(resp.getStatus()).thenReturn(204); when(this.mockClient.makeRequest(argThat(someReq -> ( someReq.getHttpMethod().name().equals(req.getHttpMethod().name()) && someReq.getUrl().equals(req.getUrl()) && someReq.getHeaders().containsKey("Content-Type") )), eq("goodUsername"), eq("goodPassword"), anyString())).thenReturn(resp); this.delegator.deleteObject(traj, "goodUsername", "goodPassword", "exchangeID", this.mockClient); verify(this.mockClient).makeRequest(argThat(someReq -> ( someReq.getHttpMethod().name().equals(req.getHttpMethod().name()) && someReq.getUrl().equals(req.getUrl()) && someReq.getHeaders().containsKey("Content-Type") )), eq("goodUsername"), eq("goodPassword"), anyString()); }
public void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID, DotClient client) throws ValveException, UnirestException, ValveAuthException { String uid = witsmlObj.getUid(); String objectType = witsmlObj.getObjectType(); String uuid = ""; String endpoint = ""; HttpRequest request = null; String logCurveInfoUid = ""; String mnemonic = ""; String channelsEndPoint; HttpRequest channelsRequest; HttpResponse<String> channelsResponse; int logCurveInfosize = 0; endpoint = this.getEndpoint(objectType) + uid; request = Unirest.delete(endpoint).header("Content-Type", "application/json"); if ("wellbore".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWell", witsmlObj.getParentUid()); } else if ("trajectory".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWellbore", witsmlObj.getParentUid()); String uidWell; if ("1.4.1.1".equals(witsmlObj.getVersion())) { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory) witsmlObj).getUidWell(); } else { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjTrajectory) witsmlObj).getUidWell(); } request.queryString("uidWell", uidWell); } HttpResponse<String> response = null; if ("log".equals(objectType)) { if ("1.4.1.1".equals(witsmlObj.getVersion())) { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog) witsmlObj).getLogCurveInfo() .size(); } else { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjLog) witsmlObj).getLogCurveInfo() .size(); } if (logCurveInfosize != 0) { logCurveInfoUid = ((ObjLog) witsmlObj).getLogCurveInfo().get(0).getUid(); uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("", (short) -433); } channelsEndPoint = this.getEndpoint("channels"); channelsRequest = Unirest.get(channelsEndPoint); channelsRequest.header("accept", "application/json"); channelsRequest.queryString("channelSetUuid", uuid); channelsResponse = client.makeRequest(channelsRequest, username, password, exchangeID); List<Channel> channels = Channel.jsonToChannelList(channelsResponse.getBody()); for (Channel c : channels) { try { if (logCurveInfoUid.equals(c.getUid())) { mnemonic = c.getMnemonic(); break; } } catch (Exception ex) { continue; } } String logMnemonicEndpoint = this.getEndpoint("logMenmonicPath"); HttpRequest logMnemonicRequest = Unirest.delete(logMnemonicEndpoint).header("Content-Type", "application/json"); logMnemonicRequest.queryString("channelSetUuid", uuid); logMnemonicRequest.queryString("mnemonic", mnemonic); HttpResponse<String> logMnemoniceResponse = client.makeRequest(logMnemonicRequest, username, password, exchangeID); int mnemonicDeleteStatus = logMnemoniceResponse.getStatus(); if (204 != mnemonicDeleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + mnemonicDeleteStatus); } } else { uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String logDeletEndpoint = this.getEndpoint(LOG_OBJECT); logDeletEndpoint = logDeletEndpoint + "/" + uuid; HttpRequest logDeleteRequest = Unirest.delete(logDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> logDeleteResponse = client.makeRequest(logDeleteRequest, username, password, exchangeID); int deleteStatus = logDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } } else if ("fluidsreport".equals(objectType)) { uuid = getUUIDFR(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String fluidsReportDeletEndpoint = this.getEndpoint(FLUIDSREPORT_OBJECT); fluidsReportDeletEndpoint = fluidsReportDeletEndpoint + "/" + uuid; HttpRequest fluidsReportDeleteRequest = Unirest.delete(fluidsReportDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> fluidsReportDeleteResponse = client.makeRequest(fluidsReportDeleteRequest, username, password, exchangeID); int deleteStatus = fluidsReportDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } else { response = client.makeRequest(request, username, password, exchangeID); int status = response.getStatus(); if (201 == status || 200 == status || 204 == status) { LOG.info(ValveLogging.getLogRespMsg(exchangeID, "Successfully Deleted Object with UID: " + uid, response)); } else { LOG.warning( ValveLogging.getLogRespMsg(exchangeID, "Unable to delete Object with UID: " + uid, response)); throw new ValveException("Unable to delete Object with UID: " + status); } } }
DotDelegator { public void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID, DotClient client) throws ValveException, UnirestException, ValveAuthException { String uid = witsmlObj.getUid(); String objectType = witsmlObj.getObjectType(); String uuid = ""; String endpoint = ""; HttpRequest request = null; String logCurveInfoUid = ""; String mnemonic = ""; String channelsEndPoint; HttpRequest channelsRequest; HttpResponse<String> channelsResponse; int logCurveInfosize = 0; endpoint = this.getEndpoint(objectType) + uid; request = Unirest.delete(endpoint).header("Content-Type", "application/json"); if ("wellbore".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWell", witsmlObj.getParentUid()); } else if ("trajectory".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWellbore", witsmlObj.getParentUid()); String uidWell; if ("1.4.1.1".equals(witsmlObj.getVersion())) { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory) witsmlObj).getUidWell(); } else { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjTrajectory) witsmlObj).getUidWell(); } request.queryString("uidWell", uidWell); } HttpResponse<String> response = null; if ("log".equals(objectType)) { if ("1.4.1.1".equals(witsmlObj.getVersion())) { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog) witsmlObj).getLogCurveInfo() .size(); } else { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjLog) witsmlObj).getLogCurveInfo() .size(); } if (logCurveInfosize != 0) { logCurveInfoUid = ((ObjLog) witsmlObj).getLogCurveInfo().get(0).getUid(); uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("", (short) -433); } channelsEndPoint = this.getEndpoint("channels"); channelsRequest = Unirest.get(channelsEndPoint); channelsRequest.header("accept", "application/json"); channelsRequest.queryString("channelSetUuid", uuid); channelsResponse = client.makeRequest(channelsRequest, username, password, exchangeID); List<Channel> channels = Channel.jsonToChannelList(channelsResponse.getBody()); for (Channel c : channels) { try { if (logCurveInfoUid.equals(c.getUid())) { mnemonic = c.getMnemonic(); break; } } catch (Exception ex) { continue; } } String logMnemonicEndpoint = this.getEndpoint("logMenmonicPath"); HttpRequest logMnemonicRequest = Unirest.delete(logMnemonicEndpoint).header("Content-Type", "application/json"); logMnemonicRequest.queryString("channelSetUuid", uuid); logMnemonicRequest.queryString("mnemonic", mnemonic); HttpResponse<String> logMnemoniceResponse = client.makeRequest(logMnemonicRequest, username, password, exchangeID); int mnemonicDeleteStatus = logMnemoniceResponse.getStatus(); if (204 != mnemonicDeleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + mnemonicDeleteStatus); } } else { uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String logDeletEndpoint = this.getEndpoint(LOG_OBJECT); logDeletEndpoint = logDeletEndpoint + "/" + uuid; HttpRequest logDeleteRequest = Unirest.delete(logDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> logDeleteResponse = client.makeRequest(logDeleteRequest, username, password, exchangeID); int deleteStatus = logDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } } else if ("fluidsreport".equals(objectType)) { uuid = getUUIDFR(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String fluidsReportDeletEndpoint = this.getEndpoint(FLUIDSREPORT_OBJECT); fluidsReportDeletEndpoint = fluidsReportDeletEndpoint + "/" + uuid; HttpRequest fluidsReportDeleteRequest = Unirest.delete(fluidsReportDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> fluidsReportDeleteResponse = client.makeRequest(fluidsReportDeleteRequest, username, password, exchangeID); int deleteStatus = fluidsReportDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } else { response = client.makeRequest(request, username, password, exchangeID); int status = response.getStatus(); if (201 == status || 200 == status || 204 == status) { LOG.info(ValveLogging.getLogRespMsg(exchangeID, "Successfully Deleted Object with UID: " + uid, response)); } else { LOG.warning( ValveLogging.getLogRespMsg(exchangeID, "Unable to delete Object with UID: " + uid, response)); throw new ValveException("Unable to delete Object with UID: " + status); } } } }
DotDelegator { public void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID, DotClient client) throws ValveException, UnirestException, ValveAuthException { String uid = witsmlObj.getUid(); String objectType = witsmlObj.getObjectType(); String uuid = ""; String endpoint = ""; HttpRequest request = null; String logCurveInfoUid = ""; String mnemonic = ""; String channelsEndPoint; HttpRequest channelsRequest; HttpResponse<String> channelsResponse; int logCurveInfosize = 0; endpoint = this.getEndpoint(objectType) + uid; request = Unirest.delete(endpoint).header("Content-Type", "application/json"); if ("wellbore".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWell", witsmlObj.getParentUid()); } else if ("trajectory".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWellbore", witsmlObj.getParentUid()); String uidWell; if ("1.4.1.1".equals(witsmlObj.getVersion())) { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory) witsmlObj).getUidWell(); } else { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjTrajectory) witsmlObj).getUidWell(); } request.queryString("uidWell", uidWell); } HttpResponse<String> response = null; if ("log".equals(objectType)) { if ("1.4.1.1".equals(witsmlObj.getVersion())) { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog) witsmlObj).getLogCurveInfo() .size(); } else { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjLog) witsmlObj).getLogCurveInfo() .size(); } if (logCurveInfosize != 0) { logCurveInfoUid = ((ObjLog) witsmlObj).getLogCurveInfo().get(0).getUid(); uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("", (short) -433); } channelsEndPoint = this.getEndpoint("channels"); channelsRequest = Unirest.get(channelsEndPoint); channelsRequest.header("accept", "application/json"); channelsRequest.queryString("channelSetUuid", uuid); channelsResponse = client.makeRequest(channelsRequest, username, password, exchangeID); List<Channel> channels = Channel.jsonToChannelList(channelsResponse.getBody()); for (Channel c : channels) { try { if (logCurveInfoUid.equals(c.getUid())) { mnemonic = c.getMnemonic(); break; } } catch (Exception ex) { continue; } } String logMnemonicEndpoint = this.getEndpoint("logMenmonicPath"); HttpRequest logMnemonicRequest = Unirest.delete(logMnemonicEndpoint).header("Content-Type", "application/json"); logMnemonicRequest.queryString("channelSetUuid", uuid); logMnemonicRequest.queryString("mnemonic", mnemonic); HttpResponse<String> logMnemoniceResponse = client.makeRequest(logMnemonicRequest, username, password, exchangeID); int mnemonicDeleteStatus = logMnemoniceResponse.getStatus(); if (204 != mnemonicDeleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + mnemonicDeleteStatus); } } else { uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String logDeletEndpoint = this.getEndpoint(LOG_OBJECT); logDeletEndpoint = logDeletEndpoint + "/" + uuid; HttpRequest logDeleteRequest = Unirest.delete(logDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> logDeleteResponse = client.makeRequest(logDeleteRequest, username, password, exchangeID); int deleteStatus = logDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } } else if ("fluidsreport".equals(objectType)) { uuid = getUUIDFR(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String fluidsReportDeletEndpoint = this.getEndpoint(FLUIDSREPORT_OBJECT); fluidsReportDeletEndpoint = fluidsReportDeletEndpoint + "/" + uuid; HttpRequest fluidsReportDeleteRequest = Unirest.delete(fluidsReportDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> fluidsReportDeleteResponse = client.makeRequest(fluidsReportDeleteRequest, username, password, exchangeID); int deleteStatus = fluidsReportDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } else { response = client.makeRequest(request, username, password, exchangeID); int status = response.getStatus(); if (201 == status || 200 == status || 204 == status) { LOG.info(ValveLogging.getLogRespMsg(exchangeID, "Successfully Deleted Object with UID: " + uid, response)); } else { LOG.warning( ValveLogging.getLogRespMsg(exchangeID, "Unable to delete Object with UID: " + uid, response)); throw new ValveException("Unable to delete Object with UID: " + status); } } } DotDelegator(Map<String, String> config); }
DotDelegator { public void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID, DotClient client) throws ValveException, UnirestException, ValveAuthException { String uid = witsmlObj.getUid(); String objectType = witsmlObj.getObjectType(); String uuid = ""; String endpoint = ""; HttpRequest request = null; String logCurveInfoUid = ""; String mnemonic = ""; String channelsEndPoint; HttpRequest channelsRequest; HttpResponse<String> channelsResponse; int logCurveInfosize = 0; endpoint = this.getEndpoint(objectType) + uid; request = Unirest.delete(endpoint).header("Content-Type", "application/json"); if ("wellbore".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWell", witsmlObj.getParentUid()); } else if ("trajectory".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWellbore", witsmlObj.getParentUid()); String uidWell; if ("1.4.1.1".equals(witsmlObj.getVersion())) { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory) witsmlObj).getUidWell(); } else { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjTrajectory) witsmlObj).getUidWell(); } request.queryString("uidWell", uidWell); } HttpResponse<String> response = null; if ("log".equals(objectType)) { if ("1.4.1.1".equals(witsmlObj.getVersion())) { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog) witsmlObj).getLogCurveInfo() .size(); } else { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjLog) witsmlObj).getLogCurveInfo() .size(); } if (logCurveInfosize != 0) { logCurveInfoUid = ((ObjLog) witsmlObj).getLogCurveInfo().get(0).getUid(); uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("", (short) -433); } channelsEndPoint = this.getEndpoint("channels"); channelsRequest = Unirest.get(channelsEndPoint); channelsRequest.header("accept", "application/json"); channelsRequest.queryString("channelSetUuid", uuid); channelsResponse = client.makeRequest(channelsRequest, username, password, exchangeID); List<Channel> channels = Channel.jsonToChannelList(channelsResponse.getBody()); for (Channel c : channels) { try { if (logCurveInfoUid.equals(c.getUid())) { mnemonic = c.getMnemonic(); break; } } catch (Exception ex) { continue; } } String logMnemonicEndpoint = this.getEndpoint("logMenmonicPath"); HttpRequest logMnemonicRequest = Unirest.delete(logMnemonicEndpoint).header("Content-Type", "application/json"); logMnemonicRequest.queryString("channelSetUuid", uuid); logMnemonicRequest.queryString("mnemonic", mnemonic); HttpResponse<String> logMnemoniceResponse = client.makeRequest(logMnemonicRequest, username, password, exchangeID); int mnemonicDeleteStatus = logMnemoniceResponse.getStatus(); if (204 != mnemonicDeleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + mnemonicDeleteStatus); } } else { uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String logDeletEndpoint = this.getEndpoint(LOG_OBJECT); logDeletEndpoint = logDeletEndpoint + "/" + uuid; HttpRequest logDeleteRequest = Unirest.delete(logDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> logDeleteResponse = client.makeRequest(logDeleteRequest, username, password, exchangeID); int deleteStatus = logDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } } else if ("fluidsreport".equals(objectType)) { uuid = getUUIDFR(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String fluidsReportDeletEndpoint = this.getEndpoint(FLUIDSREPORT_OBJECT); fluidsReportDeletEndpoint = fluidsReportDeletEndpoint + "/" + uuid; HttpRequest fluidsReportDeleteRequest = Unirest.delete(fluidsReportDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> fluidsReportDeleteResponse = client.makeRequest(fluidsReportDeleteRequest, username, password, exchangeID); int deleteStatus = fluidsReportDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } else { response = client.makeRequest(request, username, password, exchangeID); int status = response.getStatus(); if (201 == status || 200 == status || 204 == status) { LOG.info(ValveLogging.getLogRespMsg(exchangeID, "Successfully Deleted Object with UID: " + uid, response)); } else { LOG.warning( ValveLogging.getLogRespMsg(exchangeID, "Unable to delete Object with UID: " + uid, response)); throw new ValveException("Unable to delete Object with UID: " + status); } } } DotDelegator(Map<String, String> config); void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); void performElementDelete(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); void updateObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); String updateFluidsReport(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); void updateLog(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client, String payload); String getUuid(AbstractWitsmlObject witsmlObj, String uid, DotClient client, String username,
			String password, String exchangeID); String createObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); String createFluidsReportObject(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); String createLogObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); static short mnemonicsChecks( String channelPayload,
										 String dataPayload,
										 String version ); HttpResponse<String> performPost(String payload, String endpoint, HashMap<String, String> requestParams,
			DotClient client, String username, String password, String exchangeID); String[] getMappedPayloads4Log(String version, String payload, AbstractWitsmlObject witsmlObj); AbstractWitsmlObject getObject(AbstractWitsmlObject witsmlObject, String username, String password,
			String exchangeID, DotClient client, Map<String, String> optionsIn); ArrayList<AbstractWitsmlObject> search(AbstractWitsmlObject witsmlObject, String username, String password,
			String exchangeID, DotClient client, Map<String, String> optionsIn); }
DotDelegator { public void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID, DotClient client) throws ValveException, UnirestException, ValveAuthException { String uid = witsmlObj.getUid(); String objectType = witsmlObj.getObjectType(); String uuid = ""; String endpoint = ""; HttpRequest request = null; String logCurveInfoUid = ""; String mnemonic = ""; String channelsEndPoint; HttpRequest channelsRequest; HttpResponse<String> channelsResponse; int logCurveInfosize = 0; endpoint = this.getEndpoint(objectType) + uid; request = Unirest.delete(endpoint).header("Content-Type", "application/json"); if ("wellbore".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWell", witsmlObj.getParentUid()); } else if ("trajectory".equals(objectType)) { request = Unirest.delete(endpoint).header("Content-Type", "application/json"); request.queryString("uidWellbore", witsmlObj.getParentUid()); String uidWell; if ("1.4.1.1".equals(witsmlObj.getVersion())) { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory) witsmlObj).getUidWell(); } else { uidWell = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjTrajectory) witsmlObj).getUidWell(); } request.queryString("uidWell", uidWell); } HttpResponse<String> response = null; if ("log".equals(objectType)) { if ("1.4.1.1".equals(witsmlObj.getVersion())) { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog) witsmlObj).getLogCurveInfo() .size(); } else { logCurveInfosize = ((com.hashmapinc.tempus.WitsmlObjects.v1311.ObjLog) witsmlObj).getLogCurveInfo() .size(); } if (logCurveInfosize != 0) { logCurveInfoUid = ((ObjLog) witsmlObj).getLogCurveInfo().get(0).getUid(); uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("", (short) -433); } channelsEndPoint = this.getEndpoint("channels"); channelsRequest = Unirest.get(channelsEndPoint); channelsRequest.header("accept", "application/json"); channelsRequest.queryString("channelSetUuid", uuid); channelsResponse = client.makeRequest(channelsRequest, username, password, exchangeID); List<Channel> channels = Channel.jsonToChannelList(channelsResponse.getBody()); for (Channel c : channels) { try { if (logCurveInfoUid.equals(c.getUid())) { mnemonic = c.getMnemonic(); break; } } catch (Exception ex) { continue; } } String logMnemonicEndpoint = this.getEndpoint("logMenmonicPath"); HttpRequest logMnemonicRequest = Unirest.delete(logMnemonicEndpoint).header("Content-Type", "application/json"); logMnemonicRequest.queryString("channelSetUuid", uuid); logMnemonicRequest.queryString("mnemonic", mnemonic); HttpResponse<String> logMnemoniceResponse = client.makeRequest(logMnemonicRequest, username, password, exchangeID); int mnemonicDeleteStatus = logMnemoniceResponse.getStatus(); if (204 != mnemonicDeleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + mnemonicDeleteStatus); } } else { uuid = getUUID(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String logDeletEndpoint = this.getEndpoint(LOG_OBJECT); logDeletEndpoint = logDeletEndpoint + "/" + uuid; HttpRequest logDeleteRequest = Unirest.delete(logDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> logDeleteResponse = client.makeRequest(logDeleteRequest, username, password, exchangeID); int deleteStatus = logDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } } else if ("fluidsreport".equals(objectType)) { uuid = getUUIDFR(uid, witsmlObj, client, username, password, exchangeID); if (uuid == null) { throw new ValveException("Not Found", (short) -433); } String fluidsReportDeletEndpoint = this.getEndpoint(FLUIDSREPORT_OBJECT); fluidsReportDeletEndpoint = fluidsReportDeletEndpoint + "/" + uuid; HttpRequest fluidsReportDeleteRequest = Unirest.delete(fluidsReportDeletEndpoint).header("Content-Type", "application/json"); HttpResponse<String> fluidsReportDeleteResponse = client.makeRequest(fluidsReportDeleteRequest, username, password, exchangeID); int deleteStatus = fluidsReportDeleteResponse.getStatus(); if (204 != deleteStatus) { throw new ValveException("DELETE DoT REST call failed with status code: " + deleteStatus); } } else { response = client.makeRequest(request, username, password, exchangeID); int status = response.getStatus(); if (201 == status || 200 == status || 204 == status) { LOG.info(ValveLogging.getLogRespMsg(exchangeID, "Successfully Deleted Object with UID: " + uid, response)); } else { LOG.warning( ValveLogging.getLogRespMsg(exchangeID, "Unable to delete Object with UID: " + uid, response)); throw new ValveException("Unable to delete Object with UID: " + status); } } } DotDelegator(Map<String, String> config); void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); void performElementDelete(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); void updateObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); String updateFluidsReport(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); void updateLog(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client, String payload); String getUuid(AbstractWitsmlObject witsmlObj, String uid, DotClient client, String username,
			String password, String exchangeID); String createObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); String createFluidsReportObject(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); String createLogObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); static short mnemonicsChecks( String channelPayload,
										 String dataPayload,
										 String version ); HttpResponse<String> performPost(String payload, String endpoint, HashMap<String, String> requestParams,
			DotClient client, String username, String password, String exchangeID); String[] getMappedPayloads4Log(String version, String payload, AbstractWitsmlObject witsmlObj); AbstractWitsmlObject getObject(AbstractWitsmlObject witsmlObject, String username, String password,
			String exchangeID, DotClient client, Map<String, String> optionsIn); ArrayList<AbstractWitsmlObject> search(AbstractWitsmlObject witsmlObject, String username, String password,
			String exchangeID, DotClient client, Map<String, String> optionsIn);  }