diff --git a/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesRequest.java b/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesRequest.java index 445737c..aac0f07 100644 --- a/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesRequest.java +++ b/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesRequest.java @@ -3,12 +3,10 @@ import com.fasterxml.jackson.annotation.*; import edu.stanford.protege.webprotege.common.*; -import java.sql.Timestamp; - @JsonTypeName(GetChangedEntitiesRequest.CHANNEL) public record GetChangedEntitiesRequest( @JsonProperty("projectId") ProjectId projectId, - @JsonProperty("timestamp") Timestamp timestamp + @JsonProperty("timestamp") long timestamp ) implements Request { public static final String CHANNEL = "webprotege.history.GetChangedEntities"; @@ -19,7 +17,7 @@ public String getChannel() { } public static GetChangedEntitiesRequest create(ProjectId projectId, - Timestamp timestamp) { + long timestamp) { return new GetChangedEntitiesRequest(projectId, timestamp); } } diff --git a/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventService.java b/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventService.java index 0a52714..77e48be 100644 --- a/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventService.java +++ b/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventService.java @@ -6,7 +6,6 @@ import edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.events.NewRevisionsEvent; import org.semanticweb.owlapi.model.OWLEntity; -import java.sql.Timestamp; import java.util.Optional; public interface NewRevisionsEventService { @@ -15,7 +14,7 @@ public interface NewRevisionsEventService { Page fetchPaginatedProjectChanges(ProjectId projectId, Optional subject, int pageNumber, int pageSize); - ChangedEntities getChangedEntitiesAfterTimestamp(ProjectId projectId, Timestamp timestamp); + ChangedEntities getChangedEntitiesAfterTimestamp(ProjectId projectId, long timestamp); EntityHistorySummary getEntityHistorySummary(ProjectId projectId, String entityIri); } diff --git a/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceImpl.java b/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceImpl.java index d4ac8ab..79ce138 100644 --- a/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceImpl.java +++ b/src/main/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceImpl.java @@ -13,7 +13,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.sql.Timestamp; import java.time.*; import java.util.*; import java.util.stream.Collectors; @@ -81,8 +80,8 @@ public Page fetchPaginatedProjectChanges(ProjectId projectId, Opt } @Override - public ChangedEntities getChangedEntitiesAfterTimestamp(ProjectId projectId, Timestamp timestamp) { - List revisionsEvents = repository.findByProjectIdAndTimestampAfter(projectId.id(), timestamp.getTime()); + public ChangedEntities getChangedEntitiesAfterTimestamp(ProjectId projectId, long timestamp) { + List revisionsEvents = repository.findByProjectIdAndTimestampAfter(projectId.id(), timestamp); List createdEntities = groupByChangeType(revisionsEvents, ChangeType.CREATE_ENTITY); diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index a898914..5cae292 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,7 +1,10 @@ server: port: 7761 -logging.level.root: DEBUG +logging: + level: + org.springframework.data.mongodb.core.MongoTemplate: DEBUG + org.mongodb.driver: DEBUG spring: application: diff --git a/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesCommandHandlerIT.java b/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesCommandHandlerIT.java index a3c9425..3b67c40 100644 --- a/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesCommandHandlerIT.java +++ b/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/handlers/GetChangedEntitiesCommandHandlerIT.java @@ -48,7 +48,7 @@ public void GIVEN_eventsAfterTimestamp_WHEN_handleRequestCalled_THEN_returnChang insertMockRevisionsEvent(projectId, "entity2", timestamp.getTime() + 5000, ChangeType.UPDATE_ENTITY); insertMockRevisionsEvent(projectId, "entity3", timestamp.getTime() + 6000, ChangeType.DELETE_ENTITY); - GetChangedEntitiesRequest request = GetChangedEntitiesRequest.create(projectId, timestamp); + GetChangedEntitiesRequest request = GetChangedEntitiesRequest.create(projectId, timestamp.getTime()); Mono responseMono = commandHandler.handleRequest(request, null); GetChangedEntitiesResponse response = responseMono.block(); diff --git a/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceTest.java b/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceTest.java index 5608f59..71a55b2 100644 --- a/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceTest.java +++ b/src/test/java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/services/NewRevisionsEventServiceTest.java @@ -134,7 +134,7 @@ public void GIVEN_noResults_WHEN_fetchPaginatedProjectChangesCalled_THEN_returnE public void GIVEN_noEntitiesChangedAfterTimestamp_WHEN_getChangedEntitiesAfterTimestampCalled_THEN_emptyChangedEntitiesReturned() { when(repository.findByProjectIdAndTimestampAfter(projectId.id(), timestamp.getTime())).thenReturn(List.of()); - ChangedEntities result = service.getChangedEntitiesAfterTimestamp(projectId, timestamp); + ChangedEntities result = service.getChangedEntitiesAfterTimestamp(projectId, timestamp.getTime()); assertEquals(0, result.createdEntities().size()); assertEquals(0, result.updatedEntities().size()); @@ -151,7 +151,7 @@ public void GIVEN_entitiesChangedAfterTimestamp_WHEN_getChangedEntitiesAfterTime when(repository.findByProjectIdAndTimestampAfter(projectId.id(), timestamp.getTime())).thenReturn(List.of(createdEntity, updatedEntity, deletedEntity)); - ChangedEntities result = service.getChangedEntitiesAfterTimestamp(projectId, timestamp); + ChangedEntities result = service.getChangedEntitiesAfterTimestamp(projectId, timestamp.getTime()); assertEquals(1, result.createdEntities().size()); assertEquals("entityIRI1", result.createdEntities().get(0)); @@ -173,7 +173,7 @@ public void GIVEN_multipleEntitiesChangedAfterTimestamp_WHEN_getChangedEntitiesA when(repository.findByProjectIdAndTimestampAfter(projectId.id(), timestamp.getTime())).thenReturn(List.of(createdEntity1, createdEntity2, updatedEntity)); - ChangedEntities result = service.getChangedEntitiesAfterTimestamp(projectId, timestamp); + ChangedEntities result = service.getChangedEntitiesAfterTimestamp(projectId, timestamp.getTime()); assertEquals(1, result.createdEntities().size()); assertEquals("entityIRI1", result.createdEntities().get(0));