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

de.tsl2.nano.service.util.finder.Holder 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.addHolderExpression;

import java.util.Arrays;
import java.util.Collection;

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

    public Holder(T member, Class holderType, String attributeName, Class... relationsToLoad) {
        super((Class) member.getClass(), relationsToLoad);
        par = Arrays.asList( member, holderType, attributeName);
    }

    @Override
    StringBuffer createQuery(StringBuffer currentQuery,
            Collection parameter,
            Collection> lazyRelations) {
        return addHolderExpression(currentQuery, getSubSelectSubst(), index, par.get(0), (Class)par.get(1), (String)par.get(2));
    }
}