-
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.
- Loading branch information
1 parent
0d3ad60
commit 68ce2f1
Showing
47 changed files
with
1,743 additions
and
151 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
...bprotege/postcoordinationservice/config/PostCoordinationCustomScalesReadingConverter.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.webprotege.postcoordinationservice.config; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.events.PostCoordinationCustomScalesValueEvent; | ||
import org.bson.Document; | ||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.data.convert.ReadingConverter; | ||
|
||
@ReadingConverter | ||
public class PostCoordinationCustomScalesReadingConverter implements Converter<Document, PostCoordinationCustomScalesValueEvent> { | ||
|
||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public PostCoordinationCustomScalesReadingConverter(ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
@Override | ||
public PostCoordinationCustomScalesValueEvent convert(Document source) { | ||
return objectMapper.convertValue(source, PostCoordinationCustomScalesValueEvent.class); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...bprotege/postcoordinationservice/config/PostCoordinationCustomScalesWritingConverter.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,24 @@ | ||
package edu.stanford.protege.webprotege.postcoordinationservice.config; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.events.PostCoordinationCustomScalesValueEvent; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.events.PostCoordinationSpecificationEvent; | ||
import org.bson.Document; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.data.convert.WritingConverter; | ||
|
||
@WritingConverter | ||
public class PostCoordinationCustomScalesWritingConverter implements Converter<PostCoordinationCustomScalesValueEvent, Document> { | ||
private final ObjectMapper objectMapper; | ||
|
||
public PostCoordinationCustomScalesWritingConverter(ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
|
||
@Override | ||
public Document convert(@NotNull PostCoordinationCustomScalesValueEvent source) { | ||
return objectMapper.convertValue(source, Document.class); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
...ord/protege/webprotege/postcoordinationservice/dto/GetEntityCustomScaleValueResponse.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.webprotege.postcoordinationservice.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import edu.stanford.protege.webprotege.common.Response; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.model.WhoficCustomScalesValues; | ||
|
||
import static edu.stanford.protege.webprotege.postcoordinationservice.dto.GetEntityCustomScaleValuesRequest.CHANNEL; | ||
|
||
|
||
@JsonTypeName(CHANNEL) | ||
public record GetEntityCustomScaleValueResponse (@JsonProperty("entityIri") | ||
String entityIri, | ||
@JsonProperty("postCoordinationScaleValues") | ||
WhoficCustomScalesValues postCoordinationScaleValues) implements Response { | ||
} |
21 changes: 21 additions & 0 deletions
21
...ord/protege/webprotege/postcoordinationservice/dto/GetEntityCustomScaleValuesRequest.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,21 @@ | ||
package edu.stanford.protege.webprotege.postcoordinationservice.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import edu.stanford.protege.webprotege.common.ProjectId; | ||
import edu.stanford.protege.webprotege.common.Request; | ||
|
||
import static edu.stanford.protege.webprotege.postcoordinationservice.dto.GetEntityCustomScaleValuesRequest.CHANNEL; | ||
|
||
|
||
@JsonTypeName(CHANNEL) | ||
public record GetEntityCustomScaleValuesRequest(@JsonProperty("entityIRI") String entityIRI, | ||
@JsonProperty("projectId") ProjectId projectId) implements Request<GetEntityCustomScaleValueResponse> { | ||
|
||
public static final String CHANNEL = "webprotege.postcoordination.GetEntityScaleValues"; | ||
|
||
@Override | ||
public String getChannel() { | ||
return CHANNEL; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ford/protege/webprotege/postcoordinationservice/dto/GetEntityPostCoordinationRequest.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,21 @@ | ||
package edu.stanford.protege.webprotege.postcoordinationservice.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import edu.stanford.protege.webprotege.common.ProjectId; | ||
import edu.stanford.protege.webprotege.common.Request; | ||
|
||
import static edu.stanford.protege.webprotege.postcoordinationservice.dto.GetEntityPostCoordinationRequest.CHANNEL; | ||
|
||
@JsonTypeName(CHANNEL) | ||
public record GetEntityPostCoordinationRequest(@JsonProperty("entityIRI") String entityIRI, | ||
@JsonProperty("projectId") ProjectId projectId) implements Request<GetEntityPostCoordinationResponse> { | ||
|
||
public static final String CHANNEL = "webprotege.postcoordination.GetEntityPostCoordinations"; | ||
|
||
@Override | ||
public String getChannel() { | ||
return CHANNEL; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...ord/protege/webprotege/postcoordinationservice/dto/GetEntityPostCoordinationResponse.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,15 @@ | ||
package edu.stanford.protege.webprotege.postcoordinationservice.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import edu.stanford.protege.webprotege.common.Response; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.model.WhoficEntityPostCoordinationSpecification; | ||
|
||
import static edu.stanford.protege.webprotege.postcoordinationservice.dto.GetEntityPostCoordinationRequest.CHANNEL; | ||
|
||
@JsonTypeName(CHANNEL) | ||
public record GetEntityPostCoordinationResponse(@JsonProperty("entityIri") | ||
String entityIri, | ||
@JsonProperty("postCoordinationSpecification") | ||
WhoficEntityPostCoordinationSpecification postCoordinationSpecification) implements Response { | ||
} |
29 changes: 29 additions & 0 deletions
29
...d/protege/webprotege/postcoordinationservice/dto/PostCoordinationCustomScalesRequest.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,29 @@ | ||
package edu.stanford.protege.webprotege.postcoordinationservice.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.events.EventProcessableParameter; | ||
|
||
import java.util.List; | ||
|
||
public class PostCoordinationCustomScalesRequest extends EventProcessableParameter { | ||
|
||
private final List<String> postCoordinationScalesValues; | ||
private final String postCoordinationAxis; | ||
|
||
|
||
@JsonCreator | ||
public PostCoordinationCustomScalesRequest(@JsonProperty("postcoordinationScaleValues") List<String> postCoordinationScalesValues, | ||
@JsonProperty("postcoordinationAxis") String postCoordinationAxis) { | ||
this.postCoordinationScalesValues = postCoordinationScalesValues; | ||
this.postCoordinationAxis = postCoordinationAxis; | ||
} | ||
|
||
public List<String> getPostCoordinationScalesValues() { | ||
return postCoordinationScalesValues; | ||
} | ||
|
||
public String getPostCoordinationAxis() { | ||
return postCoordinationAxis; | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
.../stanford/protege/webprotege/postcoordinationservice/events/AddCustomScaleValueEvent.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,40 @@ | ||
package edu.stanford.protege.webprotege.postcoordinationservice.events; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.dto.PostCoordinationCustomScalesRequest; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.model.PostCoordinationCustomScalesRevision; | ||
import edu.stanford.protege.webprotege.postcoordinationservice.model.WhoficCustomScalesValues; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public class AddCustomScaleValueEvent extends PostCoordinationCustomScalesValueEvent { | ||
public final static String TYPE = "AddCustomScaleValue"; | ||
|
||
@JsonCreator | ||
public AddCustomScaleValueEvent(@JsonProperty("postCoordinationAxis") String postCoordinationAxis,@JsonProperty("postCoordinationScaleValue") String postCoordinationScaleValue) { | ||
super(postCoordinationAxis, postCoordinationScaleValue); | ||
} | ||
|
||
@Override | ||
String getType() { | ||
return TYPE; | ||
} | ||
|
||
@Override | ||
public void applyEvent(WhoficCustomScalesValues whoficCustomScalesValues) { | ||
Optional<PostCoordinationCustomScalesRequest> existingRequest = whoficCustomScalesValues.scaleCustomizations().stream() | ||
.filter(scale -> scale.getPostCoordinationAxis().equalsIgnoreCase(this.getPostCoordinationAxis())) | ||
.findFirst(); | ||
if(existingRequest.isPresent()) { | ||
existingRequest.get().getPostCoordinationScalesValues().add(this.getPostCoordinationScaleValue()); | ||
} else { | ||
List<String> scaleValues = new ArrayList<>(); | ||
scaleValues.add(this.getPostCoordinationScaleValue()); | ||
PostCoordinationCustomScalesRequest request = new PostCoordinationCustomScalesRequest(scaleValues, this.getPostCoordinationAxis()); | ||
whoficCustomScalesValues.scaleCustomizations().add(request); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.