Ejemplo n.º 1
0
  /**
   * Schreibt einen Eintrag in die Datenbank fuer eine neue Baseline
   *
   * @param description Beschreibung der Baseline
   * @return Datenbank-ID der Baseline
   */
  private static int createBaseline(String description) {
    int baseID = -1;
    java.util.Date dt = new Date();
    java.sql.Date dte = new java.sql.Date(dt.getTime());
    int highest = 0;

    Baseline newBaseline = new Baseline();
    newBaseline.setBl_date(dte);
    newBaseline.setDescription(description);
    newBaseline.setFid_project(1);
    if (!DBModelManager.getBaselineModel().addNewBaseline(newBaseline)) {
      System.out.println(LocalizedStrings.getErrorMessages().baselineCreatingError());
      return baseID;
    }
    List<Baseline> baselines = DBModelManager.getBaselineModel().getBaseline();
    for (Baseline bl : baselines) {
      int wert = bl.getId();
      if (wert > highest) {
        highest = wert;
      }
    }
    // baseID wird mit der neu generierten Baseline-ID initialisiert
    baseID = highest;
    return baseID;
  }
Ejemplo n.º 2
0
 /**
  * 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();
 }
Ejemplo n.º 3
0
  /** Default-Constructor: Creates a JPanel with the different colors of the cpi and its values. */
  public Legende() {
    super();

    setLayout(new FlowLayout());

    add(new JLabel(LocalizedStrings.getWbs().cpiColors() + ":"));
    JLabel text = new JLabel();
    text.setHorizontalAlignment(SwingConstants.CENTER);
    text.setOpaque(true);

    add(new JLabel());

    final Dimension canvasSize = new Dimension(20, 20);

    /* The canvas for the color of the single cpi levels. */
    Canvas color = new Canvas();
    color.setBackground(HIGH_CPI_COLOR);
    color.setSize(canvasSize);
    add(color);
    text.setText("1.03 >");
    add(text);

    color = new Canvas();
    color.setBackground(EVEN_CPI_COLOR);
    color.setSize(canvasSize);
    add(color);
    text = new JLabel("1.03 - 0.97");
    add(text);

    color = new Canvas();
    color.setBackground(LOW_CPI_COLOR);
    color.setSize(canvasSize);
    add(color);
    text = new JLabel("0.97 - 0.94");
    add(text);

    color = new Canvas();
    color.setBackground(VERY_LOW_CPI_COLOR);
    color.setSize(canvasSize);
    add(color);
    text = new JLabel("0.94 - 0.6");
    add(text);

    color = new Canvas();
    color.setBackground(ULTRA_LOW_CPI_COLOR);
    color.setSize(canvasSize);
    add(color);
    text = new JLabel("< 0.6");
    add(text);
  }
Ejemplo n.º 4
0
  /**
   * 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();
  }
Ejemplo n.º 5
0
 /**
  * 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();
 }