/**
  * Konstruktor
  *
  * @param changedWp Arbeitspaket, dessen OAP aktualisiert werden muessen
  * @param wpOverview fuer den Reload wenn fertig
  */
 public CalcOAPBaseline(Workpackage changedWp, WPOverview wpOverview) {
   Workpackage actualOAP = changedWp;
   do {
     Loader.setLoadingText(
         LocalizedStrings.getStatus().calculateLevel(actualOAP.getlastRelevantIndex()));
     actualOAP = WpManager.getWorkpackage(actualOAP.getOAPID());
     calculate(actualOAP);
   } while (!actualOAP.equals(WpManager.getRootAp()));
   wpOverview.reload();
 }
  /**
   * Konstruktor fuer BErechnung mit erstllen einer Baseline
   *
   * @param baselineID ID einer Baseline, die bereits (ohne Analysedaten) in die Datenbank
   *     eingetragen wurde
   * @param wpOverview fuer den Reload wenn fertig
   */
  private CalcOAPBaseline(int baselineID, WPOverview wpOverview) {

    Map<Integer, List<Workpackage>> oapLevels = new HashMap<Integer, List<Workpackage>>();
    for (int i = WpManager.getRootAp().getLvlIDs().length; i >= 0; i--) {
      oapLevels.put(i, new ArrayList<Workpackage>());
    }
    for (Workpackage actualWp : WpManager.getAllAp()) {
      if (actualWp.isIstOAP() || WpManager.getUAPs(actualWp).isEmpty()) {
        oapLevels.get(actualWp.getlastRelevantIndex()).add(actualWp);
      }
    }
    for (int i = WpManager.getRootAp().getLvlIDs().length; i >= 0; i--) {
      for (Workpackage actualWp : oapLevels.get(i)) {
        Loader.setLoadingText(LocalizedStrings.getStatus().calculateLevel(i));
        calculate(actualWp);
        this.writeAnalysis(actualWp, baselineID);
      }
    }
    wpOverview.reload();
  }
 /**
  * Konstruktor
  *
  * @param withTime Berechnung unter Beruecksichtigung der PV-Berechnung, wenn true dauert die
  *     Berechnung deutlich laenger
  * @param wpOverview fuer den Reload wenn fertig
  */
 public CalcOAPBaseline(boolean withTime, WPOverview wpOverview) {
   this.withTime = withTime;
   if (withTime) {
     new TimeCalc();
   }
   Map<Integer, List<Workpackage>> oapLevels = new HashMap<Integer, List<Workpackage>>();
   for (int i = WpManager.getRootAp().getLvlIDs().length; i >= 0; i--) {
     oapLevels.put(i, new ArrayList<Workpackage>());
   }
   for (Workpackage actualWp : WpManager.getAllAp()) {
     if (actualWp.isIstOAP()) {
       oapLevels.get(actualWp.getlastRelevantIndex()).add(actualWp);
     }
   }
   for (int i = WpManager.getRootAp().getLvlIDs().length; i >= 0; i--) {
     for (Workpackage actualWp : oapLevels.get(i)) {
       Loader.setLoadingText(LocalizedStrings.getStatus().calculateLevel(i));
       calculate(actualWp);
     }
   }
   wpOverview.reload();
 }