io.camunda.service.search.query.DecisionRequirementsQuery Maven / Gradle / Ivy
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Camunda License 1.0. You may not use this file
* except in compliance with the Camunda License 1.0.
*/
package io.camunda.service.search.query;
import io.camunda.service.search.filter.DecisionRequirementsFilter;
import io.camunda.service.search.filter.FilterBuilders;
import io.camunda.service.search.page.SearchQueryPage;
import io.camunda.service.search.sort.DecisionRequirementsSort;
import io.camunda.service.search.sort.SortOptionBuilders;
import io.camunda.util.ObjectBuilder;
import java.util.Objects;
import java.util.function.Function;
public record DecisionRequirementsQuery(
DecisionRequirementsFilter filter, DecisionRequirementsSort sort, SearchQueryPage page)
implements TypedSearchQuery {
public static DecisionRequirementsQuery of(
final Function> fn) {
return fn.apply(new Builder()).build();
}
public static final class Builder extends AbstractQueryBuilder
implements TypedSearchQueryBuilder<
DecisionRequirementsQuery,
Builder,
DecisionRequirementsFilter,
DecisionRequirementsSort> {
private static final DecisionRequirementsFilter EMPTY_FILTER =
FilterBuilders.decisionRequirements().build();
private static final DecisionRequirementsSort EMPTY_SORT =
SortOptionBuilders.decisionRequirements().build();
private DecisionRequirementsFilter filter;
private DecisionRequirementsSort sort;
@Override
public Builder filter(final DecisionRequirementsFilter value) {
filter = value;
return this;
}
@Override
public Builder sort(final DecisionRequirementsSort value) {
sort = value;
return this;
}
public Builder filter(
final Function<
DecisionRequirementsFilter.Builder, ObjectBuilder>
fn) {
return filter(FilterBuilders.decisionRequirements(fn));
}
public Builder sort(
final Function>
fn) {
return sort(SortOptionBuilders.decisionRequirements(fn));
}
@Override
protected Builder self() {
return this;
}
@Override
public DecisionRequirementsQuery build() {
filter = Objects.requireNonNullElse(filter, EMPTY_FILTER);
sort = Objects.requireNonNullElse(sort, EMPTY_SORT);
return new DecisionRequirementsQuery(filter, sort, page());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy