Skip to content

Commit

Permalink
add configuration flag to toggle the sorting of the results
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanzadelhoff committed Dec 2, 2020
1 parent 6ebd58c commit 2e0ee01
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The available parameters in the camel-oai-pmh.properties file are:
* oai-pmh.dcatde.contributorID: [dcatde:contributorID](https://www.dcat-ap.de/def/contributors/) which is to be inserted in all DCAT datasets
* oai-pmh.db.item.csw.TYPE: should be one of inspire, inspireSoap11 or inspireSoap11, depending on the protocol of the Geoportal
* oai-pmh.db.item.csw.URL: GetRecords URL of the geoportal to be harvested
* oai-pmh.db.item.csw.sortResults: toggle whether the results should be sorted or not. Possible values are `true` and `false`. Defaults to `false`.
* oai-pmh.db.item.ckan.TYPE: currently only ckan is supported
* oai-pmh.db.item.ckan.URL: CKAN catalog URL to be harvested

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
<oai-pmh.base.url.external>http:https://localhost:8080/omdf</oai-pmh.base.url.external>
<oai-pmh.db.item.csw.TYPE>inspire</oai-pmh.db.item.csw.TYPE>
<oai-pmh.db.item.csw.URL>https://localhost:8080/soapServices/CSWStartup</oai-pmh.db.item.csw.URL>
<oai-pmh.db.item.csw.sortResults>false</oai-pmh.db.item.csw.sortResults>
<oai-pmh.db.item.ckan.TYPE>ckan</oai-pmh.db.item.ckan.TYPE>
<oai-pmh.db.item.ckan.URL>https://localhost:9090</oai-pmh.db.item.ckan.URL>
<oai-pmh.dcatde.contributorID>http:https://dcat-ap.de/def/contributors/gdiDE</oai-pmh.dcatde.contributorID>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/camel-oai-pmh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ harvester.base.url=${oai-pmh.base.url.external}/harvesters/
rdf.catalog.base.url=${oai-pmh.base.url.external}/gp-csw/catalog.rdf
db.item.csw.TYPE=${oai-pmh.db.item.csw.TYPE}
db.item.csw.URL=${oai-pmh.db.item.csw.URL}
db.item.csw.sortResults=${oai-pmh.db.item.csw.sortResults}
db.item.ckan.TYPE=${oai-pmh.db.item.ckan.TYPE}
db.item.ckan.URL=${oai-pmh.db.item.ckan.URL}
dcatde.contributorID=${oai-pmh.dcatde.contributorID}
3 changes: 3 additions & 0 deletions src/main/resources/camel-oai-pmh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
<setHeader headerName="contributorID">
<simple>{{dcatde.contributorID}}</simple>
</setHeader>
<setHeader headerName="sortResults">
<simple>{{db.item.csw.sortResults}}</simple>
</setHeader>
<removeHeader headerName="page"/>
<removeHeader headerName="cookie"/>
<!-- we need some element for xsl input, but the result only depends on header (request) parameters -->
Expand Down
15 changes: 9 additions & 6 deletions src/main/resources/inspireRequest.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<xsl:param name="resumptionToken"/>
<xsl:param name="page"/>
<xsl:param name="soapVersion"/>
<xsl:param name="sortResults"/>

<xsl:param name="response_date"/>

Expand Down Expand Up @@ -193,12 +194,14 @@
</xsl:choose>
</ogc:Filter>
</csw:Constraint>
<ogc:SortBy>
<ogc:SortProperty>
<ogc:PropertyName>apiso:Identifier</ogc:PropertyName>
<ogc:SortOrder>ASC</ogc:SortOrder>
</ogc:SortProperty>
</ogc:SortBy>
<xsl:if test="$sortResults = 'true'">
<ogc:SortBy>
<ogc:SortProperty>
<ogc:PropertyName>apiso:Identifier</ogc:PropertyName>
<ogc:SortOrder>ASC</ogc:SortOrder>
</ogc:SortProperty>
</ogc:SortBy>
</xsl:if>
</csw:Query>
</csw:GetRecords>
</xsl:template>
Expand Down

0 comments on commit 2e0ee01

Please sign in to comment.