package info.bukova.isspst.ui.tripbill;

import info.bukova.isspst.data.TripBillApproval;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;

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

/**
 * @author Pepa Rokos
 */
public class TripBillListWorkgroup extends TripBillListBase {

	@Init(superclass = true)
	public void initWorkgroupList() {
	}

	@Override
	protected List<TripBillApproval> getListFromService() {
		try {
			return getReqService().getWorkgroupReq();
		} catch (AccessDeniedException e) {
			BindUtils.postGlobalCommand(null, null, "disableWorkgroup", null);
			return new ArrayList<TripBillApproval>();
		}
	}

	@Override
	protected void beforeSelectViaUrl() {
		BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null);
	}

}
