com.sippnex.fileblade.dtos.DirectoryDto 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.Directory;
import com.sippnex.fileblade.entities.FilebladeItem;
import java.util.ArrayList;
import java.util.List;
public class DirectoryDto extends FilebladeItemDto {
private List items;
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public static DirectoryDto parse(Directory directory, String serverBaseUrl) {
DirectoryDto directoryDto = new DirectoryDto();
directoryDto.setId(directory.getId());
directoryDto.setName(directory.getName());
directoryDto.setPath(directory.getPath());
// Parse parent directory id
if (directory.getParentDirectory() != null) {
directoryDto.setParentDirectoryId(directory.getParentDirectory().getId());
}
// Parse items
List items = new ArrayList<>();
for (FilebladeItem item: directory.getItems()) {
items.add(FilebladeItemDto.parse(item, serverBaseUrl));
}
directoryDto.setItems(items);
directoryDto.setType(Type.Directory);
return directoryDto;
}
}