com.opentext.ia.sdk.dto.SearchResults Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infoarchive-sdk-core Show documentation
Show all versions of infoarchive-sdk-core Show documentation
A library that makes it quick and easy to create SIPs in InfoArchive
/*
* Copyright (c) 2016-2017 by OpenText Corporation. All Rights Reserved.
*/
package com.opentext.ia.sdk.dto;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.opentext.ia.sdk.support.http.rest.LinkContainer;
public class SearchResults extends LinkContainer {
private static final String KEY = "results";
private final List results = new ArrayList<>();
@JsonProperty("_embedded")
protected void setEmbedded(Map> embedded) {
results.clear();
List embeddedItems = embedded.get(KEY);
if (embeddedItems == null) {
throw new IllegalArgumentException(String.format("Expected results under key '%s', but got keys %s", KEY,
embedded.keySet()));
}
results.addAll(embeddedItems);
}
public List getResults() {
return results;
}
public void addResult(SearchResult searchResult) {
results.add(searchResult);
}
public List getRows() {
List rows = new ArrayList<>();
for (SearchResult searchResult: results) {
rows.addAll(searchResult.getRows());
}
return rows;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy