io.fusionauth.domain.search.ConsentSearchCriteria Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fusionauth-java-client Show documentation
Show all versions of fusionauth-java-client Show documentation
The Java Client library provides a native Java binding to the FusionAuth REST API.
/*
* Copyright (c) 2023, FusionAuth, All Rights Reserved
*/
package io.fusionauth.domain.search;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import static io.fusionauth.domain.util.SQLTools.normalizeOrderBy;
import static io.fusionauth.domain.util.SQLTools.toSearchString;
/**
* Search criteria for Consents
*
* @author Spencer Witt
*/
public class ConsentSearchCriteria extends BaseSearchCriteria {
public static final Map SortableFields = new LinkedHashMap<>();
public String name;
@Override
public BaseSearchCriteria prepare() {
if (orderBy == null) {
orderBy = defaultOrderBy();
}
orderBy = normalizeOrderBy(orderBy, SortableFields);
name = toSearchString(name);
return this;
}
@Override
public Set supportedOrderByColumns() {
return SortableFields.keySet();
}
@Override
protected String defaultOrderBy() {
return "name ASC";
}
static {
SortableFields.put("id", "c.id");
SortableFields.put("name", "c.name");
SortableFields.put("insertInstant", "c.insert_instant");
}
}