Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main-WHO' into get-all-classes-i…
Browse files Browse the repository at this point in the history
…n-ontology
  • Loading branch information
alexsilaghi committed Dec 11, 2024
2 parents b6a229e + 2ce5a63 commit 90db464
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-backend-service</artifactId>
<version>2.0.10-WHO</version>
<version>2.0.11-WHO</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public <R> ChangeApplicationResult<R> applyChanges(@Nonnull final UserId userId,

revision.ifPresent(value -> projectRevisionRepository.save(new ProjectRevision(projectId, changeRequestId, userId, value.getRevisionNumber())));

newRevisionsEmitter.emitNewRevisionsEvent(revision);
newRevisionsEmitter.emitNewRevisionsEvent(revision, changeRequestId);

} finally {
changeProcesssingLock.unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
public record NewRevisionsEvent(
EventId eventId,
ProjectId projectId,
Set<ProjectChangeForEntity> changes
Set<ProjectChangeForEntity> changes,
ChangeRequestId changeRequestId
) implements ProjectEvent {
public final static String CHANNEL = "webprotege.events.projects.uiHistory.NewRevisionsEvent";

public static NewRevisionsEvent create(EventId eventId,
ProjectId projectId,
Set<ProjectChangeForEntity> changes) {
return new NewRevisionsEvent(eventId, projectId, changes);
Set<ProjectChangeForEntity> changes,
ChangeRequestId changeRequestId) {
return new NewRevisionsEvent(eventId, projectId, changes, changeRequestId);
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package edu.stanford.protege.webprotege.revision.uiHistoryConcern;

import edu.stanford.protege.webprotege.common.ChangeRequestId;
import edu.stanford.protege.webprotege.revision.Revision;

import java.util.Optional;

public interface NewRevisionsEventEmitterService {
void emitNewRevisionsEvent(Optional<Revision> revision);
void emitNewRevisionsEvent(Optional<Revision> revision, ChangeRequestId changeRequestId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public NewRevisionsEventEmitterServiceImpl(ProjectChangesManager changesManager,


@Override
public void emitNewRevisionsEvent(Optional<Revision> revision) {
public void emitNewRevisionsEvent(Optional<Revision> revision, ChangeRequestId changeRequestId) {
revision.ifPresent(rev -> {
Set<ProjectChangeForEntity> changes = changesManager.getProjectChangesForEntitiesFromRevision(rev);
//Based on axioms in the revision we can determine if the entity was added/deleted or updated
//e.g. for adding a new entity you have Declaration axiom
//
NewRevisionsEvent revisionsEvent = NewRevisionsEvent.create(EventId.generate(), projectId, changes);
NewRevisionsEvent revisionsEvent = NewRevisionsEvent.create(EventId.generate(), projectId, changes, changeRequestId);
eventDispatcher.dispatchEvent(revisionsEvent);
});
}
Expand Down

0 comments on commit 90db464

Please sign in to comment.