Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into es-indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed May 31, 2017
2 parents 1db08e3 + e5c09bd commit 3f25d00
Show file tree
Hide file tree
Showing 33 changed files with 403 additions and 333 deletions.
7 changes: 7 additions & 0 deletions core/src/main/java/org/fao/geonet/util/XslUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -682,4 +683,10 @@ public static String encodeForURL(String str) {
return str;
}
}

private static final Random RANDOM = new Random();

public static String randomId() {
return "N" + RANDOM.nextInt(Integer.MAX_VALUE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public Pair<Element, Element> search(ServiceContext context, int startPos, int m

Element summary = summaryAndSearchResults.one();
int numMatches = Integer.parseInt(summary.getAttributeValue("count"));
if (startPos > numMatches) {
if (numMatches != 0 && startPos > numMatches) {
throw new InvalidParameterValueEx("startPosition", String.format(
"Start position (%d) can't be greater than number of matching records (%d for current search).",
startPos, numMatches
Expand Down
7 changes: 7 additions & 0 deletions schemas/config-editor.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,13 @@ section which is not used often by the end-user. More than one tab could be grou
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="formatter-order" type="xs:int">
<xs:annotation>
<xs:documentation><![CDATA[
Define the ordering index of this tab in the XSLT formatter (Note used for editor).
]]></xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
match="gmd:CI_Date/gmd:date">
<xsl:param name="schema" select="$schema" required="no"/>
<xsl:param name="labels" select="$labels" required="no"/>
<xsl:param name="listOfValues" select="$iso19139codelists" required="no"/>

<xsl:variable name="xpath" select="gn-fn-metadata:getXPath(.)"/>
<xsl:variable name="isoType" select="if (../@gco:isoType) then ../@gco:isoType else ''"/>
Expand All @@ -97,7 +98,7 @@
<xsl:variable name="codelist"
select="gn-fn-metadata:getCodeListValues($schema,
'gmd:CI_DateTypeCode',
$codelists,
$listOfValues,
.)"/>
<xsl:call-template name="render-codelist-as-select">
<xsl:with-param name="listOfValues" select="$codelist"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - -->
<entry>
<code>onGoing</code>
<label>Mis à jour continue</label>
<label>Mise à jour continue</label>
<description>Ressource continuellement mise à jour</description>
</entry>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@
</xsl:call-template>
</xsl:variable>

<xsl:variable name="identification" select="gmd:identificationInfo/gmd:MD_DataIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'MD_DataIdentification')]|
gmd:identificationInfo/srv:SV_ServiceIdentification"/>
<xsl:variable name="identification"
select="gmd:identificationInfo/gmd:MD_DataIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'MD_DataIdentification')]|
gmd:identificationInfo/srv:SV_ServiceIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'SV_ServiceIdentification')]"/>


<csw:BriefRecord>
Expand Down
30 changes: 16 additions & 14 deletions schemas/iso19139/src/main/plugin/iso19139/present/csw/gmd-brief.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@
~ Rome - Italy. email: geonetwork@osgeo.org
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gmd="http://www.isotc211.org/2005/gmd"
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:srv="http://www.isotc211.org/2005/srv"
xmlns:geonet="http://www.fao.org/geonetwork"
version="1.0">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0" exclude-result-prefixes="#all">

<xsl:param name="displayInfo"/>

<!-- =================================================================== -->

<xsl:template match="gmd:MD_Metadata|*[@gco:isoType='gmd:MD_Metadata']">
<xsl:variable name="info" select="geonet:info"/>
<xsl:copy>
<xsl:element name="{if (@gco:isoType) then @gco:isoType else name()}">
<xsl:apply-templates select="gmd:fileIdentifier"/>
<xsl:apply-templates select="gmd:hierarchyLevel"/>
<xsl:apply-templates select="gmd:identificationInfo"/>
Expand All @@ -45,24 +47,22 @@
<xsl:copy-of select="$info"/>
</xsl:if>

</xsl:copy>
</xsl:element>
</xsl:template>

<!-- =================================================================== -->

<xsl:template match="gmd:MD_DataIdentification|
*[contains(@gco:isoType, 'MD_DataIdentification')]|
srv:SV_ServiceIdentification|
*[contains(@gco:isoType, 'SV_ServiceIdentification')]
">
<xsl:copy>
<xsl:template match="gmd:identificationInfo/gmd:MD_DataIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'MD_DataIdentification')]|
gmd:identificationInfo/srv:SV_ServiceIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'SV_ServiceIdentification')]">
<xsl:element name="{if (@gco:isoType) then @gco:isoType else name()}">
<xsl:apply-templates select="gmd:citation"/>
<xsl:apply-templates select="gmd:graphicOverview"/>
<xsl:apply-templates select="gmd:extent[child::gmd:EX_Extent[child::gmd:geographicElement]]|
srv:extent[child::gmd:EX_Extent[child::gmd:geographicElement]]"/>
<xsl:apply-templates select="*:extent[child::gmd:EX_Extent[child::gmd:geographicElement]]"/>
<xsl:apply-templates select="srv:serviceType"/>
<xsl:apply-templates select="srv:serviceTypeVersion"/>
</xsl:copy>
</xsl:element>
</xsl:template>

<!-- =================================================================== -->
Expand Down Expand Up @@ -106,7 +106,9 @@
</xsl:copy>
</xsl:template>

<!-- =================================================================== -->
<!-- Avoid insertion of schema location in the CSW
response - which is invalid. -->
<xsl:template match="@xsi:schemaLocation"/>

</xsl:stylesheet>

Expand Down
30 changes: 17 additions & 13 deletions schemas/iso19139/src/main/plugin/iso19139/present/csw/gmd-full.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@
~ Rome - Italy. email: geonetwork@osgeo.org
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:geonet="http://www.fao.org/geonetwork"
version="1.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:srv="http://www.isotc211.org/2005/srv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:geonet="http://www.fao.org/geonetwork"
exclude-result-prefixes="#all"
version="2.0">

<xsl:param name="displayInfo"/>

<!-- ============================================================================= -->
<!--
<xsl:template match="gmd:MD_Metadata">
<csw:IsoRecord>
<xsl:apply-templates select="*"/>
</csw:IsoRecord>
</xsl:template>
-->
<!-- ============================================================================= -->
<!-- Convert ISO profile elements to their base type -->
<xsl:template match="*[@gco:isoType]" priority="99">
<xsl:element name="{@gco:isoType}">
<xsl:apply-templates select="@*[name() != 'gco:isoType']|*"/>
</xsl:element>
</xsl:template>

<xsl:template match="@*|node()[name(.)!='geonet:info']">
<xsl:variable name="info" select="geonet:info"/>
Expand All @@ -49,6 +52,7 @@
</xsl:copy>
</xsl:template>

<!-- ============================================================================= -->

<!-- Avoid insertion of schema location in the CSW
response - which is invalid. -->
<xsl:template match="@xsi:schemaLocation"/>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@
~ Rome - Italy. email: geonetwork@osgeo.org
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gmd="http://www.isotc211.org/2005/gmd"
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:srv="http://www.isotc211.org/2005/srv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:geonet="http://www.fao.org/geonetwork"
version="1.0">
exclude-result-prefixes="#all"
version="2.0">

<xsl:param name="displayInfo"/>

<!-- =================================================================== -->

<xsl:template match="gmd:MD_Metadata|*[@gco:isoType='gmd:MD_Metadata']">
<xsl:variable name="info" select="geonet:info"/>
<xsl:copy>
<xsl:element name="{if (@gco:isoType) then @gco:isoType else name()}">
<xsl:apply-templates select="gmd:fileIdentifier"/>
<xsl:apply-templates select="gmd:language"/>
<xsl:apply-templates select="gmd:characterSet"/>
Expand All @@ -56,7 +59,7 @@
<xsl:copy-of select="$info"/>
</xsl:if>

</xsl:copy>
</xsl:element>
</xsl:template>

<!-- =================================================================== -->
Expand Down Expand Up @@ -157,13 +160,13 @@
</xsl:copy>
</xsl:template>

<!-- =================================================================== -->
<!-- === Data === -->
<!-- =================================================================== -->

<xsl:template match="gmd:MD_DataIdentification
|*[contains(@gco:isoType, 'MD_DataIdentification')]|*[contains(@gco:isoType, 'CI_Date')]">
<xsl:copy>
<xsl:template match="gmd:identificationInfo/gmd:MD_DataIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'MD_DataIdentification')]|
gmd:identificationInfo/srv:SV_ServiceIdentification|
gmd:identificationInfo/*[contains(@gco:isoType, 'SV_ServiceIdentification')]">
<xsl:element name="{if (@gco:isoType) then @gco:isoType else name()}">
<gmd:citation>
<gmd:CI_Citation>
<xsl:apply-templates select="gmd:citation/gmd:CI_Citation/gmd:title"/>
Expand All @@ -179,35 +182,12 @@
<xsl:apply-templates select="gmd:language"/>
<xsl:apply-templates select="gmd:characterSet"/>
<xsl:apply-templates select="gmd:topicCategory"/>
<xsl:apply-templates select="gmd:extent[child::gmd:EX_Extent
[child::gmd:geographicElement]]"/>
</xsl:copy>
</xsl:template>

<!-- =================================================================== -->
<!-- === Services === -->
<!-- =================================================================== -->

<xsl:template match="srv:SV_ServiceIdentification|
*[contains(@gco:isoType, 'SV_ServiceIdentification')]|*[contains(@gco:isoType, 'CI_Date')]">
<xsl:copy>
<gmd:citation>
<gmd:CI_Citation>
<xsl:apply-templates select="gmd:citation/gmd:CI_Citation/gmd:title"/>
<xsl:apply-templates select="gmd:citation/gmd:CI_Citation/gmd:date"/>
</gmd:CI_Citation>
</gmd:citation>
<xsl:apply-templates select="gmd:abstract"/>
<xsl:apply-templates select="gmd:pointOfContact"/>
<xsl:apply-templates select="gmd:graphicOverview"/>
<xsl:apply-templates select="gmd:resourceConstraints"/>
<xsl:apply-templates select="srv:serviceType"/>
<xsl:apply-templates select="srv:serviceTypeVersion"/>
<xsl:apply-templates select="srv:extent[child::gmd:EX_Extent
[child::gmd:geographicElement]]"/>
<xsl:apply-templates select="*:extent[child::gmd:EX_Extent[child::gmd:geographicElement]]"/>
<xsl:apply-templates select="srv:couplingType"/>
<xsl:apply-templates select="srv:containsOperations"/>
</xsl:copy>
</xsl:element>
</xsl:template>

<!-- =================================================================== -->
Expand All @@ -230,8 +210,9 @@
</xsl:copy>
</xsl:template>

<!-- =================================================================== -->

<!-- Avoid insertion of schema location in the CSW
response - which is invalid. -->
<xsl:template match="@xsi:schemaLocation"/>
</xsl:stylesheet>


Expand Down
Loading

0 comments on commit 3f25d00

Please sign in to comment.