2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.database
.update
;
11 import java
.sql
.SQLException
;
12 import java
.util
.List
;
14 import eu
.etaxonomy
.cdm
.common
.monitor
.IProgressMonitor
;
15 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
18 * Base class for a {@link ISchemaUpdaterStep schema update step} which supports automated handling
28 public abstract class AuditedSchemaUpdaterStepBase
extends SchemaUpdaterStepBase
{
30 protected String tableName
;
31 protected boolean includeAudTable
;
32 protected boolean isAuditing
;
34 // protected AuditedSchemaUpdaterStepBase(String stepName, boolean includedAudTable) {
35 // super(null, stepName);
36 // this.includeAudTable = includedAudTable;
39 // protected AuditedSchemaUpdaterStepBase(String stepName, String tableName, boolean includedAudTable) {
40 // super(null, stepName);
41 // this.includeAudTable = includedAudTable;
42 // this.tableName = tableName;
46 protected AuditedSchemaUpdaterStepBase(List
<ISchemaUpdaterStep
> stepList
, String stepName
, boolean includedAudTable
) {
47 super(stepList
, stepName
);
48 this.includeAudTable
= includedAudTable
;
51 protected AuditedSchemaUpdaterStepBase(List
<?
extends ISchemaUpdaterStep
> stepList
, String stepName
, String tableName
, boolean includedAudTable
) {
52 super(stepList
, stepName
);
53 this.includeAudTable
= includedAudTable
;
54 this.tableName
= tableName
;
58 public void invoke(ICdmDataSource datasource
, IProgressMonitor monitor
,
59 CaseType caseType
, SchemaUpdateResult result
) throws SQLException
{
61 invokeOnTable(caseType
.transformTo(tableName
), datasource
, monitor
, caseType
, result
);
65 invokeOnTable(caseType
.transformTo(tableName
+ aud
), datasource
, monitor
, caseType
, result
);
71 * Invoke the update on the given table of name tableName.
72 * @param tableName the tableName, already in the correct case
73 * @param datasource the data source
74 * @param monitor the monitor
75 * @param caseType the caseType (in case other tables are also affected
79 protected abstract void invokeOnTable(String tableName
, ICdmDataSource datasource
,
80 IProgressMonitor monitor
, CaseType caseType
, SchemaUpdateResult result
);