← Back to team overview

slub.team team mailing list archive

[Merge] lp:~henning-gerhardt/goobi-production/bug-972161 into lp:goobi-production

 

Henning Gerhardt has proposed merging lp:~henning-gerhardt/goobi-production/bug-972161 into lp:goobi-production.

Requested reviews:
  Ralf Claussnitzer (ralf-claussnitzer)
Related bugs:
  Bug #972161 in Goobi.Production: "incorrect process statistics"
  https://bugs.launchpad.net/goobi-production/+bug/972161

For more details, see:
https://code.launchpad.net/~henning-gerhardt/goobi-production/bug-972161/+merge/104895
-- 
https://code.launchpad.net/~henning-gerhardt/goobi-production/bug-972161/+merge/104895
Your team Saxon State Library Team is subscribed to branch lp:goobi-production.
=== modified file 'src/de/sub/goobi/metadaten/Metadaten.java'
--- src/de/sub/goobi/metadaten/Metadaten.java	2012-02-22 11:26:21 +0000
+++ src/de/sub/goobi/metadaten/Metadaten.java	2012-05-07 12:10:29 +0000
@@ -226,12 +226,11 @@
 		if (!SperrungAktualisieren()) {
 			return "SperrungAbgelaufen";
 		} else {
-			try {
-				myProzess.writeMetadataFile(gdzfile);
-			} catch (Exception e) {
-				Helper.setFehlerMeldung("fehlerNichtSpeicherbar", e);
-				myLogger.error(e);
-			}
+			boolean successfulStore;
+			calculateMetadataAndImages();
+			cleanupMetadata();
+			// ignoring result of store operation
+			successfulStore = storeMetadata();
 			return "";
 		}
 	}
@@ -624,17 +623,7 @@
 		return "Metadaten";
 	}
 
-	/**
-	 * Metadaten Schreiben
-	 * 
-	 * @throws InterruptedException
-	 * @throws IOException
-	 * @throws DAOException
-	 * @throws SwapException
-	 * @throws WriteException
-	 * @throws PreferencesException
-	 */
-	public String XMLschreiben() {
+	private void calculateMetadataAndImages() {
 		/*
 		 * für den Prozess nochmal die Metadaten durchlaufen und die Daten speichern
 		 */
@@ -652,19 +641,49 @@
 			Helper.setFehlerMeldung("error while counting current images", e);
 			myLogger.error(e);
 		}
+	}
 
+	private void cleanupMetadata() {
 		/*
 		 * --------------------- vor dem Speichern alle ungenutzen Docstructs rauswerfen -------------------
 		 */
 		metahelper.deleteAllUnusedElements(mydocument.getLogicalDocStruct());
+	}
+
+	private boolean storeMetadata() {
+		boolean result = true;
 
 		try {
 			myProzess.writeMetadataFile(gdzfile);
 		} catch (Exception e) {
 			Helper.setFehlerMeldung("fehlerNichtSpeicherbar", e);
 			myLogger.error(e);
+			result = false;
+		}
+
+		return result;
+	}
+
+	/**
+	 * Metadaten Schreiben
+	 * 
+	 * @throws InterruptedException
+	 * @throws IOException
+	 * @throws DAOException
+	 * @throws SwapException
+	 * @throws WriteException
+	 * @throws PreferencesException
+	 */
+	public String XMLschreiben() {
+
+		calculateMetadataAndImages();
+
+		cleanupMetadata();
+
+		if (! storeMetadata()) {
 			return "Metadaten";
 		}
+
 		SperrungAufheben();
 		return zurueck;
 	}


Follow ups