/** * Checks whether node of given path already exists in archive. * Returns {@link YaddaObjectID} of found node. * * @param nodePath * @return {@link YaddaObjectID} of found node or * null if node not found or archiveFacade was not set * @throws ServiceException */ protected YaddaObjectID nodeExists(String nodePath) throws ServiceException { if (archiveFacade!=null) { ArchiveObject2Meta parentMeta = archiveFacade.queryUniqueObject(nodePath, true); return parentMeta!=null?parentMeta.getId():null; } else { log.warn("cannot verify if " + nodePath + " exists, " + "archiveFacade was not set!"); return null; } }
public void removeDump(String dumpId) throws Exception { ArchiveObject2Meta dumpMeta = archiveFacade.queryUniqueObject(dumpId, false); if (dumpMeta == null) return; storageFacade.deleteObject(dumpMeta.getId()); }
ArchiveObjectFacade o = ossf.getObject(meta.getId(), new String[] {ArchiveParamConstants.PART_TYPE_MAIN}, false); ArchiveContentPartFacade p = o.getPart(ArchiveParamConstants.PART_TYPE_MAIN); is = p.getData();
public List<String> listErrorDumps() throws Exception { ArchiveObject2Meta dumpDirectoryMeta = archiveFacade.queryUniqueObject(ERROR_DUMP_OBJECT_PATH, true); if (dumpDirectoryMeta == null) return Collections.emptyList(); ArchiveObjectFacade dumpDirectory = archiveFacade.getObject(dumpDirectoryMeta.getId(), null, true); List<String> dumpList = new LinkedList<String>(); for (Map.Entry<String, List<YaddaObjectID>> children : dumpDirectory.getChildren().entrySet()) { for (YaddaObjectID child : children.getValue()) { ArchiveObjectFacade childObject = archiveFacade.getObject(child, null, false); if (!childObject.getStatus().isDeleted()) { ArchiveObjectPath dumpPath = new ArchiveObjectPath(ERROR_DUMP_OBJECT_PATH, children.getKey()); dumpList.add(dumpPath.encode()); } } } return dumpList; }
parentMeta.getId(), new String[] {partName}, true);
ArchiveObject2Meta currentObj = it.next(); LicenseEvaluatorContext<String[]> context = new LicenseEvaluatorContext<String[]>( currentObj.getId(), currentObj.getTags()); if (!evaluateAccess(obligations, context)) { if (request.isFailWhenAccessDenied()) { String message = "access denied when accessing object: " + currentObj.getId() + " for path: " + request.getPath(); log.warn(message); return new ListArchiveObjects2Response( new YaddaError(SecurityConstants.ERROR_AUTH, message)); } else { log.debug("removing" + currentObj.getId() + " from result list!"); it.remove();
@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; }
throw new NotFoundException(id); ArchiveObjectFacade object = archiveFacade.getObject(meta.getId(), new String[] { ArchiveParamConstants.PART_TYPE_MAIN }, false);
final ArchiveObject2Meta o = archive.queryUniqueObject(cf.getAddress(), true); if (o != null) { final String archiveid = o.getId().getId(); batch.addOrUpdate(Condition.eq(ContentView.ARCHIVE_ID, archiveid), ContentView.tuple(archiveid, articleid, issn, cf.getMimeType(), ce.getExtId()));