Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed notification to ui if a new revision has been created. this is the responsability of event-history-service #22

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package edu.stanford.protege.webprotege.linearizationservice.handlers;

import edu.stanford.protege.webprotege.common.EventId;
import edu.stanford.protege.webprotege.ipc.*;
import edu.stanford.protege.webprotege.linearizationservice.mappers.WhoficEntityLinearizationSpecificationMapper;
import edu.stanford.protege.webprotege.linearizationservice.services.*;
import edu.stanford.protege.webprotege.linearizationservice.uiHistoryConcern.changes.ProjectLinearizationChangedEvent;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;

import java.util.List;

import static edu.stanford.protege.webprotege.linearizationservice.handlers.CreateLinearizationFromParentRequest.CHANNEL;

@WebProtegeHandler
Expand All @@ -19,16 +15,13 @@ public class CreateLinearizationFromParentCommandHandler implements CommandHandl
private final LinearizationEventsProcessorService linearizationEventsProcessor;
private final WhoficEntityLinearizationSpecificationMapper whoficSpecMapper;

private final LinearizationChangeEmitterService linChangeEmitter;

public CreateLinearizationFromParentCommandHandler(LinearizationHistoryService linearizationHistoryService,
LinearizationEventsProcessorService linearizationEventsProcessor,
WhoficEntityLinearizationSpecificationMapper whoficSpecMapper,
LinearizationChangeEmitterService linChangeEmitter) {
WhoficEntityLinearizationSpecificationMapper whoficSpecMapper) {
this.linearizationHistoryService = linearizationHistoryService;
this.linearizationEventsProcessor = linearizationEventsProcessor;
this.whoficSpecMapper = whoficSpecMapper;
this.linChangeEmitter = linChangeEmitter;
}

