diff --git a/src/store-update/pom.xml b/src/store-update/pom.xml index 12900a2..da76408 100644 --- a/src/store-update/pom.xml +++ b/src/store-update/pom.xml @@ -24,7 +24,7 @@ org.eclipse.lyo.store store-core - 2.2.0 + ${oslc4j-core.version} junit diff --git a/src/store-update/src/main/java/org/eclipse/lyo/store/update/handlers/TrsMqttChangeLogHandler.java b/src/store-update/src/main/java/org/eclipse/lyo/store/update/handlers/TrsMqttChangeLogHandler.java index 40cf88b..589bccf 100644 --- a/src/store-update/src/main/java/org/eclipse/lyo/store/update/handlers/TrsMqttChangeLogHandler.java +++ b/src/store-update/src/main/java/org/eclipse/lyo/store/update/handlers/TrsMqttChangeLogHandler.java @@ -3,8 +3,11 @@ import java.lang.reflect.InvocationTargetException; import java.net.URI; import java.net.URISyntaxException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Collection; import java.util.List; +import java.util.TimeZone; import javax.xml.datatype.DatatypeConfigurationException; @@ -24,7 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.hp.hpl.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Model; public class TrsMqttChangeLogHandler extends TrsChangelogHandler { private final Logger log = LoggerFactory.getLogger(TrsMqttChangeLogHandler.class); @@ -73,7 +76,11 @@ private AbstractResource trsChangeResourceFrom(HistoryData historyData) { URI uri = historyData.getUri(); URI changedUri; try { - changedUri = new URI("urn:x-trs:" + historyData.getTimestamp() + ":this.order"); + TimeZone tz = TimeZone.getTimeZone("UTC"); + DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); // Quoted "Z" to indicate UTC, no timezone offset + df.setTimeZone(tz); + String nowAsISO = df.format(historyData.getTimestamp()); + changedUri = new URI("urn:x-trs:" + nowAsISO + ":" + this.order); ChangeEvent ce; if (histDataType == HistoryData.CREATED) { ce = new Creation(changedUri, uri, this.order); diff --git a/src/store-update/src/test/java/org/eclipse/lyo/store/update/TestHistoryResource.java b/src/store-update/src/test/java/org/eclipse/lyo/store/update/TestHistoryResource.java index fd4c32e..55adc55 100644 --- a/src/store-update/src/test/java/org/eclipse/lyo/store/update/TestHistoryResource.java +++ b/src/store-update/src/test/java/org/eclipse/lyo/store/update/TestHistoryResource.java @@ -1,6 +1,6 @@ package org.eclipse.lyo.store.update; -import com.hp.hpl.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Model; import java.net.URI; import java.time.Instant; import java.util.Collections;