
package de.ivu.elect.presentation.interfaces.menu;

import javax.inject.Inject;

import de.ivu.elect.business.CurrentCustomer;
import de.ivu.elect.business.security.Customer;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.menu.AbstractMenuItemEntry;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

public abstract class AbstractInterfacesMenuItemEntry extends AbstractMenuItemEntry {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient CurrentCustomer currentCustomer;

  public AbstractInterfacesMenuItemEntry() {
    super();
  }

  @Override
  public boolean isRendered() {
    return hasUseCasePermission(getUseCasePermission());
  }

  protected abstract UseCasePermission getUseCasePermission();

  @Override
  protected AbstractGebietSecurity getGebietSecurity() {
    return KEINE_GEBIET_SECURITY;
  }

  @Override
  public boolean isDisabledInternal() {
    return false;
  }

  protected boolean containsCustomer(Customer customer) {
    return currentCustomer.getCustomer().contains(customer);
  }
}
