diff --git a/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/LinearizationRevision.java b/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/LinearizationRevision.java index a830192..b45d4a4 100644 --- a/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/LinearizationRevision.java +++ b/src/main/java/edu/stanford/protege/webprotege/linearizationservice/model/LinearizationRevision.java @@ -18,18 +18,8 @@ public record LinearizationRevision(@Indexed(name = "timestamp", direction = Ind public static final String USER_ID = "userId"; public static final String LINEARIZATION_EVENTS = "linearizationEvents"; - private static long lastTimestamp = 0; - private static int counter = 0; - public static LinearizationRevision create(UserId userId, Set linearizationEvents) { - long currentTimestamp = Instant.now().toEpochMilli(); - if (currentTimestamp == lastTimestamp) { - counter++; - } else { - lastTimestamp = currentTimestamp; - counter = 0; - } - return new LinearizationRevision(currentTimestamp + counter, userId, linearizationEvents); + return new LinearizationRevision(new Date().getTime(), userId, linearizationEvents); } @Override diff --git a/src/main/java/edu/stanford/protege/webprotege/linearizationservice/services/LinearizationHistoryServiceImpl.java b/src/main/java/edu/stanford/protege/webprotege/linearizationservice/services/LinearizationHistoryServiceImpl.java index 7d55f7b..a45bc66 100644 --- a/src/main/java/edu/stanford/protege/webprotege/linearizationservice/services/LinearizationHistoryServiceImpl.java +++ b/src/main/java/edu/stanford/protege/webprotege/linearizationservice/services/LinearizationHistoryServiceImpl.java @@ -67,10 +67,7 @@ public void saveMultipleEntityLinearizationHistories(Set getExistingHistoryOrderedByRevision(IRI entityIri, ProjectId projectId) { return linearizationHistoryRepository.findHistoryByEntityIriAndProjectId(entityIri.toString(), projectId) .map(history -> { - Set sortedRevisions = history.getLinearizationRevisions() - .stream() - .sorted(Comparator.comparingLong(LinearizationRevision::timestamp)) - .collect(Collectors.toCollection(TreeSet::new)); + Set sortedRevisions = new TreeSet<>(history.getLinearizationRevisions()); // Return a new EntityLinearizationHistory object with the sorted revisions return new EntityLinearizationHistory(history.getWhoficEntityIri(), history.getProjectId(), sortedRevisions); });