
package de.ivu.elect.presentation;

import java.util.List;

import javax.faces.convert.Converter;

import de.ivu.elect.jee.entity.Entity;
import de.ivu.elect.jee.faces.EntityConverter;
import de.ivu.elect.jee.presentation.dynamicform.AbstractSelectManyProperty;
import de.ivu.elect.jee.presentation.dynamicform.PropertyType;

public abstract class AbstractEntitySelectManyProperty<E extends Entity< ? , ? >> extends AbstractSelectManyProperty<E> {

  private final List<E> values;

  protected AbstractEntitySelectManyProperty(List<E> values, PropertyType propertyType) {
    super(propertyType);

    this.values = values;
  }

  @Override
  public Converter getDefaultConverter() {
    return EntityConverter.getInstance();
  }

  @Override
  public String getDefaultLabel() {
    return getMessage(getMessageKeyEntityMehrzahl());
  }

  protected abstract String getMessageKeyEntityMehrzahl();

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

  @Override
  public List<E> getValues() {
    return values;
  }
}
