package info.bukova.isspst.ui.main.orders.services;

import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.ui.main.orders.requirements.ReqListMy;

import java.util.ArrayList;
import java.util.List;

import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;

public class ReqServicesListMy extends ReqListMy
{
	@WireVariable
	protected RequirementService reqServicesService;

	@Init(superclass = true)
	public void initReqServicesListMy()
	{
		service = reqServicesService;
		formZul = "/main/orders/services/reqHeadForm.zul";
	}

	@Override
	protected List<Requirement> getListFromService()
	{
		try
		{
			return reqServicesService.getMy();
		}
		catch (AccessDeniedException e)
		{
			BindUtils.postGlobalCommand(null, null, "disableAll", null);
			return new ArrayList<Requirement>();
		}
	}
}