@NotNull
Expand All @@ -53,7 +46,6 @@ public Mono<CreateLinearizationFromParentResponse> handleRequest(CreateLineariza

linearizationHistoryService.addRevision(newEntityWhoficSpec, request.projectId(), executionContext.userId());

linChangeEmitter.emitLinearizationChangeEvent(request.projectId(), List.of(ProjectLinearizationChangedEvent.create(EventId.generate(), request.projectId())));

return Mono.just(CreateLinearizationFromParentResponse.create());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package edu.stanford.protege.webprotege.linearizationservice.handlers;

import edu.stanford.protege.webprotege.common.EventId;
import edu.stanford.protege.webprotege.ipc.*;
import edu.stanford.protege.webprotege.linearizationservice.model.WhoficEntityLinearizationSpecification;
import edu.stanford.protege.webprotege.linearizationservice.services.*;
import edu.stanford.protege.webprotege.linearizationservice.uiHistoryConcern.changes.ProjectLinearizationChangedEvent;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;

import java.util.*;
import java.util.Optional;

import static edu.stanford.protege.webprotege.linearizationservice.handlers.MergeWithParentEntitiesRequest.CHANNEL;

Expand All @@ -19,15 +17,13 @@ public class MergeWithParentEntitiesCommandHandler implements CommandHandler<Mer
private final LinearizationHistoryProcessorService historyProcessorService;
private final ReadWriteLockService readWriteLock;

private final LinearizationChangeEmitterService linChangeEmitter;

public MergeWithParentEntitiesCommandHandler(LinearizationHistoryService linearizationHistoryService,
LinearizationHistoryProcessorService historyProcessorService,
ReadWriteLockService readWriteLock, LinearizationChangeEmitterService linChangeEmitter) {
ReadWriteLockService readWriteLock) {
this.linearizationHistoryService = linearizationHistoryService;
this.historyProcessorService = historyProcessorService;
this.readWriteLock = readWriteLock;
this.linChangeEmitter = linChangeEmitter;
}


Expand All @@ -48,10 +44,7 @@ public Mono<MergeWithParentEntitiesResponse> handleRequest(MergeWithParentEntiti
readWriteLock.executeWriteLock(() -> {
Optional<WhoficEntityLinearizationSpecification> newWhoficSpec = historyProcessorService.mergeLinearizationViewsFromParentsAndGetDefaultSpec(request.currentEntityIri(), request.parentEntityIris(), request.projectId());

newWhoficSpec.ifPresent(newSpec -> {
linearizationHistoryService.addRevision(newSpec, request.projectId(), executionContext.userId());
linChangeEmitter.emitLinearizationChangeEvent(request.projectId(), List.of(ProjectLinearizationChangedEvent.create(EventId.generate(), request.projectId())));
});
newWhoficSpec.ifPresent(newSpec -> linearizationHistoryService.addRevision(newSpec, request.projectId(), executionContext.userId()));
});
return Mono.just(MergeWithParentEntitiesResponse.create());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package edu.stanford.protege.webprotege.linearizationservice.handlers;

import edu.stanford.protege.webprotege.common.EventId;
import edu.stanford.protege.webprotege.ipc.*;
import edu.stanford.protege.webprotege.linearizationservice.services.*;
import edu.stanford.protege.webprotege.linearizationservice.uiHistoryConcern.changes.ProjectLinearizationChangedEvent;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.stream.Collectors;

import static edu.stanford.protege.webprotege.linearizationservice.handlers.RevertLinearitationToRevisionRequest.CHANNEL;
Expand All @@ -18,14 +15,11 @@ public class RevertLinearitationToRevisionCommandHandler implements CommandHandl
private final LinearizationHistoryService historyService;
private final LinearizationEventsProcessorService eventsProcessorService;

private final LinearizationChangeEmitterService linChangeEmitter;

public RevertLinearitationToRevisionCommandHandler(LinearizationHistoryService historyService,
LinearizationEventsProcessorService eventsProcessorService,
LinearizationChangeEmitterService linChangeEmitter) {
LinearizationEventsProcessorService eventsProcessorService) {
this.historyService = historyService;
this.eventsProcessorService = eventsProcessorService;
this.linChangeEmitter = linChangeEmitter;
}

@NotNull
Expand Down Expand Up @@ -53,7 +47,6 @@ public Mono<RevertLinearitationToRevisionResponse> handleRequest(RevertLinearita

historyService.addRevision(newRevisionUntilTimestamp, request.projectId(), executionContext.userId());

linChangeEmitter.emitLinearizationChangeEvent(request.projectId(), List.of(ProjectLinearizationChangedEvent.create(EventId.generate(), request.projectId())));
});

return Mono.just(RevertLinearitationToRevisionResponse.create());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
package edu.stanford.protege.webprotege.linearizationservice.handlers;

import edu.stanford.protege.webprotege.common.EventId;
import edu.stanford.protege.webprotege.ipc.*;
import edu.stanford.protege.webprotege.linearizationservice.services.*;
import edu.stanford.protege.webprotege.linearizationservice.uiHistoryConcern.changes.ProjectLinearizationChangedEvent;
import edu.stanford.protege.webprotege.linearizationservice.services.LinearizationHistoryService;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;

import java.util.List;

@WebProtegeHandler
public class SaveEntityLinearizationCommandHandler implements CommandHandler<SaveEntityLinearizationRequest, SaveEntityLinearizationResponse> {


private final LinearizationHistoryService linearizationHistoryService;

private final LinearizationChangeEmitterService linChangeEmitter;


public SaveEntityLinearizationCommandHandler(LinearizationHistoryService linearizationHistoryService,
LinearizationChangeEmitterService linChangeEmitter) {
public SaveEntityLinearizationCommandHandler(LinearizationHistoryService linearizationHistoryService) {
this.linearizationHistoryService = linearizationHistoryService;
this.linChangeEmitter = linChangeEmitter;
}


Expand All @@ -41,7 +33,6 @@ public Mono<SaveEntityLinearizationResponse> handleRequest(SaveEntityLinearizati

linearizationHistoryService.addRevision(request.entityLinearization(), request.projectId(), executionContext.userId());

linChangeEmitter.emitLinearizationChangeEvent(request.projectId(), List.of(ProjectLinearizationChangedEvent.create(EventId.generate(), request.projectId())));

return Mono.just(SaveEntityLinearizationResponse.create());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package edu.stanford.protege.webprotege.linearizationservice.handlers;

import edu.stanford.protege.webprotege.common.EventId;
import edu.stanford.protege.webprotege.ipc.*;
import edu.stanford.protege.webprotege.linearizationservice.StreamUtils;
import edu.stanford.protege.webprotege.linearizationservice.model.WhoficEntityLinearizationSpecification;
import edu.stanford.protege.webprotege.linearizationservice.repositories.document.LinearizationDocumentRepository;
import edu.stanford.protege.webprotege.linearizationservice.services.*;
import edu.stanford.protege.webprotege.linearizationservice.uiHistoryConcern.changes.ProjectLinearizationChangedEvent;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import reactor.core.publisher.Mono;
Expand All @@ -31,17 +29,13 @@ public class UploadLinearizationCommandHandler implements CommandHandler<UploadL

private final ReadWriteLockService readWriteLock;

private final LinearizationChangeEmitterService linChangeEmitter;


public UploadLinearizationCommandHandler(LinearizationDocumentRepository linearizationRepository,
LinearizationHistoryService linearizationHistoryService,
ReadWriteLockService readWriteLock,
LinearizationChangeEmitterService linChangeEmitter) {
ReadWriteLockService readWriteLock) {
this.linearizationRepository = linearizationRepository;
this.linearizationHistoryService = linearizationHistoryService;
this.readWriteLock = readWriteLock;
this.linChangeEmitter = linChangeEmitter;
}

@NotNull
Expand All @@ -66,7 +60,6 @@ public Mono<UploadLinearizationResponse> handleRequest(UploadLinearizationReques
stream.collect(StreamUtils.batchCollector(batchSize, batchProcessor));
});

linChangeEmitter.emitLinearizationChangeEvent(request.projectId(), List.of(ProjectLinearizationChangedEvent.create(EventId.generate(), request.projectId())));

return Mono.just(UploadLinearizationResponse.create());
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public class RevertLinearitationToRevisionCommandHandlerTest {
@Mock
private LinearizationEventsProcessorService eventsProcessorService;

@Mock
private LinearizationChangeEmitterService linChangeEmitter;

@InjectMocks
private RevertLinearitationToRevisionCommandHandler commandHandler;

Expand Down
Loading