package org.domain.zzzzzz2.session;

import org.domain.zzzzzz2.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("productsList")
public class ProductsList extends EntityQuery<Products> {

	private static final String EJBQL = "select products from Products products";

	private static final String[] RESTRICTIONS = {
			"lower(products.productcode) like lower(concat(#{productsList.products.productcode},'%'))",
			"lower(products.productname) like lower(concat(#{productsList.products.productname},'%'))",
			"lower(products.productscale) like lower(concat(#{productsList.products.productscale},'%'))",
			"lower(products.productvendor) like lower(concat(#{productsList.products.productvendor},'%'))",
			"lower(products.productdescription) like lower(concat(#{productsList.products.productdescription},'%'))", };

	private Products products = new Products();

	public ProductsList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Products getProducts() {
		return products;
	}
}
