com.sippnex.fileblade.dtos.FileDto Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fileblade-server Show documentation
Show all versions of fileblade-server Show documentation
Server-side Spring library for fileblade. A web filemanager
package com.sippnex.fileblade.dtos;
import com.sippnex.fileblade.entities.File;
public class FileDto extends FilebladeItemDto {
private String downloadUrl;
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public static FileDto parse(File file, String serverBaseUrl) {
FileDto fileDto = new FileDto();
fileDto.setId(file.getId());
fileDto.setName(file.getName());
fileDto.setPath(file.getPath());
fileDto.setDownloadUrl(serverBaseUrl + "/fileblade/download/" + fileDto.getPath().substring(1).replace("/", "+"));
if (file.getParentDirectory() != null) {
fileDto.setParentDirectoryId(file.getParentDirectory().getId());
} else {
fileDto.setParentDirectoryId((long)0);
}
fileDto.setType(Type.File);
return fileDto;
}
}