returnValue = folderAPI.matchFilter(folder, fileName);
return returnValue;
}
private Summary[] getChildrenData(String folderUriAux, User user) throws IOException {
PermissionAPI perAPI = APILocator.getPermissionAPI();
Logger.debug(this.getClass(), "getChildrenNames");
folderUriAux=stripMapping(folderUriAux);
ArrayList<Summary> returnValue = new ArrayList<Summary>();
try {
// ### GET THE HOST ###
if (folderUriAux.equals("") || folderUriAux.equals("/")) {
List<Host> hosts = hostAPI.findAll(user, false);
for (Host host : hosts) {
Summary s = new Summary();
s.setName(host.getHostname());
s.setPath("/" + s.getName());
s.setFolder(true);
s.setCreateDate(host.getModDate());
s.setModifyDate(host.getModDate());
s.setHost(host);
returnValue.add(s);
}
} else {
// ### GET THE FOLDERS AT THE FIRST LEVEL ###
String hostName = getHostname(folderUriAux);
Host host;
try {
host = hostAPI.findByName(hostName, user, false);
} catch (DotDataException e) {
Logger.error(DotWebdavHelper.class, e.getMessage(), e);
throw new IOException(e.getMessage());
} catch (DotSecurityException e) {
Logger.error(DotWebdavHelper.class, e.getMessage(), e);
throw new IOException(e.getMessage());
}
String path = getPath(folderUriAux);
if (path.equals("") || path.equals("/")) {
List<Folder> folders = folderAPI.findSubFolders(host,user,false);
for (Folder folderAux : folders) {
if (perAPI.doesUserHavePermission(folderAux, PERMISSION_READ, user, false)) {
Summary s = new Summary();
s.setName(folderAux.getName());
s.setPath("/" + host.getHostname()
+ idapi.find(folderAux).getPath());
s.setPath(s.getPath().substring(0,
s.getPath().length() - 1));
s.setFolder(true);
s.setCreateDate(folderAux.getIDate());
s.setCreateDate(folderAux.getModDate());
s.setHost(host);
returnValue.add(s);
}
}
} else {
// ### GET THE FOLDERS, HTMLPAHES AND FILES AT SECOND LEVEL
// AND LOWERS ###
path += "/";
Folder folder = folderAPI.findFolderByPath(path, host, user, false);
if (InodeUtils.isSet(folder.getInode())) {
List<Folder> folders = new ArrayList<Folder>();
// List<HTMLPage> pages = new ArrayList<HTMLPage>();
List<Versionable> files = new ArrayList<Versionable>();
// List<Link> links = new ArrayList<Link>();
try {
folders = (ArrayList<Folder>)APILocator.getFolderAPI().findSubFolders(folder, user, false);
// pages = (ArrayList<HTMLPage>)
// InodeFactory.getChildrenClassByCondition(folder,HTMLPage.class,
// conditionAsset);
files.addAll(folderAPI.getWorkingFiles(folder, user,false));
if(folder.getInode().equals(FolderAPI.SYSTEM_FOLDER)){
files.addAll(APILocator.getFileAssetAPI().findFileAssetsByHost(APILocator.getHostAPI().find(folder.getHostId(), user,false), user,false));
}else{
files.addAll(APILocator.getFileAssetAPI().findFileAssetsByFolder(folder, user,false));
}
// links = (ArrayList<Link>)
// InodeFactory.getChildrenClassByCondition(folder,Link.class,
// conditionAsset);
} catch (Exception ex) {
String message = ex.getMessage();
Logger.debug(this, ex.toString());
}
for (Folder folderAux : folders) {
if (perAPI.doesUserHavePermission(folderAux,
PERMISSION_READ, user, false)) {
Summary s = new Summary();
s.setFolder(true);
s.setCreateDate(folderAux.getiDate());
s.setModifyDate(folderAux.getModDate());
s.setName(folderAux.getName());
s.setPath("/" + host.getHostname()
+ idapi.find(folderAux).getPath());
s.setPath(s.getPath().substring(0,
s.getPath().length() - 1));
s.setHost(host);
returnValue.add(s);
}
}
for (Versionable file : files) {
if (perAPI.doesUserHavePermission((Permissionable)file,
PERMISSION_READ, user, false)) {
IFileAsset fa = (IFileAsset)file;
String fileUri = "";
java.io.File workingFile = null;
FileInputStream is = null;