From df9aa904b24d3fa020d82d912e857f8f790cc23e Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 14 Jan 2015 20:53:48 +0100 Subject: [PATCH] minor modifications for #298 --- .../apiv3/HdxPackageUpdateMetadataDTO.java | 32 ++++++++++++------- .../service/CkanSynchronizerServiceImpl.java | 10 +++--- .../HdxPackageUpdateMetadataDTOTest.java | 7 ++-- .../resources/samples/json/packageupdate.json | 2 +- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/HDX-System/src/main/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTO.java b/HDX-System/src/main/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTO.java index c4fdfe4d..92431696 100644 --- a/HDX-System/src/main/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTO.java +++ b/HDX-System/src/main/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTO.java @@ -22,11 +22,13 @@ public HdxPackageUpdateMetadataDTO() { // When the METADATA was updated the last time private String last_metadata_update_date; - // sourceName + // Organization name private String dataset_source; + private String dataset_source_short_name; + // sourceCode - private String dataset_source_code; + private String source_code; // indicator type name private String indicator_type; @@ -37,7 +39,7 @@ public HdxPackageUpdateMetadataDTO() { // range of the data, format : 11/02/2014-11/20/2014 private String dataset_date; - private String dataset_summary; + private String description; private String methodology; private String more_info; private String terms_of_use; @@ -85,12 +87,20 @@ public void setDataset_source(final String dataset_source) { this.dataset_source = dataset_source; } - public String getDataset_source_code() { - return dataset_source_code; + public String getDataset_source_short_name() { + return dataset_source_short_name; + } + + public void setDataset_source_short_name(final String dataset_source_short_name) { + this.dataset_source_short_name = dataset_source_short_name; + } + + public String getSource_code() { + return source_code; } - public void setDataset_source_code(final String dataset_source_code) { - this.dataset_source_code = dataset_source_code; + public void setSource_code(final String source_code) { + this.source_code = source_code; } public String getIndicator_type() { @@ -117,12 +127,12 @@ public void setDataset_date(final String dataset_date) { this.dataset_date = dataset_date; } - public String getDataset_summary() { - return dataset_summary; + public String getDescription() { + return description; } - public void setDataset_summary(final String dataset_summary) { - this.dataset_summary = dataset_summary; + public void setDescription(final String description) { + this.description = description; } public String getMethodology() { diff --git a/HDX-System/src/main/java/org/ocha/hdx/service/CkanSynchronizerServiceImpl.java b/HDX-System/src/main/java/org/ocha/hdx/service/CkanSynchronizerServiceImpl.java index a941070b..ce729e66 100644 --- a/HDX-System/src/main/java/org/ocha/hdx/service/CkanSynchronizerServiceImpl.java +++ b/HDX-System/src/main/java/org/ocha/hdx/service/CkanSynchronizerServiceImpl.java @@ -107,9 +107,10 @@ private HdxPackageUpdateMetadataDTO convertDataSerieToCuratedDataset(final DataS dto.setDataset_date(String.format("%s-%s", minDate, maxDate)); } - dto.setDataset_source(source.getName().getDefaultValue()); - dto.setDataset_source_code(source.getCode()); - dto.setDataset_summary(dataSerieMetadataDAO.getDataSerieMetadataByIndicatorTypeCodeAndSourceCodeAndEntryKey(indType.getCode(), source.getCode(), MetadataName.DATASET_SUMMARY).getEntryValue() + dto.setDataset_source(source.getOrganization().getFullName().getDefaultValue()); + dto.setDataset_source_short_name(source.getOrganization().getShortName().getDefaultValue()); + dto.setSource_code(source.getCode()); + dto.setDescription(dataSerieMetadataDAO.getDataSerieMetadataByIndicatorTypeCodeAndSourceCodeAndEntryKey(indType.getCode(), source.getCode(), MetadataName.DATASET_SUMMARY).getEntryValue() .getDefaultValue()); dto.setIndicator_type(indType.getName().getDefaultValue()); dto.setIndicator_type_code(indType.getCode()); @@ -120,7 +121,8 @@ private HdxPackageUpdateMetadataDTO convertDataSerieToCuratedDataset(final DataS dto.setMethodology(getMetadataAsString(indType.getCode(), source.getCode(), MetadataName.METHODOLOGY)); dto.setMore_info(getMetadataAsString(indType.getCode(), source.getCode(), MetadataName.MORE_INFO)); dto.setTerms_of_use(getMetadataAsString(indType.getCode(), source.getCode(), MetadataName.TERMS_OF_USE)); - dto.setValidation_notes_and_comments(getMetadataAsString(indType.getCode(), source.getCode(), MetadataName.VALIDATION_NOTES)); + // this is not send to ckan anymore + // dto.setValidation_notes_and_comments(getMetadataAsString(indType.getCode(), source.getCode(), MetadataName.VALIDATION_NOTES)); final List listCountryCodesForDataSerie = curatedDataService.listCountryCodesForDataSerie(indType.getCode(), source.getCode()); diff --git a/HDX-System/src/test/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTOTest.java b/HDX-System/src/test/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTOTest.java index 18b3729d..a99bbaea 100644 --- a/HDX-System/src/test/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTOTest.java +++ b/HDX-System/src/test/java/org/ocha/hdx/dto/apiv3/HdxPackageUpdateMetadataDTOTest.java @@ -21,9 +21,10 @@ public void testGson() throws IOException { dto.setId("The uuid of the ckan dataset"); dto.setName("The name of the ckan dataset"); dto.setDataset_date("11/02/2014-11/20/2014"); - dto.setDataset_source("The dataset source"); - dto.setDataset_source_code("WFP"); - dto.setDataset_summary("the summary"); + dto.setDataset_source("The organization name"); + dto.setDataset_source_short_name("The organization short name"); + dto.setDescription("the dataset summary"); + dto.setSource_code("WFP"); dto.setIndicator_type("the name of the indicator type"); dto.setIndicator_type_code("PVX040"); dto.setLast_data_update_date("2001-09-09T03:46:40.000000"); diff --git a/HDX-System/src/test/resources/samples/json/packageupdate.json b/HDX-System/src/test/resources/samples/json/packageupdate.json index 3f839450..94bce451 100644 --- a/HDX-System/src/test/resources/samples/json/packageupdate.json +++ b/HDX-System/src/test/resources/samples/json/packageupdate.json @@ -1 +1 @@ -{"id":"The uuid of the ckan dataset","name":"The name of the ckan dataset","last_data_update_date":"2001-09-09T03:46:40.000000","last_metadata_update_date":"2001-09-09T03:46:40.000000","dataset_source":"The dataset source","dataset_source_code":"WFP","indicator_type":"the name of the indicator type","indicator_type_code":"PVX040","dataset_date":"11/02/2014-11/20/2014","dataset_summary":"the summary","methodology":"the methodology","more_info":"more info","terms_of_use":"terms of use","validation_notes_and_comments":"Notes and comments","groups":[{"id":"world"},{"id":"USA"}]} \ No newline at end of file +{"id":"The uuid of the ckan dataset","name":"The name of the ckan dataset","last_data_update_date":"2001-09-09T03:46:40.000000","last_metadata_update_date":"2001-09-09T03:46:40.000000","dataset_source":"The organization name","dataset_source_short_name":"The organization short name","source_code":"WFP","indicator_type":"the name of the indicator type","indicator_type_code":"PVX040","dataset_date":"11/02/2014-11/20/2014","description":"the dataset summary","methodology":"the methodology","more_info":"more info","terms_of_use":"terms of use","validation_notes_and_comments":"Notes and comments","groups":[{"id":"world"},{"id":"USA"}]} \ No newline at end of file