/** * Creates a SignatureRequest document element. * * @param document * @param details * @return */ private Element createSignatureRequestElement(Document document, ObjectAndSignatureRequestDetails details) { SignatureRequest request = details.signatureRequest; Element requestElem = document.createElement("SignatureRequest"); requestElem.setAttribute("type", request.getSignatureType()); requestElem.setAttribute("signed", String.valueOf(request.isSigned())); requestElem.appendChild( createObjectElement(document, details.key, details.bucketName, details.metadata, "RequestObject")); if (request.isSigned()) { requestElem.appendChild( createObjectElement(document, request.getObjectKey(), request.getBucketName(), request.getObjectMetadata(), "SignedObject")); requestElem.appendChild( createPropertyElement(document, null, request.getSignedUrl(), "SignedURL")); } else if (request.getDeclineReason() != null) { requestElem.appendChild( createPropertyElement(document, null, request.getDeclineReason(), "DeclineReason")); } return requestElem; }
String propertyName = (String) entry.getKey(); String propertyValue = (String) entry.getValue(); rootElem.appendChild(createPropertyElement(document, propertyName, propertyValue, "ApplicationProperty")); String propertyName = (String) entry.getKey(); String propertyValue = (String) entry.getValue(); rootElem.appendChild(createPropertyElement(document, propertyName, propertyValue, "MessageProperty")); for (int i = 0; i < details.length; i++) { ObjectAndSignatureRequestDetails objectDetails = details[i]; rootElem.appendChild(createSignatureRequestElement(document, objectDetails));
XmlGenerator xmlGenerator = new XmlGenerator(); xmlGenerator.addApplicationProperties(gatekeeperMessage.getApplicationProperties()); xmlGenerator.addMessageProperties(gatekeeperMessage.getMessageProperties()); null, priorTransactionId + ".xml", xmlGenerator.generateXml()); summaryXmlObject.setContentType(Mimetypes.MIMETYPE_XML); summaryXmlObject.addMetadata(GatekeeperMessage.PROPERTY_TRANSACTION_ID, priorTransactionId);
/** * Creates and element to contain information about an object. * * @param document * @param key * @param bucketName * @param metadata * @param elementName * @return */ private Element createObjectElement(Document document, String key, String bucketName, Map metadata, String elementName) { if (key == null) { key = ""; } if (bucketName == null) { bucketName = ""; } Element objectElement = document.createElement(elementName); objectElement.setAttribute("key", key); objectElement.setAttribute("bucketName", bucketName); Iterator iter = metadata.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); String metadataName = (String) entry.getKey(); String metadataValue = (String) entry.getValue(); if (metadataValue == null) { metadataValue = ""; } objectElement.appendChild( createPropertyElement(document, metadataName, metadataValue, "Metadata")); } return objectElement; }
Map clonedMetadata = new HashMap(); clonedMetadata.putAll(object.getMetadataMap()); xmlGenerator.addSignatureRequest(object.getKey(), object.getBucketName(), clonedMetadata, request);
XmlGenerator xmlGenerator = new XmlGenerator(); xmlGenerator.addApplicationProperties(gatekeeperMessage.getApplicationProperties()); xmlGenerator.addMessageProperties(gatekeeperMessage.getMessageProperties()); null, priorTransactionId + ".xml", xmlGenerator.generateXml()); summaryXmlObject.setContentType(Mimetypes.MIMETYPE_XML); summaryXmlObject.addMetadata(GatekeeperMessage.PROPERTY_TRANSACTION_ID, priorTransactionId);
/** * Creates and element to contain information about an object. * * @param document * @param key * @param bucketName * @param metadata * @param elementName * @return */ private Element createObjectElement(Document document, String key, String bucketName, Map metadata, String elementName) { if (key == null) { key = ""; } if (bucketName == null) { bucketName = ""; } Element objectElement = document.createElement(elementName); objectElement.setAttribute("key", key); objectElement.setAttribute("bucketName", bucketName); Iterator iter = metadata.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); String metadataName = (String) entry.getKey(); String metadataValue = (String) entry.getValue(); if (metadataValue == null) { metadataValue = ""; } objectElement.appendChild( createPropertyElement(document, metadataName, metadataValue, "Metadata")); } return objectElement; }
Map clonedMetadata = new HashMap(); clonedMetadata.putAll(object.getMetadataMap()); xmlGenerator.addSignatureRequest(object.getKey(), object.getBucketName(), clonedMetadata, request);
/** * Creates a SignatureRequest document element. * * @param document * @param details * @return */ private Element createSignatureRequestElement(Document document, ObjectAndSignatureRequestDetails details) { SignatureRequest request = details.signatureRequest; Element requestElem = document.createElement("SignatureRequest"); requestElem.setAttribute("type", request.getSignatureType()); requestElem.setAttribute("signed", String.valueOf(request.isSigned())); requestElem.appendChild( createObjectElement(document, details.key, details.bucketName, details.metadata, "RequestObject")); if (request.isSigned()) { requestElem.appendChild( createObjectElement(document, request.getObjectKey(), request.getBucketName(), request.getObjectMetadata(), "SignedObject")); requestElem.appendChild( createPropertyElement(document, null, request.getSignedUrl(), "SignedURL")); } else if (request.getDeclineReason() != null) { requestElem.appendChild( createPropertyElement(document, null, request.getDeclineReason(), "DeclineReason")); } return requestElem; }
String propertyName = (String) entry.getKey(); String propertyValue = (String) entry.getValue(); rootElem.appendChild(createPropertyElement(document, propertyName, propertyValue, "ApplicationProperty")); String propertyName = (String) entry.getKey(); String propertyValue = (String) entry.getValue(); rootElem.appendChild(createPropertyElement(document, propertyName, propertyValue, "MessageProperty")); for (int i = 0; i < details.length; i++) { ObjectAndSignatureRequestDetails objectDetails = details[i]; rootElem.appendChild(createSignatureRequestElement(document, objectDetails));