Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
seustachi committed Jan 12, 2015
1 parent d9adb50 commit c7af131
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void updateMetadataToCkan(final int limit) {
for (final DataSerieToCuratedDataset dataSerieToCuratedDataset : datasetsWithUnsyncedMetadata) {
final HdxPackageUpdateMetadataDTO dto = convertDataSerieToCuratedDataset(dataSerieToCuratedDataset);

final String query = GSONBuilderWrapper.getGSON().toJson(dto);
final String query = GSONBuilderWrapper.getGSONIgnoreNulls().toJson(dto);
ckanUpdaterLogger.debug(String.format("about to send message for the dataSerie : %s", dto.getId()));
ckanUpdaterLogger.debug(query);
String response;
Expand Down Expand Up @@ -100,10 +100,12 @@ private HdxPackageUpdateMetadataDTO convertDataSerieToCuratedDataset(final DataS
}

final Map<String, Timestamp> minMaxDatesForDataSeries = curatedDataService.getMinMaxDatesForDataSeries(new DataSerie(indType.getCode(), source.getCode()));
final DateTimeFormatter customFormatter = DateTimeFormat.forPattern("MM/dd/YYYY");
final String minDate = customFormatter.print(minMaxDatesForDataSeries.get("MIN").getTime());
final String maxDate = customFormatter.print(minMaxDatesForDataSeries.get("MAX").getTime());
dto.setDataset_date(String.format("%s-%s", minDate, maxDate));
if (minMaxDatesForDataSeries != null && minMaxDatesForDataSeries.get("MIN") != null) {
final DateTimeFormatter customFormatter = DateTimeFormat.forPattern("MM/dd/YYYY");
final String minDate = customFormatter.print(minMaxDatesForDataSeries.get("MIN").getTime());
final String maxDate = customFormatter.print(minMaxDatesForDataSeries.get("MAX").getTime());
dto.setDataset_date(String.format("%s-%s", minDate, maxDate));
}

dto.setDataset_source(source.getName().getDefaultValue());
dto.setDataset_source_code(source.getCode());
Expand All @@ -123,7 +125,7 @@ private HdxPackageUpdateMetadataDTO convertDataSerieToCuratedDataset(final DataS
final List<String> listCountryCodesForDataSerie = curatedDataService.listCountryCodesForDataSerie(indType.getCode(), source.getCode());

for (final String countryCode : listCountryCodesForDataSerie) {
dto.addGroup(countryCode);
dto.addGroup(countryCode.toLowerCase());
}
return dto;
}
Expand Down

0 comments on commit c7af131

Please sign in to comment.