Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ackend-api into update

� Conflicts:
�	pom.xml
  • Loading branch information
soimugeo committed Dec 16, 2024
2 parents ccfa7b9 + 1378fbd commit 8e5bafe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 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-api</artifactId>
<version>2.0.2-WHO</version>
<version>2.1.0-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 @@ -7,11 +7,14 @@
import edu.stanford.protege.webprotege.common.LangTagFilter;
import edu.stanford.protege.webprotege.common.PageRequest;
import edu.stanford.protege.webprotege.common.ProjectId;
import edu.stanford.protege.webprotege.criteria.EntityMatchCriteria;
import edu.stanford.protege.webprotege.criteria.EntityTypeIsOneOfCriteria;
import edu.stanford.protege.webprotege.dispatch.ProjectAction;
import edu.stanford.protege.webprotege.project.HasProjectId;
import org.semanticweb.owlapi.model.EntityType;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Set;

Expand All @@ -26,12 +29,14 @@


@JsonTypeName("webprotege.search.PerformEntitySearch")
public record PerformEntitySearchAction(@JsonProperty(value = "projectId", required = true) @Nonnull ProjectId projectId,
@JsonProperty(value = "searchString", required = true) @Nonnull String searchString,
@JsonProperty(value = "entityTypes", defaultValue = "[]") @Nonnull Set<EntityType<?>> entityTypes,
@JsonProperty("langTagFilter") @Nonnull LangTagFilter langTagFilter,
@JsonProperty("searchFilters") @Nonnull ImmutableList<EntitySearchFilter> searchFilters,
@JsonProperty("pageRequest") @Nonnull PageRequest pageRequest) implements ProjectAction<PerformEntitySearchResult>, HasProjectId {
public record PerformEntitySearchAction(
@JsonProperty(value = "projectId", required = true) @Nonnull ProjectId projectId,
@JsonProperty(value = "searchString", required = true) @Nonnull String searchString,
@JsonProperty(value = "entityTypes", defaultValue = "[]") @Nonnull Set<EntityType<?>> entityTypes,
@JsonProperty("langTagFilter") @Nonnull LangTagFilter langTagFilter,
@JsonProperty("searchFilters") @Nonnull ImmutableList<EntitySearchFilter> searchFilters,
@JsonProperty("pageRequest") @Nonnull PageRequest pageRequest,
@JsonProperty("resultsSetFilter") @Nullable EntityMatchCriteria resultsSetFilter) implements ProjectAction<PerformEntitySearchResult>, HasProjectId {

public static final String CHANNEL = "webprotege.search.PerformEntitySearch";

Expand All @@ -40,13 +45,19 @@ public PerformEntitySearchAction(@JsonProperty("projectId") @Nonnull ProjectId p
@JsonProperty(value = "entityTypes") @Nonnull Set<EntityType<?>> entityTypes,
@JsonProperty("langTagFilter") @Nonnull LangTagFilter langTagFilter,
@JsonProperty("searchFilters") @Nonnull ImmutableList<EntitySearchFilter> searchFilters,
@JsonProperty("pageRequest") @Nonnull PageRequest pageRequest) {
@JsonProperty("pageRequest") @Nonnull PageRequest pageRequest,
@JsonProperty("resultsSetFilter") @Nullable EntityMatchCriteria resultsSetFilter) {
this.projectId = requireNonNull(projectId);
this.searchString = requireNonNull(searchString);
this.entityTypes = requireNonNullElse(entityTypes, Collections.emptySet());
this.langTagFilter = requireNonNullElse(langTagFilter, LangTagFilter.get(ImmutableSet.of()));
this.searchFilters = requireNonNullElse(searchFilters, ImmutableList.of());
this.pageRequest = requireNonNullElse(pageRequest, PageRequest.requestFirstPage());
this.resultsSetFilter = requireNonNullElse(resultsSetFilter, EntityTypeIsOneOfCriteria.get(ImmutableSet.copyOf(entityTypes)));
}

public PerformEntitySearchAction(@Nonnull ProjectId projectId, @Nonnull String searchString, @Nonnull Set<EntityType<?>> entityTypes, @Nonnull LangTagFilter langTagFilter, @Nonnull ImmutableList<EntitySearchFilter> searchFilters, @Nonnull PageRequest pageRequest) {
this(projectId, searchString, entityTypes, langTagFilter, searchFilters, pageRequest, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public void shouldSerializeAction() throws IOException {
var action = new PerformEntitySearchAction(mockProjectId(),
"Test", Collections.emptySet(),
LangTagFilter.get(ImmutableSet.of()), ImmutableList.of(),
PageRequest.requestFirstPage());
PageRequest.requestFirstPage(),
null);

}

Expand Down

0 comments on commit 8e5bafe

Please sign in to comment.