\r
import org.apache.log4j.Logger;\r
\r
-import eu.etaxonomy.cdm.common.DefaultProgressMonitor;\r
-import eu.etaxonomy.cdm.common.IProgressMonitor;\r
+import eu.etaxonomy.cdm.common.monitor.DefaultProgressMonitor;\r
+import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;\r
import eu.etaxonomy.cdm.database.CdmDataSource;\r
import eu.etaxonomy.cdm.database.ICdmDataSource;\r
-import eu.etaxonomy.cdm.database.update.v25_30.SchemaUpdater_25_30;\r
-import eu.etaxonomy.cdm.database.update.v30_31.TermUpdater_311_312;\r
+import eu.etaxonomy.cdm.database.update.v30_31.TermUpdater_314_315;\r
+import eu.etaxonomy.cdm.database.update.v31_33.SchemaUpdater_31_33;\r
\r
/**\r
* @author a.mueller\r
monitor.beginTask(taskName, steps);\r
\r
try {\r
+ datasource.startTransaction();\r
result &= currentSchemaUpdater.invoke(datasource, monitor);\r
- // the above apparently did not work while testing. Did not want to set the version in CdmMetaData yet\r
-// result &= currentSchemaUpdater.invoke(currentSchemaUpdater.getTargetVersion(), datasource, monitor);\r
- result &= currentTermUpdater.invoke(datasource, monitor);\r
+ if (result == true){\r
+ result &= currentTermUpdater.invoke(datasource, monitor);\r
+ }\r
+ if (result == false){\r
+ datasource.rollback();\r
+ }else{\r
+ datasource.commitTransaction();\r
+ }\r
+ \r
} catch (Exception e) {\r
result = false;\r
monitor.warning("Stopped schema updater");\r
} finally {\r
String message = "Update finished " + (result ? "successfully" : "with ERRORS");\r
monitor.subTask(message);\r
- monitor.done();\r
+ if (!result){\r
+ monitor.warning(message);\r
+ monitor.setCanceled(true);\r
+ }else{\r
+ monitor.done();\r
+ }\r
logger.info(message);\r
}\r
\r
}\r
\r
private ITermUpdater getCurrentTermUpdater() {\r
- return TermUpdater_311_312.NewInstance();\r
+ return TermUpdater_314_315.NewInstance();\r
}\r
\r
/**\r
* @return\r
*/\r
private ISchemaUpdater getCurrentSchemaUpdater() {\r
- return SchemaUpdater_25_30.NewInstance();\r
+ return SchemaUpdater_31_33.NewInstance();\r
}\r
\r
/**\r