summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2013-05-07 03:29:25 (EDT)
committer Stephan Born2013-09-06 07:18:13 (EDT)
commitf148301adce65846b019dd7191be8503b3121573 (patch)
tree4943f2f94ac75787ea38b46832adb861f31b750a
parente06648e65da97d8c1d3e0ad0ffbcfb988a53bd58 (diff)
downloadorg.eclipse.stardust.engine-f148301adce65846b019dd7191be8503b3121573.zip
org.eclipse.stardust.engine-f148301adce65846b019dd7191be8503b3121573.tar.gz
org.eclipse.stardust.engine-f148301adce65846b019dd7191be8503b3121573.tar.bz2
Jira-ID: CRNT-28549
Merge changes done on b_dev_5_3_x after 5.3.19.GA (5.3.19.4-r58998) through 5.3.20.GA (5.3.20.2-r64536) to 7.2 (TRUNK) - kernel / modeler / build (CRNT-26170: Sysconsole: Errors occur during upgrade of Audit trail.) git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/engine@64736 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Antje Fuhrmann <antje.fuhrmann@sungard.com>
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/upgrade/jobs/R4_9_0from4_7_0RuntimeJob.java86
1 files changed, 53 insertions, 33 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/upgrade/jobs/R4_9_0from4_7_0RuntimeJob.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/upgrade/jobs/R4_9_0from4_7_0RuntimeJob.java
index 3cc7d37..06dc1f8 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/upgrade/jobs/R4_9_0from4_7_0RuntimeJob.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/upgrade/jobs/R4_9_0from4_7_0RuntimeJob.java
@@ -10,19 +10,21 @@
*******************************************************************************/
package org.eclipse.stardust.engine.core.upgrade.jobs;
+import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.config.Version;
import org.eclipse.stardust.engine.core.persistence.jdbc.DBMSKey;
+import org.eclipse.stardust.engine.core.persistence.jdbc.DDLManager;
import org.eclipse.stardust.engine.core.persistence.jdbc.FieldDescriptor;
import org.eclipse.stardust.engine.core.persistence.jdbc.TypeDescriptor;
import org.eclipse.stardust.engine.core.runtime.beans.SchemaHelper;
+import org.eclipse.stardust.engine.core.upgrade.framework.AbstractTableInfo.FieldInfo;
import org.eclipse.stardust.engine.core.upgrade.framework.AlterTableInfo;
import org.eclipse.stardust.engine.core.upgrade.framework.DatabaseHelper;
import org.eclipse.stardust.engine.core.upgrade.framework.UpgradeException;
-import org.eclipse.stardust.engine.core.upgrade.framework.AbstractTableInfo.FieldInfo;
/**
@@ -51,56 +53,74 @@ public class R4_9_0from4_7_0RuntimeJob extends DbmsAwareRuntimeUpgradeJob
protected void upgradeSchema(boolean recover) throws UpgradeException
{
DBMSKey targetDBMS = item.getDbDescriptor().getDbmsKey();
- if(DBMSKey.ORACLE.equals(targetDBMS) || DBMSKey.ORACLE9i.equals(targetDBMS))
+ if (DBMSKey.ORACLE.equals(targetDBMS) || DBMSKey.ORACLE9i.equals(targetDBMS))
{
+ DDLManager ddlManager = new DDLManager(item.getDbDescriptor());
for (Iterator iter = SchemaHelper.getPersistentClasses(item.getDbDescriptor())
.iterator(); iter.hasNext();)
{
Class type = (Class) iter.next();
final TypeDescriptor typeDescriptor = TypeDescriptor.get(type);
-
- final List modifyColumnCandidates = CollectionUtils.newArrayList();
-
- List persistentFields = typeDescriptor.getPersistentFields();
- for (Iterator fieldIter = persistentFields.iterator(); fieldIter.hasNext();)
+ try
{
- FieldDescriptor fieldDscr = (FieldDescriptor) fieldIter.next();
- Class fieldType = fieldDscr.getField().getType();
- int length = fieldDscr.getLength();
- if (String.class.isAssignableFrom(fieldType) && Integer.MAX_VALUE != length)
+ if (ddlManager.containsTable(typeDescriptor.getSchemaName(),
+ typeDescriptor.getTableName(), item.getConnection()))
{
- modifyColumnCandidates.add(new FieldInfo(fieldDscr.getField().getName(),
- String.class, length));
+ final List modifyColumnCandidates = CollectionUtils.newArrayList();
+
+ List persistentFields = typeDescriptor.getPersistentFields();
+ for (Iterator fieldIter = persistentFields.iterator(); fieldIter
+ .hasNext();)
+ {
+ FieldDescriptor fieldDscr = (FieldDescriptor) fieldIter.next();
+ Class fieldType = fieldDscr.getField().getType();
+ int length = fieldDscr.getLength();
+ if (String.class.isAssignableFrom(fieldType)
+ && Integer.MAX_VALUE != length)
+ {
+ modifyColumnCandidates.add(new FieldInfo(fieldDscr.getField()
+ .getName(), String.class, length));
+ }
+ }
+
+ if (!modifyColumnCandidates.isEmpty())
+ {
+ DatabaseHelper.alterTable(item,
+ new AlterTableInfo(typeDescriptor.getTableName())
+ {
+ public FieldInfo[] getModifiedFields()
+ {
+ return (FieldInfo[]) modifyColumnCandidates
+ .toArray(new FieldInfo[modifyColumnCandidates
+ .size()]);
+ }
+
+ }, this);
+ }
}
}
-
- if ( !modifyColumnCandidates.isEmpty())
+ catch (SQLException e)
{
- DatabaseHelper.alterTable(item, new AlterTableInfo(typeDescriptor
- .getTableName())
- {
- public FieldInfo[] getModifiedFields()
- {
- return (FieldInfo[]) modifyColumnCandidates
- .toArray(new FieldInfo[modifyColumnCandidates.size()]);
- }
-
- }, this);
+ error("Failed determining the tables to modify.", e);
}
}
}
+
DatabaseHelper.alterTable(item, new AlterTableInfo(LOG_ENTRY_TABLE_NAME)
{
- private final FieldInfo ACTIVITY_INSTANCE = new FieldInfo(
- LOG_ENTRY_AI_COLUMN, Long.TYPE, 0, false);
- private final FieldInfo PROCESS_INSTANCE = new FieldInfo(
- LOG_ENTRY_PI_COLUMN, Long.TYPE, 0, false);
-
+ private final FieldInfo ACTIVITY_INSTANCE = new FieldInfo(LOG_ENTRY_AI_COLUMN,
+ Long.TYPE, 0, false);
+
+ private final FieldInfo PROCESS_INSTANCE = new FieldInfo(LOG_ENTRY_PI_COLUMN,
+ Long.TYPE, 0, false);
+
public IndexInfo[] getAddedIndexes()
{
- return new IndexInfo[] {//
- new IndexInfo("log_entry_idx2", false, new FieldInfo[] { ACTIVITY_INSTANCE }),
- new IndexInfo("log_entry_idx3", false, new FieldInfo[] { PROCESS_INSTANCE })};
+ return new IndexInfo[] {//
+ new IndexInfo("log_entry_idx2", false,
+ new FieldInfo[] {ACTIVITY_INSTANCE}),
+ new IndexInfo("log_entry_idx3", false,
+ new FieldInfo[] {PROCESS_INSTANCE})};
}
}, this);
}