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

org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaStep Maven / Gradle / Ivy

The newest version!
package org.nuiton.topia.persistence;

/*
 * #%L
 * ToPIA Extension :: API
 * %%
 * Copyright (C) 2018 - 2022 Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import org.nuiton.topia.persistence.pager.PaginationOrder;

import java.util.Collection;
import java.util.LinkedHashSet;

/**
 * Represents a step when building a query to add a constraint.
 * 

* The builder implements the fluent interface DP, so you can add multiple constraints by chaining calls. * * @author bleny * @author Arnaud Thimel (Code Lutin) * @since 3.0 */ public interface TopiaQueryBuilderAddCriteriaStep { /** * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property. * @param value the value the field of the entity must be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addEquals(String property, Object value); /** * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property. * @param value the value the field of the entity must not be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addNotEquals(String property, Object value); /** * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @param values a collection of values the field of the entity must be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addIn(String property, Collection values); /** * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @param values the value the field of the entity must not be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addNotIn(String property, Collection values); /** * @param property the name of a field of the queried entity, must be a one-to-many or a many-to-many property * @param value the property of the entity must be a collection that contains value * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addContains(String property, Object value); /** * @param property the name of a field of the queried entity, must be a one-to-many or a many-to-many property * @param value the property of the entity must be a collection that doesn't contain value * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addNotContains(String property, Object value); /** * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addNull(String property); /** * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addNotNull(String property); /** * This method has the same behavior as {@link #addEquals(String, Object)} but you don't need to have the entity but * only the topiaId. *

* This method is useful when you want to do a {@link #addEquals(String, Object)} but you don't * have the entity you want to give as an argument, you only have the topiaId. * *

     *     // given that we want to find an entity that has a boat property valued to a
     *     // boat which topiaId is boatId, we could write:
     *
     *     addEquals("boat.topiaId", boatId); // boatId is a topiaId
     *
     *     // but instead, you can write
     *
     *     addTopiaIdEquals("boat", boatId); // boat is a topia entity
     * 
* * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @param topiaId the value the topiaId of the entity must be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addTopiaIdEquals(String property, String topiaId); /** * This method has the same behavior as {@link #addNotEquals(String, Object)} but you don't need to have the entity * but only the topiaId. * * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @param topiaId the value the topiaId of the entity must not be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addTopiaIdNotEquals(String property, String topiaId); /** * This method has the same behavior as {@link #addIn(String, Collection)} but you don't need to have the entity but * only the topiaId. * * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @param topiaIds a collection of values the topiaId of the entity must be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addTopiaIdIn(String property, Collection topiaIds); /** * This method has the same behavior as {@link #addNotIn(String, Collection)} but you don't need to have the entity * but only the topiaId. * * @param property the name of a field of the queried entity, must be a one-to-one or a many-to-one property * @param topiaIds a collection of values the topiaId of the entity must not be equals to * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addTopiaIdNotIn(String property, Collection topiaIds); /** * @param property a property to load (fetch) with the entity(ies) (in a single query) * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addFetch(String property); /** * @param property a property to load (fetch) with the entity(ies) (in a single query) * @param otherProperties an optional array of additional properties to load (fetch) with the entity(ies) * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addAllFetches(String property, String... otherProperties); /** * @param properties a collection of properties to load (fetch) with the entity(ies) (in a single query) * @return the current or next step for a fluent interface usage */ TopiaQueryBuilderAddCriteriaOrRunQueryStep addAllFetches(Collection properties); /** * @param orderByArguments list of arguments that will be added as order by * @return the next step as this method must be used at the end */ TopiaQueryBuilderRunQueryStep setOrderByArguments(LinkedHashSet orderByArguments); /** * @param orderByArguments list of arguments that will be added as order by * @return the next step as this method must be used at the end */ TopiaQueryBuilderRunQueryStep setOrderByArguments(String... orderByArguments); /** * @param paginationOrders list of {@link PaginationOrder} that will be added as order by * @return the next step as this method must be used at the end * @see PaginationOrder */ TopiaQueryBuilderRunQueryStep setOrderByArguments(Collection paginationOrders); void whereStringEquals(String propertyName, String propertyValue); void whereStringNotEquals(String propertyName, String propertyValue); void addLowerThan(String property, java.util.Date date); void addLowerOrEquals(String property, java.util.Date date); void addGreaterThan(String property, java.util.Date date); void addGreaterOrEquals(String property, java.util.Date date); void addLowerThan(String property, Number number); void addLowerOrEquals(String property, Number number); void addGreaterThan(String property, Number number); void addGreaterOrEquals(String property, Number number); void setOrder(LinkedHashSet order); void setCaseSensitive(boolean caseSensitive); void addLike(String property, String value); void addNotLike(String property, String value); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy