OMElementQueue rootQueue = new OMElementQueue(rootElement);
OMElement metadataElement = this.requireElement(rootQueue, "attachmentMetadata");
OMElementQueue metadataQueue = new OMElementQueue(metadataElement);
AttachmentMetadata metadata = new AttachmentMetadata();
String mimeType = this.expectElementValue(metadataQueue, "mimeType");
if (mimeType != null) {
metadata.setMimeType(mimeType);
}
String fileName = this.expectElementValue(metadataQueue, "fileName");
if (fileName != null) {
metadata.setFileName(fileName);
}
String title = this.expectElementValue(metadataQueue, "title");
if (title != null) {
metadata.setTitle(title);
}
String description = this.expectElementValue(metadataQueue, "description");
if (description != null) {
metadata.setDescription(description);
}
String creationDateStr = this.expectElementValue(metadataQueue, "creationDate");
if ((creationDateStr != null) && ! ("".equals(creationDateStr))) {
metadata.setCreationDate(new XsdDateTime(creationDateStr).getTime());
}
String payloadURLStr = this.requireElementValue(rootQueue, "payloadUrl");
return new Attachment(metadata, payloadURLStr);
}