Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public final class TimeSeriesCatalogEndpointInput extends EndpointInput {
static final String CATEGORY_LIKE_QUERY_PARAMETER = "timeseries-category-like";
static final String GROUP_LIKE_QUERY_PARAMETER = "timeseries-group-like";
static final String INCLUDE_EXTENTS_QUERY_PARAMETER = "include-extents";
static final String INCLUDE_VERSIONS_QUERY_PARAMETER = "include-versions";
static final String EXCLUDE_EMPTY_QUERY_PARAMETER = "exclude-empty";

private String cursor;
Expand All @@ -50,6 +51,7 @@ public final class TimeSeriesCatalogEndpointInput extends EndpointInput {
private String categoryIdFilter;
private String groupIdFilter;
private boolean includeExtents = true;
private boolean includeVersions = true;
private boolean excludeEmpty = false;

public TimeSeriesCatalogEndpointInput cursor(String cursor) {
Expand Down Expand Up @@ -92,6 +94,11 @@ public TimeSeriesCatalogEndpointInput includeExtents(boolean includeExtents) {
return this;
}

public TimeSeriesCatalogEndpointInput includeVersions(boolean includeVersions) {
this.includeVersions = includeVersions;
return this;
}

public TimeSeriesCatalogEndpointInput excludeEmpty(boolean excludeEmpty) {
this.excludeEmpty = excludeEmpty;
return this;
Expand All @@ -108,6 +115,7 @@ protected HttpRequestBuilder addInputParameters(HttpRequestBuilder httpRequestBu
.addQueryParameter(CATEGORY_LIKE_QUERY_PARAMETER, categoryIdFilter)
.addQueryParameter(GROUP_LIKE_QUERY_PARAMETER, groupIdFilter)
.addQueryParameter(INCLUDE_EXTENTS_QUERY_PARAMETER, Boolean.toString(includeExtents))
.addQueryParameter(INCLUDE_VERSIONS_QUERY_PARAMETER, Boolean.toString(includeVersions))
.addQueryParameter(EXCLUDE_EMPTY_QUERY_PARAMETER, Boolean.toString(excludeEmpty))
.addQueryHeader(ACCEPT_QUERY_HEADER, ACCEPT_HEADER_V2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.EXCLUDE_EMPTY_QUERY_PARAMETER;
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.GROUP_LIKE_QUERY_PARAMETER;
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.INCLUDE_EXTENTS_QUERY_PARAMETER;
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.INCLUDE_VERSIONS_QUERY_PARAMETER;
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.LIKE_QUERY_PARAMETER;
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.OFFICE_QUERY_PARAMETER;
import static mil.army.usace.hec.cwms.data.api.client.controllers.TimeSeriesCatalogEndpointInput.PAGE_SIZE_QUERY_PARAMETER;
Expand All @@ -53,6 +54,7 @@ void testQueryRequest() {
.categoryIdFilter("CAT")
.groupIdFilter("GROUP")
.includeExtents(false)
.includeVersions(false)
.excludeEmpty(true);
input.addInputParameters(mockHttpRequestBuilder);
assertEquals("SWT", mockHttpRequestBuilder.getQueryParameter(OFFICE_QUERY_PARAMETER));
Expand All @@ -63,6 +65,7 @@ void testQueryRequest() {
assertEquals("CAT", mockHttpRequestBuilder.getQueryParameter(CATEGORY_LIKE_QUERY_PARAMETER));
assertEquals("GROUP", mockHttpRequestBuilder.getQueryParameter(GROUP_LIKE_QUERY_PARAMETER));
assertEquals("false", mockHttpRequestBuilder.getQueryParameter(INCLUDE_EXTENTS_QUERY_PARAMETER));
assertEquals("false", mockHttpRequestBuilder.getQueryParameter(INCLUDE_VERSIONS_QUERY_PARAMETER));
assertEquals("true", mockHttpRequestBuilder.getQueryParameter(EXCLUDE_EMPTY_QUERY_PARAMETER));
assertEquals(ACCEPT_HEADER_V2, mockHttpRequestBuilder.getQueryHeader(ACCEPT_QUERY_HEADER));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public class TimeSeriesCatalogEntry {
@Valid
private List<TimeSeriesExtents> extents = new ArrayList<>();

@JsonProperty("versioned")
private boolean versioned = false;

public TimeSeriesCatalogEntry office(String office) {
this.office = office;
return this;
Expand Down Expand Up @@ -202,6 +205,13 @@ public void setExtents(List<TimeSeriesExtents> extents) {
this.extents = extents;
}

public boolean isVersioned() {
return versioned;
}

public void setVersioned(boolean versioned) {
this.versioned = versioned;
}

@Override
public boolean equals(Object o) {
Expand All @@ -224,14 +234,15 @@ public boolean equals(Object o) {
this.locationTimeZone == null || timeseriesCatalogEntry.locationTimeZone == null ?
Objects.equals(this.locationTimeZone, timeseriesCatalogEntry.locationTimeZone) :
this.locationTimeZone.equalsIgnoreCase(timeseriesCatalogEntry.locationTimeZone) &&
Objects.equals(this.extents, timeseriesCatalogEntry.extents);
Objects.equals(this.extents, timeseriesCatalogEntry.extents) &&
this.versioned == timeseriesCatalogEntry.versioned;
}

@Override
public int hashCode() {
return Objects.hash(office == null ? 0 : office.toLowerCase(), timeSeriesId == null ? 0 : timeSeriesId.toLowerCase(),
units == null ? 0 : units.toLowerCase(), interval == null ? 0 : interval.toLowerCase(), intervalOffsetMinutes,
locationTimeZone == null ? 0 : locationTimeZone.toLowerCase(), extents);
locationTimeZone == null ? 0 : locationTimeZone.toLowerCase(), extents, versioned);
}

@Override
Expand All @@ -246,6 +257,7 @@ public String toString() {
sb.append(" intervalOffset: ").append(toIndentedString(intervalOffsetMinutes)).append("\n");
sb.append(" timeZone: ").append(toIndentedString(locationTimeZone)).append("\n");
sb.append(" extents: ").append(toIndentedString(extents)).append("\n");
sb.append(" versioned: ").append(toIndentedString(versioned)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Loading