public void addResponseString(String responseString) { this.setResponse(responseString); } }
@Override public boolean gotValidReply() { return (this.wasSent() && this.getResponseJSON() != null); }
@Override public boolean wasSent() { if (this.getRequestJSON() == null) { return false; } if (this.getRequestJSON().has(ApiConfiguration.REPLY_JSON_ERROR_DESCRIPTION)) { return false; } return true; }
new DefaultOutgoingMatchRequest(remoteServerId, ApiConfiguration.LATEST_API_VERSION_STRING, patientId); request.addRequestJSON(requestJSON); request.addResponseString(stringReply); request.setReplayHTTPStatus(httpStatus); requestStorageManager.saveOutgoingRequest(request);
public void saveUnprocessedRequest(String requestString, String remoteServerId, String apiVersion) { IncomingMatchRequest request = new DefaultIncomingMatchRequest(remoteServerId, apiVersion, requestString, null); requestStorageManager.saveIncomingRequest(request); }
private OutgoingMatchRequest generateErrorRequest(Integer statusCode, String errorMessage, DefaultOutgoingMatchRequest baseRequest) { baseRequest.setReplayHTTPStatus(statusCode); JSONObject errorJSON = new JSONObject(); if (errorMessage != null) { errorJSON.put(ApiConfiguration.REPLY_JSON_ERROR_DESCRIPTION, errorMessage); } baseRequest.addRequestJSON(errorJSON); return baseRequest; }
public AbstractSearchRequest(String remoteServerId, String apiVersionUsed, String request, String response) { this.remoteServerId = remoteServerId; this.apiVersionUsed = apiVersionUsed; this.setRequest(request); this.setResponse(response); this.requestTime = new Timestamp(System.currentTimeMillis()); }
@Override public void addResponse(JSONObject response) { this.setResponse(response.toString()); }
public void addRequestJSON(JSONObject request) { this.setRequest(request.toString()); }
@Override public IncomingMatchRequest parseIncomingRequest(JSONObject jsonRequest, String remoteServerId) { JSONObject patientJSON = jsonRequest.optJSONObject(ApiConfiguration.JSON_PATIENT); Patient requestPatient = this.patientConverter.convert(patientJSON); DefaultIncomingMatchRequest request = new DefaultIncomingMatchRequest(remoteServerId, this.apiVersion, jsonRequest.toString(), requestPatient); this.logger.debug("JSON->IncomingRequest done"); return request; } }