Package io.jmix.core

Class FluentValuesLoader

java.lang.Object
io.jmix.core.FluentValuesLoader

@Component("core_FluentValuesLoader") @Scope("prototype") public class FluentValuesLoader extends Object
  • Field Details

  • Constructor Details

    • FluentValuesLoader

      public FluentValuesLoader(String queryString)
  • Method Details

    • createLoadContext

      protected ValueLoadContext createLoadContext()
    • list

      public List<KeyValueEntity> list()
      Loads a list of entities.
    • optional

      public Optional<KeyValueEntity> optional()
      Loads a single instance and wraps it in Optional.
    • one

      public KeyValueEntity one()
      Loads a single instance.
      Throws:
      IllegalStateException - if nothing was loaded
    • property

      public FluentValuesLoader property(String name)
      Adds a key of a returned key-value pair. The sequence of adding properties must conform to the sequence of result fields in the query "select" clause.

      For example, if the query is select e.id, e.name from sample$Customer and you executed property("customerId").property("customerName"), the returned KeyValueEntity will contain customer identifiers in "customerId" property and names in "customerName" property.

    • properties

      public FluentValuesLoader properties(List<String> properties)
      The same as invoking property(String) multiple times.
    • properties

      public FluentValuesLoader properties(String... properties)
      The same as invoking property(String) multiple times.
    • store

      public FluentValuesLoader store(String store)
      Sets DataStore name.
    • hint

      public FluentValuesLoader hint(String hintName, Serializable value)
      Sets custom hint that should be used by the query.
    • hints

      public FluentValuesLoader hints(Map<String,Serializable> hints)
      Sets custom hints that should be used by the query.
    • parameter

      public FluentValuesLoader parameter(String name, Object value)
      Sets value for a query parameter.
      Parameters:
      name - parameter name
      value - parameter value
    • parameter

      public FluentValuesLoader parameter(String name, Date value, javax.persistence.TemporalType temporalType)
      Sets value for a parameter of java.util.Date type.
      Parameters:
      name - parameter name
      value - parameter value
      temporalType - how to interpret the value
    • parameter

      public FluentValuesLoader parameter(String name, Object value, boolean implicitConversion)
      Sets value for a query parameter.
      Parameters:
      name - parameter name
      value - parameter value
      implicitConversion - whether to do parameter value conversions, e.g. convert an entity to its ID
    • setParameters

      public FluentValuesLoader setParameters(Map<String,Object> parameters)
      Sets the map of query parameters.
    • firstResult

      public FluentValuesLoader firstResult(int firstResult)
      Sets results offset.
    • maxResults

      public FluentValuesLoader maxResults(int maxResults)
      Sets results limit.
    • setDataManager

      public void setDataManager(UnconstrainedDataManager dataManager)
    • joinTransaction

      public io.jmix.core.AbstractFluentValueLoader joinTransaction(boolean join)
    • accessConstraints

      public io.jmix.core.AbstractFluentValueLoader accessConstraints(List<AccessConstraint<?>> accessConstraints)
      Sets access constraints.
    • instantiateValueLoadContext

      protected ValueLoadContext instantiateValueLoadContext()