-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
.../src/main/java/eu/clarin/cmdi/curation/api/report/collection/CollectionHistoryReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package eu.clarin.cmdi.curation.api.report.collection; | ||
|
||
import eu.clarin.cmdi.curation.api.report.LocalDateTimeAdapter; | ||
import eu.clarin.cmdi.curation.api.report.NamedReport; | ||
import jakarta.xml.bind.annotation.*; | ||
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Collection; | ||
import java.util.TreeMap; | ||
import java.util.TreeSet; | ||
|
||
@XmlRootElement | ||
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) | ||
public class CollectionHistoryReport implements NamedReport { | ||
@XmlAttribute | ||
@XmlJavaTypeAdapter(LocalDateTimeAdapter.class) | ||
public final LocalDateTime creationTime = LocalDateTime.now(); | ||
private final TreeMap<String, ProviderGroup> providerGroups = new TreeMap<>((pg1, pg2) -> pg1.compareTo(pg2)); | ||
@XmlElement(name = "collection") | ||
public Collection<ProviderGroup> getCollections(){ | ||
|
||
return this.providerGroups.values(); | ||
} | ||
|
||
public void addReport(String providerGroup, String isoDate, String fileName){ | ||
|
||
this.providerGroups.computeIfAbsent(providerGroup, k -> new ProviderGroup(k)).addReport(isoDate, fileName); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return this.getClass().getSimpleName(); | ||
} | ||
|
||
@Override | ||
public LocalDateTime getCreationTime() { | ||
|
||
return this.creationTime; | ||
} | ||
|
||
@Override | ||
public void setPreviousCreationTime(LocalDateTime previousCreationTime) { | ||
|
||
} | ||
|
||
@Override | ||
public LocalDateTime getPreviousCreationTime() { | ||
return null; | ||
} | ||
|
||
@XmlRootElement | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@RequiredArgsConstructor | ||
@NoArgsConstructor(force = true) | ||
private static class ProviderGroup{ | ||
@XmlAttribute | ||
public final String name; | ||
@XmlElement(name = "report") | ||
public TreeSet<Report> reports = new TreeSet<>((report1, report2) -> report2.isoDate.compareTo(report1.isoDate)); | ||
|
||
public void addReport(String isoDate, String fileName){ | ||
this.reports.add(new Report(isoDate, fileName)); | ||
} | ||
} | ||
@XmlRootElement | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@RequiredArgsConstructor | ||
@NoArgsConstructor(force = true) | ||
public static class Report { | ||
@XmlAttribute | ||
public final String isoDate; | ||
@XmlAttribute | ||
public final String fileName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
curation-app/src/main/resources/xslt/CollectionHistoryReport2HTML.xsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<xsl:template match="/collectionHistoryReport"> | ||
<xsl:for-each select="collection"> | ||
<h1><xsl:value-of select="@name" /> </h1> | ||
|
||
<xsl:for-each select="report"> | ||
<a> | ||
<xsl:attribute name="href"> | ||
<xsl:text>/collection/</xsl:text><xsl:value-of select="@fileName" /> | ||
</xsl:attribute> | ||
<xsl:value-of select="@isoDate" /> | ||
</a> | ||
<xsl:text> </xsl:text> | ||
</xsl:for-each> | ||
</xsl:for-each> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters