@@ -258,7 +258,6 @@ def get_geonode_resource_type(self, remote_resource_type: str) -> ResourceBase:
258
258
def get_resource (
259
259
self ,
260
260
harvestable_resource : harvesting_models .HarvestableResource ,
261
- harvesting_session_id : int
262
261
) -> typing .Optional [resourcedescriptor .RecordDescription ]:
263
262
"""Harvest a single resource from the remote service"""
264
263
remote_id = harvestable_resource .unique_identifier .rpartition (self ._UNIQUE_ID_SEPARATOR )[- 1 ]
@@ -281,6 +280,15 @@ def get_resource(
281
280
)
282
281
return result
283
282
283
+ def get_geonode_resource_defaults (
284
+ self ,
285
+ harvested_info : base .HarvestedResourceInfo ,
286
+ harvestable_resource : harvesting_models .HarvestableResource ,
287
+ ) -> typing .Dict :
288
+ defaults = super ().get_geonode_resource_defaults (harvested_info , harvestable_resource )
289
+ defaults ["doc_url" ] = harvested_info .resource_descriptor .distribution .download_url
290
+ return defaults
291
+
284
292
def update_geonode_resource (
285
293
self ,
286
294
harvested_info : base .HarvestedResourceInfo ,
@@ -298,21 +306,6 @@ def update_geonode_resource(
298
306
else :
299
307
raise RuntimeError (f"Invalid resource type: { harvestable_resource .remote_resource_type } " )
300
308
301
- def finalize_resource_update (
302
- self ,
303
- geonode_resource : ResourceBase ,
304
- harvested_info : base .HarvestedResourceInfo ,
305
- harvestable_resource : harvesting_models .HarvestableResource ,
306
- harvesting_session_id : int
307
- ) -> ResourceBase :
308
- if harvestable_resource .remote_resource_type != PdnResourceType .DOCUMENT .value :
309
- raise RuntimeError (f"Unexpected resource type: { harvestable_resource .remote_resource_type } " )
310
- else :
311
- geonode_resource .thumbnail_url = harvested_info .resource_descriptor .distribution .thumbnail_url
312
- geonode_resource .doc_url = harvested_info .resource_descriptor .distribution .original_format_url
313
- geonode_resource .save ()
314
- return geonode_resource
315
-
316
309
def finalize_resource_deletion (self , harvestable_resource : harvesting_models .HarvestableResource ):
317
310
record_class = {
318
311
PdnResourceType .ALERT : models .Alert ,
@@ -658,6 +651,7 @@ def _get_resource_descriptor_for_document_resource(
658
651
point_of_contact = point_of_contact ,
659
652
author = author ,
660
653
date_stamp = date_stamp ,
654
+ reference_systems = ["EPSG:4326" ],
661
655
identification = resourcedescriptor .RecordIdentification (
662
656
name = raw_resource .get ("title" ),
663
657
title = raw_resource .get ("title" ),
@@ -666,7 +660,6 @@ def _get_resource_descriptor_for_document_resource(
666
660
abstract = raw_resource .get ("description" , "" ),
667
661
purpose = raw_resource .get ("targetaudicent" ),
668
662
originator = author ,
669
- graphic_overview_uri = graphic_overview_url ,
670
663
place_keywords = [country ] if country is not None else [],
671
664
other_keywords = tuple (),
672
665
license = [],
@@ -680,6 +673,10 @@ def _get_resource_descriptor_for_document_resource(
680
673
distribution = resourcedescriptor .RecordDistribution (
681
674
link_url = f"{ self .remote_url } /document/{ raw_resource ['id' ]} " ,
682
675
thumbnail_url = graphic_overview_url ,
683
- original_format_url = download_url ,
676
+ download_url = download_url ,
684
677
),
678
+ additional_parameters = {
679
+ "extension" : raw_resource .get ("filename" , "" ).rpartition ("." )[- 1 ],
680
+ "doc_url" : download_url ,
681
+ }
685
682
)
0 commit comments