return resourceDataList.toArray(new ResourceData[resourceDataList.size()]);
}
public static ContentBean getContent(String path, UserRegistry registry) throws Exception {
ResourcePath resourcePath = new ResourcePath(path);
ContentBean bean = new ContentBean();
Resource resource = registry.get(path);
bean.setMediaType(resource.getMediaType());
bean.setCollection(resource instanceof Collection);
bean.setLoggedIn(!RegistryConstants.ANONYMOUS_USER.equals(registry.getUserName()));
bean.setPathWithVersion(resourcePath.getPathWithVersion());
bean.setAbsent(resource.getProperty("registry.absent"));
List mountPoints = resource.getPropertyValues("registry.mountpoint");
List targetPoints = resource.getPropertyValues("registry.targetpoint");
// List paths = resource.getPropertyValues("registry.path");
List actualPaths = resource.getPropertyValues("registry.actualpath");
String user = resource.getProperty("registry.user");
if (resource.getProperty("registry.link") != null) {
if (mountPoints != null && targetPoints != null) {
// String mountPoint = (String)mountPoints.get(0);
// String targetPoint = (String)targetPoints.get(0);
// String tempPath;
// if (targetPoint.equals(RegistryConstants.PATH_SEPARATOR) && !childPath.equals(mountPoint)) {
// tempPath = ((String)paths.get(0)).substring(mountPoint.length());
// } else {
// tempPath = targetPoint + ((String)paths.get(0)).substring(mountPoint.length());
// }
String tempPath = (String)actualPaths.get(0);
bean.setPutAllowed(
UserUtil.isPutAllowed(registry.getUserName(), tempPath, registry));
bean.setRealPath(tempPath);
} else if (user != null) {
if (registry.getUserName().equals(user)) {
bean.setPutAllowed(true);
} else {
bean.setPutAllowed(
UserUtil.isPutAllowed(registry.getUserName(), path, registry));
}
// Mounted resources should be accessed via the link, and we need not set
// the real path.
}
} else {
boolean putAllowed = UserUtil.isPutAllowed(registry.getUserName(), path, registry);
bean.setPutAllowed(putAllowed);
}
bean.setVersionView(!resourcePath.isCurrentVersion());
bean.setContentPath(resourcePath.getCompletePath());
resource.discard();
return bean;
}