
package de.ivu.elect.business.dokumente.control;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.datei.entity.FileType;

public class DokumentGenerierenSupportedOpenOfficeFileFormats implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient BaseOpenOfficeKonfigurationFactory openOfficeKonfigurationFactory;

  public DokumentGenerierenSupportedOpenOfficeFileFormats() {
    super();
  }

  public List<FileType> getSupportedFileTypes() {
    List<FileType> result = new ArrayList<>();
    result.add(FileType.ODT);

    if (isKonvertierungVerfuegbar()) {
      result.addAll(Arrays.asList(FileType.PDF, FileType.DOCX, FileType.DOC, FileType.RTF, FileType.HTML, FileType.TXT));
    }

    return result;
  }

  protected boolean isKonvertierungVerfuegbar() {
    return openOfficeKonfigurationFactory.isOpenOfficeVerfuegbar();
  }
}
