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 TripBillListCentre extends TripBillListBase {

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

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

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