summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2012-12-11 05:33:00 (EST)
committer Stephan Born2012-12-11 05:33:00 (EST)
commit939b3fcb91779a3c6a01dedd884922cd3b29a92d (patch)
tree85ccf8548fa9b48bab61ae0284d8bc3f55565f5e
parent6f81794652075fc9f99671ca775dc8b58b951b56 (diff)
downloadorg.eclipse.stardust.engine-939b3fcb91779a3c6a01dedd884922cd3b29a92d.zip
org.eclipse.stardust.engine-939b3fcb91779a3c6a01dedd884922cd3b29a92d.tar.gz
org.eclipse.stardust.engine-939b3fcb91779a3c6a01dedd884922cd3b29a92d.tar.bz2
Jira-ID: CRNT-27188
'AdminServiceUtils.deleteModelRuntimePart(...)' unnecessarily loads persistents from the database prior to deletion git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@61517 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdminServiceUtils.java40
1 files changed, 30 insertions, 10 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdminServiceUtils.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdminServiceUtils.java
index 14c9bdd..58a3789 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdminServiceUtils.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdminServiceUtils.java
@@ -10,11 +10,15 @@
*******************************************************************************/
package org.eclipse.stardust.engine.core.runtime.beans;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.*;
import org.eclipse.stardust.common.CollectionUtils;
+import org.eclipse.stardust.common.error.PublicException;
import org.eclipse.stardust.engine.api.model.IData;
import org.eclipse.stardust.engine.api.model.IModel;
+import org.eclipse.stardust.engine.core.persistence.Column;
import org.eclipse.stardust.engine.core.persistence.ComparisonTerm;
import org.eclipse.stardust.engine.core.persistence.Join;
import org.eclipse.stardust.engine.core.persistence.Joins;
@@ -22,7 +26,6 @@ import org.eclipse.stardust.engine.core.persistence.PredicateTerm;
import org.eclipse.stardust.engine.core.persistence.Predicates;
import org.eclipse.stardust.engine.core.persistence.QueryDescriptor;
import org.eclipse.stardust.engine.core.persistence.QueryExtension;
-import org.eclipse.stardust.engine.core.persistence.ResultIterator;
import org.eclipse.stardust.engine.core.persistence.jdbc.Session;
import org.eclipse.stardust.engine.core.preferences.PreferenceScope;
import org.eclipse.stardust.engine.core.runtime.audittrail.management.ProcessInstanceUtils;
@@ -227,17 +230,34 @@ public class AdminServiceUtils
session.delete(ProcessInstanceScopeBean.class, predicate, false);
// deleting rows from data clusters
- ResultIterator piIterator = session.getIterator(ProcessInstanceBean.class, QueryExtension.where(Predicates.andTerm(
- Predicates.isEqual(ProcessInstanceBean.FR__MODEL, modelOid),
- Predicates.isEqual(ProcessInstanceBean.FR__PROCESS_DEFINITION, pdOid))));
- List piOids = new ArrayList();
- for (Iterator iterator = piIterator; iterator.hasNext();)
+ if (session.isUsingDataClusters())
{
- IProcessInstance pi = (IProcessInstance) iterator.next();
- piOids.add(new Long(pi.getOID()));
+ List<Long> piOids = CollectionUtils.newList();
+ QueryDescriptor queryDescriptor = QueryDescriptor
+ .from(ProcessInstanceBean.class)
+ .select(new Column[] {ProcessInstanceBean.FR__OID})
+ .where(
+ Predicates.andTerm(Predicates.isEqual(
+ ProcessInstanceBean.FR__MODEL, modelOid), Predicates
+ .isEqual(ProcessInstanceBean.FR__PROCESS_DEFINITION, pdOid)));
+ ResultSet resultSet = session.executeQuery(queryDescriptor);
+ try
+ {
+ while (resultSet.next())
+ {
+ long piOid = resultSet.getLong(ProcessInstanceBean.FIELD__OID);
+ piOids.add(piOid);
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new PublicException(
+ "Failed retrieving process instances oids for process definition with oid "
+ + pdOid, e);
+ }
+ ProcessInstanceUtils.deleteDataClusterValues(piOids, session);
}
- ProcessInstanceUtils.deleteDataClusterValues(piOids, session);
-
+
// process_instance
session.delete(ProcessInstanceBean.class, Predicates.andTerm(
Predicates.isEqual(ProcessInstanceBean.FR__MODEL, modelOid),