Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass created, modified, issued date from thesaurus to the schemas #6972

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion core/src/main/java/org/fao/geonet/kernel/Thesaurus.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ public class Thesaurus {

private String date;

private String createdDate;

private String issuedDate;

private String modifiedDate;

private String defaultNamespace;

private String downloadUrl;
Expand Down Expand Up @@ -258,6 +264,18 @@ public String getDate() {
return date;
}

public String getCreatedDate() {
return createdDate;
}

public String getIssuedDate() {
return issuedDate;
}

public String getModifiedDate() {
return modifiedDate;
}

@Nonnull
public FileTime getLastModifiedTime() {
FileTime lastModified;
Expand Down Expand Up @@ -965,8 +983,17 @@ private void retrieveThesaurusInformation(Path thesaurusFile, String defaultTitl
this.defaultNamespace = DEFAULT_THESAURUS_NAMESPACE;
}

Element dateEl = Xml.selectElement(thesaurusEl, "skos:ConceptScheme/dcterms:issued|skos:Collection/dc:date", theNSs);
Element issuedDateEl = Xml.selectElement(thesaurusEl, "skos:ConceptScheme/dcterms:issued|skos:Collection/dc:date", theNSs);
ianwallen marked this conversation as resolved.
Show resolved Hide resolved
this.issuedDate = issuedDateEl==null? "": issuedDateEl.getText();

Element modifiedDateEl = Xml.selectElement(thesaurusEl, "skos:ConceptScheme/dcterms:modified", theNSs);
this.modifiedDate = modifiedDateEl==null? "": modifiedDateEl.getText();

Element createdDateEl = Xml.selectElement(thesaurusEl, "skos:ConceptScheme/dcterms:created", theNSs);
this.createdDate = createdDateEl==null? "": createdDateEl.getText();

// Default date
Element dateEl = Xml.selectElement(thesaurusEl, "skos:ConceptScheme/dcterms:issued|skos:Collection/dc:date", theNSs);
Date thesaususDate = parseThesaurusDate(dateEl);
ianwallen marked this conversation as resolved.
Show resolved Hide resolved

if (thesaususDate == null) {
Expand Down
15 changes: 15 additions & 0 deletions core/src/main/java/org/fao/geonet/kernel/ThesaurusManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,18 @@ public Element buildResultfromThTable(ServiceContext context) throws SQLExceptio
String date = currentTh.getDate();
elDate.addContent(date);

Element elCreatedDate = new Element("createdDate");
String createdDate = currentTh.getCreatedDate();
elCreatedDate.addContent(createdDate);

Element elIssuedDate = new Element("issuedDate");
String issuedDate = currentTh.getIssuedDate();
elIssuedDate.addContent(issuedDate);

Element elModifiedDate = new Element("modifiedDate");
String modifiedDate = currentTh.getModifiedDate();
elModifiedDate.addContent(modifiedDate);

Element elUrl = new Element("url");
String url = currentTh.getDownloadUrl();
elUrl.addContent(url);
Expand All @@ -568,6 +580,9 @@ public Element buildResultfromThTable(ServiceContext context) throws SQLExceptio
elLoop.addContent(elDublinCoreMultilingual);
elLoop.addContent(elMultilingualDescriptions);
elLoop.addContent(elDate);
elLoop.addContent(elCreatedDate);
elLoop.addContent(elIssuedDate);
elLoop.addContent(elModifiedDate);
elLoop.addContent(elUrl);
elLoop.addContent(elDefaultURI);
elLoop.addContent(elType);
Expand Down