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

Added ChangeType to ProjectChangeForEntity #50

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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@
<spring.profiles.active>test</spring.profiles.active>
</systemPropertyVariables>
<includes>
<include>**/*Test.java</include> <!-- Matches unit test naming convention -->
<include>**/*IT.java</include> <!-- Matches unit test naming convention -->
<include>**/*Test.java</include>
<include>**/*IT.java</include>
</includes>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package edu.stanford.protege.webprotege.postcoordinationservice.uiHistoryConcern.changes;

public enum ChangeType {
CREATE_ENTITY,
DELETE_ENTITY,
UPDATE_ENTITY
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
package edu.stanford.protege.webprotege.postcoordinationservice.uiHistoryConcern.changes;

import edu.stanford.protege.webprotege.change.ProjectChange;
import org.jetbrains.annotations.NotNull;

public record ProjectChangeForEntity(String whoficEntityIri,
ProjectChange projectChange) {
ChangeType changeType,
ProjectChange projectChange) implements Comparable<ProjectChangeForEntity> {

public static ProjectChangeForEntity create(String whoficEntityIri,
ChangeType changeType,
ProjectChange projectChange) {
return new ProjectChangeForEntity(whoficEntityIri, projectChange);
return new ProjectChangeForEntity(whoficEntityIri, changeType, projectChange);
}

//All linearization/postcoordination changes are updates made on the whoficEntityIri.
// From this microservice we don't create or delete entities. that is the responsibility of the backend-service.
public static ProjectChangeForEntity create(String whoficEntityIri,
ProjectChange projectChange) {
return new ProjectChangeForEntity(whoficEntityIri, ChangeType.UPDATE_ENTITY, projectChange);
}

@Override
public int compareTo(@NotNull ProjectChangeForEntity other) {
int timestampComparison = Long.compare(this.projectChange.getTimestamp(), other.projectChange.getTimestamp());
if (timestampComparison != 0) {
return timestampComparison;
}
return this.whoficEntityIri.compareTo(other.whoficEntityIri);
}
}
Loading