Trim time on Dataset's modified time in order to match with the Database
This commit is contained in:
parent
ba5c295187
commit
df8af6e6cd
|
@ -83,6 +83,8 @@ import javax.xml.xpath.XPathFactory;
|
|||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.Files;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -580,7 +582,10 @@ public class DatasetManager {
|
|||
if (datasetWizardModel.getId() != null) {
|
||||
tempDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(datasetWizardModel.getId());
|
||||
if (tempDataset != null) {
|
||||
if (datasetWizardModel.getModified().getTime() != tempDataset.getModified().getTime()) {
|
||||
|
||||
Instant dbTime = Instant.ofEpochMilli(tempDataset.getModified().getTime()).truncatedTo(ChronoUnit.SECONDS);
|
||||
Instant modelTime = Instant.ofEpochMilli(datasetWizardModel.getModified().getTime()).truncatedTo(ChronoUnit.SECONDS);
|
||||
if (modelTime.toEpochMilli() != dbTime.toEpochMilli()) {
|
||||
throw new Exception("Dataset has been modified already by another user.");
|
||||
}
|
||||
sendNotification = true;
|
||||
|
|
Loading…
Reference in New Issue