\r
/**\r
* Common updater base class for updating schema or terms.\r
+ * \r
+ * @see CdmUpdater\r
+ * @see ISchemaUpdater\r
+ * @see ITermUpdater\r
+ * \r
* @author a.mueller\r
* @date 16.11.2010\r
*\r
protected String startVersion;\r
protected String targetVersion;\r
\r
- protected abstract boolean updateVersion(ICdmDataSource datasource, IProgressMonitor monitor) throws SQLException;\r
\r
- protected abstract String getCurrentVersion(ICdmDataSource datasource, IProgressMonitor monitor) throws SQLException;\r
+ protected abstract boolean updateVersion(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType) throws SQLException;\r
+ \r
+ protected abstract String getCurrentVersion(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType) throws SQLException;\r
\r
@Override\r
- public int countSteps(ICdmDataSource datasource, IProgressMonitor monitor){\r
+ public int countSteps(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType){\r
int result = 0;\r
//TODO test if previous updater is needed\r
- if (isToBeInvoked(/*targetVerison, */datasource, monitor)){\r
+ if (isToBeInvoked(datasource, monitor, caseType)){\r
for (T step: list){\r
result++; //+= list.size();\r
result += step.getInnerSteps().size();\r
} \r
if (getPreviousUpdater() != null){\r
- result += getPreviousUpdater().countSteps(/*targetVerison, */datasource, monitor);\r
+ result += getPreviousUpdater().countSteps(datasource, monitor, caseType);\r
}\r
}\r
return result;\r
}\r
\r
\r
- private boolean isToBeInvoked(ICdmDataSource datasource, IProgressMonitor monitor) {\r
+ private boolean isToBeInvoked(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType) {\r
boolean result = true;\r
String datasourceVersion;\r
try {\r
- datasourceVersion = getCurrentVersion(datasource, monitor);\r
+ datasourceVersion = getCurrentVersion(datasource, monitor, caseType);\r
} catch (SQLException e1) {\r
monitor.warning("SQLException", e1);\r
return false;\r
\r
\r
@Override\r
- public boolean invoke(ICdmDataSource datasource, IProgressMonitor monitor) throws Exception{\r
+ public boolean invoke(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType) throws Exception{\r
String currentLibrarySchemaVersion = CdmMetaData.getDbSchemaVersion();\r
- return invoke(currentLibrarySchemaVersion, datasource, monitor);\r
+ return invoke(currentLibrarySchemaVersion, datasource, monitor, caseType);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.database.update.IUpdater#invoke(java.lang.String, eu.etaxonomy.cdm.database.ICdmDataSource, eu.etaxonomy.cdm.common.IProgressMonitor)\r
- */\r
@Override\r
- public boolean invoke(String targetVersion, ICdmDataSource datasource, IProgressMonitor monitor) throws Exception{\r
+ public boolean invoke(String targetVersion, ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType) throws Exception{\r
boolean result = true;\r
String datasourceVersion;\r
+ \r
try {\r
- datasourceVersion = getCurrentVersion(datasource, monitor);\r
+ datasourceVersion = getCurrentVersion(datasource, monitor, caseType);\r
} catch (SQLException e1) {\r
monitor.warning("SQLException", e1);\r
return false;\r
monitor.warning(warning, exeption);\r
throw exeption;\r
}\r
- result &= getPreviousUpdater().invoke(startVersion, datasource, monitor);\r
+ result &= getPreviousUpdater().invoke(startVersion, datasource, monitor, caseType);\r
}\r
\r
\r
// datasource.startTransaction(); transaction already started by CdmUpdater\r
try {\r
for (T step : list){\r
- result &= handleSingleStep(datasource, monitor, result, step, false);\r
+ result &= handleSingleStep(datasource, monitor, result, step, false, caseType);\r
if (result == false){\r
break;\r
}\r
}\r
if (result == true){\r
- result &= updateVersion(datasource, monitor);\r
+ result &= updateVersion(datasource, monitor, caseType);\r
}else{\r
datasource.rollback();\r
}\r
\r
// protected abstract boolean handleSingleStep(ICdmDataSource datasource, IProgressMonitor monitor, boolean result, ISchemaUpdaterStep step, boolean isInnerStep) throws Exception;\r
\r
- protected boolean handleSingleStep(ICdmDataSource datasource, IProgressMonitor monitor, boolean result, ISchemaUpdaterStep step, boolean isInnerStep)\r
+ protected boolean handleSingleStep(ICdmDataSource datasource, IProgressMonitor monitor, boolean result, ISchemaUpdaterStep step, boolean isInnerStep, CaseType caseType)\r
throws Exception {\r
try {\r
monitor.subTask(step.getStepName());\r
- Integer invokeResult = step.invoke(datasource, monitor);\r
+ Integer invokeResult = step.invoke(datasource, monitor, caseType);\r
result &= (invokeResult != null);\r
for (ISchemaUpdaterStep innerStep : step.getInnerSteps()){\r
- result &= handleSingleStep(datasource, monitor, result, innerStep, true);\r
+ result &= handleSingleStep(datasource, monitor, result, innerStep, true, caseType);\r
}\r
// if (! isInnerStep){\r
monitor.worked(1);\r