Add message key to insertDocument responses

This commit is contained in:
Paul Trudel 2024-05-09 19:54:41 +00:00
parent 4a1c81fa76
commit aebb693379
3 changed files with 7 additions and 5 deletions

View File

@ -218,12 +218,13 @@ public class ResponseBuilder {
return xmlText.toString(); return xmlText.toString();
} }
public String buildInsertDocumentResponse(String message, String returnCode) { public String buildInsertDocumentResponse(String messageKey, String message, String returnCode) {
StringWriter xmlText = new StringWriter(); StringWriter xmlText = new StringWriter();
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
data.put("returnCode", returnCode); data.put("returnCode", returnCode);
data.put("messageKey", messageKey);
data.put("message", message); data.put("message", message);
processData(getTemplate("insert-document.ftlx"), data, xmlText); processData(getTemplate("insert-document.ftlx"), data, xmlText);

View File

@ -1129,14 +1129,14 @@ class ApiController {
if (uploadDocuments(meeting, true)) { if (uploadDocuments(meeting, true)) {
withFormat { withFormat {
xml { xml {
render(text: responseBuilder.buildInsertDocumentResponse("Presentation is being uploaded", RESP_CODE_SUCCESS) render(text: responseBuilder.buildInsertDocumentResponse("documentInserted", "Presentation is being uploaded", RESP_CODE_SUCCESS)
, contentType: "text/xml") , contentType: "text/xml")
} }
} }
} else if (meetingService.isMeetingWithDisabledPresentation(meetingId)) { } else if (meetingService.isMeetingWithDisabledPresentation(meeting.getInternalId())) {
withFormat { withFormat {
xml { xml {
render(text: responseBuilder.buildInsertDocumentResponse("Presentation feature is disabled, ignoring.", render(text: responseBuilder.buildInsertDocumentResponse("presentationDisabled", "Presentation feature is disabled, ignoring.",
RESP_CODE_FAILED), contentType: "text/xml") RESP_CODE_FAILED), contentType: "text/xml")
} }
} }
@ -1145,7 +1145,7 @@ class ApiController {
log.warn("Meeting with externalID ${externalMeetingId} doesn't exist.") log.warn("Meeting with externalID ${externalMeetingId} doesn't exist.")
withFormat { withFormat {
xml { xml {
render(text: responseBuilder.buildInsertDocumentResponse( render(text: responseBuilder.buildInsertDocumentResponse("notFound",
"Meeting with id [${externalMeetingId}] not found.", RESP_CODE_FAILED), "Meeting with id [${externalMeetingId}] not found.", RESP_CODE_FAILED),
contentType: "text/xml") contentType: "text/xml")
} }

View File

@ -3,6 +3,7 @@
<response> <response>
<#-- Where code is a 'SUCCESS' or 'FAILED' String --> <#-- Where code is a 'SUCCESS' or 'FAILED' String -->
<returncode>${returnCode}</returncode> <returncode>${returnCode}</returncode>
<messageKey>${messageKey}</messageKey>
<message>${message}</message> <message>${message}</message>
</response> </response>
</#compress> </#compress>