
package de.ivu.elect.business;

import javax.enterprise.inject.Specializes;
import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.ivu.elect.business.gebietsbaum.boundary.DefaultGebietsarteigenschaftCreator;

@Specializes
public class CoreStartup extends CommonStartup {

  private static final Logger LOG = LoggerFactory.getLogger(CoreStartup.class);

  @Inject
  private transient DefaultGebietsarteigenschaftCreator gebietsarteigenschaftCreator;

  public CoreStartup() {
    super();
  }

  @Override
  public void init() {
    super.init();

    dumpCoreLogo();

    if (isStammdatenInitialisieren()) {
      LOG.info(getAppName() + " - Gebietsarteigenschaften anlegen");
      gebietsarteigenschaftCreator.initGebietsartenGebietsarteigenschaftenAlleMandanten();
      LOG.info(getAppName() + " - Gebietsarteigenschaften angelegt");
    }
  }

  // Cf. http://www.network-science.de/ascii/ascii.php?TEXT=CORE&x=13&y=16&FONT=cyberlarge&RICH=no&FORM=left&STRE=no&WIDT=70
  private void dumpCoreLogo() {
    String tab = calculateLogoTab(LOG);

    LOG.info(tab + "_______  _____   ______ _______ ");
    LOG.info(tab + "|       |     | |_____/ |______ ");
    LOG.info(tab + "|_____  |_____| |    \\_ |______");
    LOG.info(tab + "                                ");
  }
}
