All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.fusionauth.domain.search.ConsentSearchCriteria Maven / Gradle / Ivy

There is a newer version: 1.53.0
Show newest version
/*
 * 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");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy