@Override public Set<DocumentAttachment> process(String path, String parent, boolean downloadRemoteAttachments, File workingDirectory) throws InvalidAttachmentException { if (ArchiveObjectPath.isValid(path)) { return fetchYaddaContent(path, parent); } try { URL url = new URL(path); URI uri = new URI(url.getProtocol(), null, url.getHost(), url.getPort(), url.getPath(), url.getQuery(), null); String encodedPath = uri.toASCIIString(); Set<DocumentAttachment> attachments = new HashSet<DocumentAttachment>(); if (downloadRemoteAttachments) { try { DocumentAttachment documentAttachment = fetchRemoteContent(encodedPath, parent); attachments.add(documentAttachment); } catch (Exception e) { throw new InvalidAttachmentException(path, "Exception fetching remote attachment", e); } } return attachments; } catch (MalformedURLException | URISyntaxException e) { throw new InvalidAttachmentException(path, "Invalid attachment url"); } }
for (ContentFile location : content.getLocations()) { if ((ContentFile.TYPE_URI.equals(location.getAddressType()) || ContentFile.TYPE_URL.equals(location.getAddressType())) && ArchiveObjectPath.isValid(location.getAddress())) { for (ContentFile location : fulltext.getLocations()) { if ((ContentFile.TYPE_URI.equals(location.getAddressType()) || ContentFile.TYPE_URL.equals(location.getAddressType())) && ArchiveObjectPath.isValid(location.getAddress())) { try { URI uri = new URI(location.getAddress());
if (uri!=null) { List<StorageOperation> result = new ArrayList<StorageOperation>(); if (!ArchiveObjectPath.isValid(uri)) { log.debug(uri + " is not an object from the yadda archive (probably external object)"); return null;
private void fillContent(final CatalogElement ce, final SElement sElement) throws YaddaException { // content files if (ce.getElement().getContents() != null && !ce.getElement().getContents().isEmpty()) { for (final Content content : ce.getElement().getContents()) { for (final ContentFile location : content.getLocations()) { final String fileAddress = location.getAddress(); if (ArchiveObjectPath.isValid(fileAddress)) { sElement.hasContent(true); } else { sElement.setRemoteContent(true); } } } // content licenses if (!Utils.emptyCollection(ce.getContentLicenses())) { for (final String license : ce.getContentLicenses()) { sElement.addContentLicense(license); } } } fillRemoteContent(ce, sElement); }