public static boolean isValid(String uri) { try { ArchiveObjectPath.decode(uri); return true; } catch (URISyntaxException e) { return false; } catch (ServiceException e) { return false; } }
@Override public Set<DocumentAttachment> call() throws Exception { ArchiveObjectPath archivePath = ArchiveObjectPath.decode(path); ArchiveObject2Meta aObject = archiveFacadeProvider.getArchiveFacade().queryUniqueObject(archivePath, true); if (aObject == null) { throw new InvalidAttachmentException(path, "Attachment not available "); } ArchiveObjectFacade objectFacade = archiveFacadeProvider.getArchiveFacade().getObjectWithAllParts(aObject.getId(), true); Set<DocumentAttachment> attachments = new HashSet<DocumentAttachment>(); Collection<ArchiveContentPartFacade> parts = objectFacade.getParts(); try { for (ArchiveContentPartFacade partFacade : parts) { byte[] bytes = IOUtils.toByteArray(partFacade.getData()); DocumentAttachment documentAttachment = new DocumentAttachment(parent, partFacade.getId(), partFacade.getId(), partFacade.getSize(), partFacade.getMime(), bytes, false); documentAttachment.getProperties().put(ImporterConstants.PROPERTY_REMOTE_SOURCE_URL, path); attachments.add(documentAttachment); } } finally { closeFacades(parts); } return attachments; }
if (i==0) { ArchiveObjectPath rootPath = ArchiveObjectPath.decode(currentPath); meta.setId(rootPath.getRootId()); } else {