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

de.tsl2.nano.service.util.finder.Union 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 java.util.Collection;

import de.tsl2.nano.service.util.ServiceUtil;

/**
 * TODO: implement additional union statement creator
 * 
 * @param  result bean type
 * @author Thomas Schneider, Thomas Schneider
 * @version $Revision$
 */
public class Union extends Expression {
    /** serialVersionUID */
    private static final long serialVersionUID = -6987663981295488159L;

    /**
     * constructor
     * 
     * @param attributeNames, for ascending use prefix +. for descendings prefix -. default is ascending.
     */
    public Union(Class resultType) {
        super(resultType, createUnion(resultType), false, new Object[] {});
    }

    @Override
    StringBuffer createQuery(StringBuffer currentQuery,
            Collection parameter,
            Collection> lazyRelations) {
        return currentQuery.append(createUnion(resultType));
    }
    static String createUnion(Class resultType) {
        return "\nunion " + ServiceUtil.createStatement(resultType, ServiceUtil.SUBST_RESULTBEAN/* + "u."*/) + " where 1 = 1";
    }
}