Skip to content

Commit

Permalink
Update-fixed-info / Use db dates (geonetwork#5275)
Browse files Browse the repository at this point in the history
* Update-fixed-info / Set the update date to the same date as in the database. In ISO19115-3, also set record creation date from the database date.

* Update-fixed-info / Use db dates / Remove existing check

* Update-fixed-info / Use db dates / Remove existing check
  • Loading branch information
fxprunayre authored Apr 14, 2021
1 parent 7669c13 commit aef2a2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,14 @@ public Element updateFixedInfo(String schema, Optional<Integer> metadataId, Stri
env.addContent(schemaLoc);

if (updateDatestamp == UpdateDatestamp.YES) {
env.addContent(new Element("changeDate").setText(new ISODate().toString()));
String changeDate = new ISODate().toString();
String createDate = "";
if (metadata != null) {
changeDate = metadata.getDataInfo().getChangeDate().getDateAndTime();
createDate = metadata.getDataInfo().getCreateDate().getDateAndTime();
}
env.addContent(new Element("changeDate").setText(changeDate));
env.addContent(new Element("createDate").setText(createDate));
}
if (parentUuid != null) {
env.addContent(new Element("parentUuid").setText(parentUuid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime><xsl:value-of select="/root/env/changeDate"/></gco:DateTime>
<gco:DateTime><xsl:value-of select="/root/env/createDate"/></gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode" codeListValue="creation"/>
Expand Down

0 comments on commit aef2a2f

Please sign in to comment.