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

de.tsl2.nano.service.util.finder.Example Maven / Gradle / Ivy

Go to download

TSL2 JEE Service Access (Generic Services for Entity Access, JEE File-System-Connector, Generic Featuring, Job-Scheduling, BeanContainer, Batch, Comfortable Bean Query Definitions, JAAS, Authentification, Authorization, )

The newest version!
package de.tsl2.nano.service.util.finder;

import static de.tsl2.nano.service.util.ServiceUtil.OP_LIKE;
import static de.tsl2.nano.service.util.ServiceUtil.addAndConditions;

import java.util.Collection;

/**
 * example finder
 * 
 * @param  result bean type
 * @author Thomas Schneider, Thomas Schneider
 * @version $Revision$
 */
public class Example extends AbstractFinder {
    /** serialVersionUID */
    private static final long serialVersionUID = 3047663581726904442L;

    T example;
    public Example(T example, Class... relationsToLoad) {
        super((Class) example.getClass(), relationsToLoad);
        this.example = example;
    }

    @Override
    StringBuffer createQuery(StringBuffer currentQuery,
            Collection parameter,
            Collection> lazyRelations) {
        return addAndConditions(currentQuery, getSubSelectSubst() + ".", getAndClause(), example, OP_LIKE, parameter, false);
    }
}