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; }
@Override public UserProfile getUserProfile(String userId) { try { ArchiveObjectFacade archiveObject = archive.getObjectWithAllParts(new YaddaObjectID(userId), false); if (archiveObject.getStatus().isDeleted()) { return null; } UserProfile userProfile = new UserProfile(); userProfile.setUserId(archiveObject.getId().getId()); Collection<ArchiveContentPartFacade> archiveParts = archiveObject.getParts(); Set<String> parts = new HashSet<String>(); for (ArchiveContentPartFacade archivePart : archiveParts) { parts.add(archivePart.getType()); } userProfile.setAvailableParts(parts); return userProfile; } catch (NotFoundException e) { // OK profile not found so part is null return null; } catch (ServiceException e) { String message = "Fetching user profile for user " + userId + " not successfull."; logger.error(message, e); throw new RuntimeException(message, e); } }