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("employeesList")
public class EmployeesList extends EntityQuery<Employees> {

	private static final String EJBQL = "select employees from Employees employees";

	private static final String[] RESTRICTIONS = {
			"lower(employees.lastname) like lower(concat(#{employeesList.employees.lastname},'%'))",
			"lower(employees.firstname) like lower(concat(#{employeesList.employees.firstname},'%'))",
			"lower(employees.extension) like lower(concat(#{employeesList.employees.extension},'%'))",
			"lower(employees.email) like lower(concat(#{employeesList.employees.email},'%'))",
			"lower(employees.officecode) like lower(concat(#{employeesList.employees.officecode},'%'))",
			"lower(employees.jobtitle) like lower(concat(#{employeesList.employees.jobtitle},'%'))", };

	private Employees employees = new Employees();

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

	public Employees getEmployees() {
		return employees;
	}
}
