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

it.contactlab.hub.sdk.java.internal.api.QueryApi Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package it.contactlab.hub.sdk.java.internal.api;

import it.contactlab.hub.sdk.java.queries.AtomicCondition;
import it.contactlab.hub.sdk.java.queries.ConditionContainer;
import it.contactlab.hub.sdk.java.queries.Operator;
import it.contactlab.hub.sdk.java.queries.QueryContainer;
import it.contactlab.hub.sdk.java.queries.SimpleQuery;

import java.util.Optional;

public class QueryApi {

  /**
   * Returns a {@link QueryContainer} based on some simple arguments.
   */
  public static QueryContainer createQuery(String attribute, Operator operator,
      Optional value) {
    return QueryContainer.builder()
      .name("SdkGeneratedQuery")
      .query(SimpleQuery.builder()
        .are(ConditionContainer.builder()
          .condition(AtomicCondition.builder()
            .attribute(attribute)
            .operator(operator)
            .value(value)
            .build())
          .build())
        .build())
      .build();
  }

}