static String createRequestsListResponse(final PartialSignRequestsList partialSignRequests) { final StringBuilder sb = new StringBuilder(); sb.append(XML_HEADER); sb.append("<list n='"); // $NON-NLS-1$ sb.append(partialSignRequests.getTotalSignRequests()); sb.append("'>"); // $NON-NLS-1$ for (final SignRequest sr : partialSignRequests.getCurrentSignRequests()) { sb.append("<rqt id=\"") .append(sr.getId()) // $NON-NLS-1$ .append("\" priority=\"") .append(sr.getPriority()) // $NON-NLS-1$ .append("\" workflow=\"") .append(sr.isWorkflow()) // $NON-NLS-1$ .append("\" forward=\"") .append(sr.isForward()) // $NON-NLS-1$ .append("\" type=\"") .append(sr.getType()) // $NON-NLS-1$ .append("\">"); // $NON-NLS-1$ sb.append("<subj>").append(sr.getSubject()).append("</subj>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<snder>").append(sr.getSender()).append("</snder>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<view>").append(sr.getView()).append("</view>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<date>").append(sr.getDate()).append("</date>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<docs>"); // $NON-NLS-1$ for (final SignRequestDocument doc : sr.getDocumentsRequests()) { sb.append("<doc docid=\"").append(doc.getId()).append("\">"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<nm>").append(doc.getName()).append("</nm>"); // $NON-NLS-1$ //$NON-NLS-2$ if (doc.getSize() != null) { sb.append("<sz>").append(doc.getSize()).append("</sz>"); // $NON-NLS-1$ //$NON-NLS-2$ } sb.append("<mmtp>") .append(doc.getMimeType()) .append("</mmtp>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<sigfrmt>") .append(doc.getSignFormat()) .append("</sigfrmt>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<mdalgo>") .append(doc.getMessageDigestAlgorithm()) .append("</mdalgo>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<params>") .append(doc.getParams() != null ? doc.getParams() : "") .append("</params>"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ sb.append("</doc>"); // $NON-NLS-1$ } sb.append("</docs>"); // $NON-NLS-1$ sb.append("</rqt>"); // $NON-NLS-1$ } sb.append("</list>"); // $NON-NLS-1$ return sb.toString(); }
/** * Crea un XML con la información de detalle de una solicitud de firma. * * @param requestDetails Detalle de la solicitud. * @return XML con los datos detallados de la solicitud. */ static String createRequestDetailResponse(final Detail requestDetails) { final StringBuilder sb = new StringBuilder(); sb.append(XML_HEADER); sb.append("<dtl id=\"") .append(requestDetails.getId()) // $NON-NLS-1$ .append("\" priority=\"") .append(requestDetails.getPriority()) // $NON-NLS-1$ .append("\" workflow=\"") .append(requestDetails.isWorkflow()) // $NON-NLS-1$ .append("\" forward=\"") .append(requestDetails.isForward()) // $NON-NLS-1$ .append("\" type=\"") .append(requestDetails.getType()) // $NON-NLS-1$ .append("\">"); // $NON-NLS-1$ sb.append("<subj>") .append(requestDetails.getSubject()) .append("</subj>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<snders>"); // $NON-NLS-1$ for (final Object sender : requestDetails.getSenders()) { sb.append("<snder>").append(sender).append("</snder>"); // $NON-NLS-1$ //$NON-NLS-2$ } sb.append("</snders>"); // $NON-NLS-1$ sb.append("<date>") .append(requestDetails.getDate()) .append("</date>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<app>") .append(requestDetails.getApp()) .append("</app>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<ref>") .append(requestDetails.getRef()) .append("</ref>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<sgnlines>"); // $NON-NLS-1$ for (final Vector<String> signLine : requestDetails.getSignLines()) { sb.append("<sgnline>"); // $NON-NLS-1$ for (final Object receiver : signLine) { sb.append("<rcvr>").append(receiver).append("</rcvr>"); // $NON-NLS-1$ //$NON-NLS-2$ } sb.append("</sgnline>"); // $NON-NLS-1$ } sb.append("</sgnlines>"); // $NON-NLS-1$ sb.append("<docs>"); // $NON-NLS-1$ for (final SignRequestDocument doc : requestDetails.getDocs()) { sb.append("<doc docid=\"").append(doc.getId()).append("\">"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<nm>").append(doc.getName()).append("</nm>"); // $NON-NLS-1$ //$NON-NLS-2$ if (doc.getSize() != null) { sb.append("<sz>").append(doc.getSize()).append("</sz>"); // $NON-NLS-1$ //$NON-NLS-2$ } sb.append("<mmtp>").append(doc.getMimeType()).append("</mmtp>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<sigfrmt>") .append(doc.getSignFormat()) .append("</sigfrmt>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<mdalgo>") .append(doc.getMessageDigestAlgorithm()) .append("</mdalgo>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("<params>") .append(doc.getParams()) .append("</params>"); // $NON-NLS-1$ //$NON-NLS-2$ sb.append("</doc>"); // $NON-NLS-1$ } sb.append("</docs>"); // $NON-NLS-1$ sb.append("</dtl>"); // $NON-NLS-1$ return sb.toString(); }