public Stream<String> getDerivateIDsofObject(final String mcrObjectId) throws SwordError { final List<MCRObjectID> derivateIds = MCRMetadataManager.getDerivateIds(MCRObjectID.getInstance(mcrObjectId), 10, TimeUnit.SECONDS); return derivateIds.stream().map(MCRObjectID::toString); }
private static List<String> forAllDerivatesOfObject(String objectID, String batchCommandSyntax) { MCRObjectID mcrobjid; try { mcrobjid = MCRObjectID.getInstance(objectID); } catch (Exception e) { LOGGER.error("The object ID {} is wrong", objectID); return null; } List<MCRObjectID> derivateIds = MCRMetadataManager.getDerivateIds(mcrobjid, 0, TimeUnit.MILLISECONDS); if (derivateIds == null) { LOGGER.error("Object does not exist: {}", mcrobjid); } ArrayList<String> cmds = new ArrayList<>(derivateIds.size()); for (MCRObjectID derId : derivateIds) { cmds.add(MessageFormat.format(batchCommandSyntax, derId)); } return cmds; }
/** * Builds a list with with right content types and media urls assigned of a specific Object * * @param obj the object * @return a list of entrys Media-Type, URL */ public List<Map.Entry<String, URI>> getMediaList(MCRObject obj) { List<Map.Entry<String, URI>> entryList = new ArrayList<>(); Optional<MCRObjectID> derivateIdOptional = MCRMetadataManager.getDerivateIds(obj.getId(), 1, TimeUnit.MINUTES) .stream().findFirst(); derivateIdOptional.ifPresent(derivateId -> { MCRDerivate derivate = MCRMetadataManager.retrieveMCRDerivate(derivateId); String mainDoc = derivate.getDerivate().getInternals().getMainDoc(); MCRPath mainDocumentPath = MCRPath.getPath(derivateId.toString(), mainDoc); try { String contentType = Optional.ofNullable(MCRContentTypes.probeContentType(mainDocumentPath)) .orElse("application/octet-stream"); entryList.add(new AbstractMap.SimpleEntry<>(contentType, new URI(this.registerURL + MCRXMLFunctions .encodeURIPath("/servlets/MCRFileNodeServlet/" + derivateId + "/" + mainDoc)))); } catch (IOException | URISyntaxException e) { LOGGER.error("Error while detecting the file to register!", e); } }); return entryList; }
private Response getThumbnail(String id, int size, String ext) { List<MCRPath> mainDocs = MCRMetadataManager.getDerivateIds(MCRObjectID.getInstance(id), 1, TimeUnit.MINUTES) .stream() .filter(d -> MCRAccessManager.checkDerivateContentPermission(d, MCRAccessManager.PERMISSION_READ))
MCRMetadataManager.getDerivateIds(parentObjId, 0, TimeUnit.SECONDS) .stream() .map(MCRObjectID::toString)
List<MCRObjectID> derivateIds = MCRMetadataManager.getDerivateIds(objectID, 10, TimeUnit.SECONDS); final String zipFileName = ppn + ".zip"; openZip(zipFileSystem -> {