com.sippnex.fileblade.dtos.UploadResponseDto Maven / Gradle / Ivy
package com.sippnex.fileblade.dtos;
import com.sippnex.fileblade.entities.UploadResponse;
public class UploadResponseDto {
private Long id;
private String downloadUrl;
private boolean success;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public static UploadResponseDto parse(UploadResponse uploadResponse, String serverBaseUrl) {
UploadResponseDto uploadResponseDto = new UploadResponseDto();
uploadResponseDto.setId(uploadResponse.getId());
uploadResponseDto.setSuccess(uploadResponse.isSuccess());
uploadResponseDto.setDownloadUrl(serverBaseUrl + "/fileblade/download/" + uploadResponse.getFilePath().substring(1).replace("/", "+"));
return uploadResponseDto;
}
}