Exemplo n.º 1
0
 /**
  * Diese Methode ändert im AlbumContainer den Namen eines Albums
  *
  * @param title Titel des Albums welches geändert werden soll
  * @param newTitle Neuer Titel des Albums
  *     <p>Version-History:
  * @return Fehlercode zur Auswertung <br>
  *     0 = Albumtitel wurde geändert <br>
  *     1 = Album nicht vorhanden <br>
  *     2 = neuer Albumtitel schon vorhanden
  * @date 21.11.2015 by Danilo: Initialisierung
  * @date 23.11.2015 by Danilo: Kommentar angepasst
  * @date 24.11.2015 by Danilo: Methode auf static gesetzt
  * @date 28.11.2015 by Tobias: Prüfung von newTitel hinzugefügt
  * @date 01.12.2015 by Danilo: Fehlerkorrektur
  * @date 02.12.2015 by Tobias: Prüfen ob die Titel gleich sind
  * @date 08.12.2015 by Danilo: Einfügen eines Fehlerloggingsystemes
  */
 private static int editAlbumTitle(String title, String newTitle) {
   for (Album tmpAlbum : SystemController.getAlbumContainer().getAlbenListe()) {
     // Wenn die Titel gleich sind, muss nichts geändert werden
     if (title.equals(newTitle)) {
       return 0;
     } // Wenn die Titel unterschiedlich sind:
     else {
       // Prüfen ob neuer Titel schon vergeben ist
       if (tmpAlbum.getTitel().equals(newTitle)) {
         return ErrorController.addDebugReport(331);
       }
       if (tmpAlbum.getTitel().equals(title)) {
         tmpAlbum.setTitel(newTitle);
         return 0;
       }
     }
   }
   return ErrorController.addDebugReport(330);
 }