package de.ivu.elect.presentation.gebietsbaum.exchange;

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

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.replikation.ReplikationPresentationStatus;

/**
 *  on 25.07.2017.
 */
@Specializes
@View(viewId = GebietGeometrieImportSearchView.VIEW_ID, useCase = UseCasePermission.GEBIET_GEOMETRIE_IMPORTIEREN)
public class WasGebietGeometrieImportSearchView extends GebietGeometrieImportSearchView {
  private static final long serialVersionUID = 1L;

  @Inject
  private transient ReplikationPresentationStatus replikationPresentationStatus;

  @Override
  public boolean isUploadPossible() {
    return super.isUploadPossible() && !isSlave();
  }

  // WASDE-1153
  private boolean isSlave() {
    return replikationPresentationStatus.isSlave();
  }
}
