Skip to content
Draft
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
Expand Up @@ -119,6 +119,7 @@ default <D extends StacCollectionModel> Collection getCollection(D m, Filter fil
.title(l.getTitle())
.description(l.getDescription())
.aiGroup(l.getAiGroup())
.aiRole(l.getAiRole())
)
.toList()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class ExtendedLink extends Link {

@JsonProperty("ai:group")
private String aiGroup;

@JsonProperty("ai:role")
private List<String> aiRole;

@JsonProperty("description")
private String description;

Expand All @@ -24,6 +29,11 @@ public ExtendedLink aiGroup(String aiGroup) {
return this;
}

public ExtendedLink aiRole(List<String> aiRole) {
this.aiRole = aiRole;
return this;
}

public ExtendedLink description(String description) {
this.description = description;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
Expand All @@ -20,6 +22,9 @@ public class LinkModel {
@JsonProperty("ai:group")
protected String aiGroup;

@JsonProperty("ai:role")
protected List<String> aiRole;

@JsonProperty("description")
protected String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void verifyAddingPropertyWorks() {
.type("text/html")
.title("Data Link")
.aiGroup("data-access")
.aiRole(List.of("download"))
.description("description")
.build();
var link2 = LinkModel.builder()
Expand Down Expand Up @@ -160,6 +161,13 @@ public void verifyAddingPropertyWorks() {
Assertions.assertEquals(parameterVocabs, collection.getProperties().get(CollectionProperty.parameterVocabs));
Assertions.assertNotNull(collection.getLinks());
Assertions.assertEquals(3, collection.getLinks().size());

ExtendedLink convertedLink1 = (ExtendedLink) collection.getLinks().stream()
.filter(l -> "related".equals(l.getRel()))
.findFirst()
.orElseThrow();

Assertions.assertEquals(List.of("download"), convertedLink1.getAiRole());
}

@Test
Expand Down
3 changes: 3 additions & 0 deletions server/src/test/resources/portal_records_index_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@
},
"ai:group": {
"type": "keyword"
},
"ai:role": {
"type": "keyword"
}
}
}
Expand Down
Loading