}
@Override
public ExtractResponse createExtractResponse(Long uploadId, Long id, Long zoneId, Long accountId, String mode, String url) {
ExtractResponse response = new ExtractResponse();
response.setObjectName("template");
VMTemplateVO template = ApiDBUtils.findTemplateById(id);
response.setId(template.getUuid());
response.setName(template.getName());
if (zoneId != null) {
DataCenter zone = ApiDBUtils.findZoneById(zoneId);
response.setZoneId(zone.getUuid());
response.setZoneName(zone.getName());
}
response.setMode(mode);
if (uploadId == null) {
// region-wide image store
response.setUrl(url);
response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString());
} else {
UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId);
response.setUploadId(uploadInfo.getUuid());
response.setState(uploadInfo.getUploadState().toString());
response.setUrl(uploadInfo.getUploadUrl());
}
Account account = ApiDBUtils.findAccountById(accountId);
response.setAccountId(account.getUuid());
return response;
}