-
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.
Merge pull request #15 from protegeproject/6-change-history-for-a-sin…
…gle-entity added handler for GetEntityHistorySummaryRequest
- Loading branch information
Showing
9 changed files
with
216 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
.../java/edu/stanford/protege/webprotegeeventshistory/uiHistoryConcern/dto/EntityChange.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,16 @@ | ||
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.dto; | ||
|
||
import edu.stanford.protege.webprotege.common.UserId; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public record EntityChange(String changeSummary, | ||
UserId userId, | ||
LocalDateTime dateTime) { | ||
|
||
public static EntityChange create(String changeSummary, | ||
UserId userId, | ||
LocalDateTime dateTime){ | ||
return new EntityChange(changeSummary,userId,dateTime); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...u/stanford/protege/webprotegeeventshistory/uiHistoryConcern/dto/EntityHistorySummary.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,9 @@ | ||
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.dto; | ||
|
||
import java.util.List; | ||
|
||
public record EntityHistorySummary(List<EntityChange> changes) { | ||
public static EntityHistorySummary create(List<EntityChange> changes) { | ||
return new EntityHistorySummary(changes); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...protegeeventshistory/uiHistoryConcern/handlers/GetEntityHistorySummaryCommandHandler.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,38 @@ | ||
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.handlers; | ||
|
||
import edu.stanford.protege.webprotege.common.ProjectId; | ||
import edu.stanford.protege.webprotege.ipc.*; | ||
import edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.dto.EntityHistorySummary; | ||
import edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.services.NewRevisionsEventService; | ||
import org.springframework.stereotype.Component; | ||
import reactor.core.publisher.Mono; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
@Component | ||
public class GetEntityHistorySummaryCommandHandler implements CommandHandler<GetEntityHistorySummaryRequest, GetEntityHistorySummaryResponse> { | ||
|
||
private final NewRevisionsEventService service; | ||
|
||
public GetEntityHistorySummaryCommandHandler(NewRevisionsEventService service) { | ||
this.service = service; | ||
} | ||
|
||
|
||
@Nonnull | ||
@Override | ||
public String getChannelName() { | ||
return GetEntityHistorySummaryRequest.CHANNEL; | ||
} | ||
|
||
@Override | ||
public Class<GetEntityHistorySummaryRequest> getRequestClass() { | ||
return GetEntityHistorySummaryRequest.class; | ||
} | ||
|
||
@Override | ||
public Mono<GetEntityHistorySummaryResponse> handleRequest(GetEntityHistorySummaryRequest request, ExecutionContext executionContext) { | ||
EntityHistorySummary entityHistorySummary = service.getEntityHistorySummary(ProjectId.valueOf(request.projectId()), request.entityIri()); | ||
return Mono.just(GetEntityHistorySummaryResponse.create(entityHistorySummary)); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ege/webprotegeeventshistory/uiHistoryConcern/handlers/GetEntityHistorySummaryRequest.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,23 @@ | ||
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.handlers; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
import edu.stanford.protege.webprotege.common.Request; | ||
|
||
@JsonTypeName(GetEntityHistorySummaryRequest.CHANNEL) | ||
public record GetEntityHistorySummaryRequest( | ||
@JsonProperty("projectId") String projectId, | ||
@JsonProperty("entityIri") String entityIri | ||
) implements Request<GetEntityHistorySummaryResponse> { | ||
|
||
public static final String CHANNEL = "webprotege.history.GetEntityHistorySummary"; | ||
|
||
public static GetEntityHistorySummaryRequest create(String projectId, | ||
String entityIri) { | ||
return new GetEntityHistorySummaryRequest(projectId, entityIri); | ||
} | ||
|
||
@Override | ||
public String getChannel() { | ||
return CHANNEL; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ge/webprotegeeventshistory/uiHistoryConcern/handlers/GetEntityHistorySummaryResponse.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,16 @@ | ||
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.handlers; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
import edu.stanford.protege.webprotege.common.Response; | ||
import edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.dto.EntityHistorySummary; | ||
|
||
import static edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.handlers.GetEntityHistorySummaryRequest.CHANNEL; | ||
|
||
@JsonTypeName(CHANNEL) | ||
public record GetEntityHistorySummaryResponse( | ||
@JsonProperty("entityHistorySummary") EntityHistorySummary entityHistorySummary | ||
) implements Response { | ||
public static GetEntityHistorySummaryResponse create(EntityHistorySummary entityHistorySummary) { | ||
return new GetEntityHistorySummaryResponse(entityHistorySummary); | ||
} | ||
} |
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
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