use of org.hisp.dhis.system.util.DhisHttpResponse in project dhis2-core by dhis2.
the class MetadataVersionDelegate method downloadMetadataVersionSnapshot.
public String downloadMetadataVersionSnapshot(MetadataVersion version) throws MetadataVersionServiceException {
String downloadVersionSnapshotURL = metadataSystemSettingService.getDownloadVersionSnapshotURL(version.getName());
DhisHttpResponse dhisHttpResponse = getDhisHttpResponse(downloadVersionSnapshotURL, DOWNLOAD_TIMEOUT);
if (isValidDhisHttpResponse(dhisHttpResponse)) {
return dhisHttpResponse.getResponse();
}
return null;
}
use of org.hisp.dhis.system.util.DhisHttpResponse in project dhis2-core by dhis2.
the class MetadataVersionDelegate method getRemoteMetadataVersion.
public MetadataVersion getRemoteMetadataVersion(String versionName) {
String versionDetailsUrl = metadataSystemSettingService.getVersionDetailsUrl(versionName);
DhisHttpResponse dhisHttpResponse = getDhisHttpResponse(versionDetailsUrl, VERSION_TIMEOUT);
MetadataVersion dataVersion = null;
if (isValidDhisHttpResponse(dhisHttpResponse)) {
try {
dataVersion = renderService.fromJson(dhisHttpResponse.getResponse(), MetadataVersion.class);
} catch (Exception e) {
String message = "Exception occurred while trying to do JSON conversion for metadata version";
log.error(message, e);
throw new MetadataVersionServiceException(message, e);
}
}
return dataVersion;
}
Aggregations