summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-06-11 09:14:04 (EDT)
committerManik Kishore2012-06-12 04:19:07 (EDT)
commitb5cb4087f7e4658e01e0f96c03d2144542572540 (patch)
tree5ad61ddd7d42fbf0528fd9616028a289ef73e13c
parent5f86b5539ce950c7ff444e7ee8047c2526bf7e5f (diff)
downloadorg.eclipse.stardust.engine-b5cb4087f7e4658e01e0f96c03d2144542572540.zip
org.eclipse.stardust.engine-b5cb4087f7e4658e01e0f96c03d2144542572540.tar.gz
org.eclipse.stardust.engine-b5cb4087f7e4658e01e0f96c03d2144542572540.tar.bz2
Jira-ID: CRNT-25028
Merge changes done on b_dev_6_0_x after 6.0.3.GA (6.0.3.6-r50668) through 6.0.4.GA (6.0.4.4-r55537) to 7.0 (trunk) - kernel git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@56967 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/dto/DeployedModelDescriptionDetails.java21
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/ModelRefBean.java34
2 files changed, 41 insertions, 14 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/dto/DeployedModelDescriptionDetails.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/dto/DeployedModelDescriptionDetails.java
index 2cbb57a..f7f8ddc 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/dto/DeployedModelDescriptionDetails.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/dto/DeployedModelDescriptionDetails.java
@@ -73,21 +73,14 @@ public class DeployedModelDescriptionDetails extends ModelElementDetails
// Retrieving Consumer Models
consumerModels = new ArrayList<Long>();
List<IModel> usingModels = new ArrayList<IModel>();
- for (Iterator<IModel> i = modelManager.getAllModels(); i.hasNext();)
+ List<IModel> models = ModelRefBean.getUsingModels(model);
+ for (Iterator<IModel> j = models.iterator(); j.hasNext();)
{
- IModel usingModel = i.next();
- List<IModel> usedModels = ModelRefBean.getUsedModels(usingModel);
- for (Iterator<IModel> j = usedModels.iterator(); j.hasNext();)
- {
- IModel usedModel = j.next();
- if (model.getModelOID() != usingModel.getModelOID())
- {
- if (model.getModelOID() == usedModel.getModelOID())
- {
- consumerModels.add(new Integer(usingModel.getModelOID()).longValue());
- usingModels.add(usingModel);
- }
- }
+ IModel usingModel = j.next();
+ if (model.getModelOID() != usingModel.getModelOID())
+ {
+ consumerModels.add(new Integer(usingModel.getModelOID()).longValue());
+ usingModels.add(usingModel);
}
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/ModelRefBean.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/ModelRefBean.java
index e5e3b4f..277271f 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/ModelRefBean.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/ModelRefBean.java
@@ -249,6 +249,40 @@ public class ModelRefBean extends PersistentBean implements Serializable
QueryUtils.closeResultSet(resultSet);
}
}
+
+ public static List<IModel> getUsingModels(IModel model)
+ {
+ Session session = (Session) SessionFactory.getSession(SessionFactory.AUDIT_TRAIL);
+ ComparisonTerm typePredicate = Predicates.isEqual(FR__CODE, TYPE.USES.ordinal());
+ ComparisonTerm modelPredicate = Predicates.isEqual(FR__REF_OID, model.getModelOID());
+ QueryDescriptor query = QueryDescriptor.from(ModelRefBean.class)
+ .select(FIELD__MODEL_OID)
+ .where(Predicates.andTerm(typePredicate, modelPredicate));
+ ResultSet resultSet = session.executeQuery(query);
+ try
+ {
+ ModelManager manager = ModelManagerFactory.getCurrent();
+ List<IModel> result = CollectionUtils.newList();
+ while (resultSet.next())
+ {
+ IModel using = manager.findModel(resultSet.getLong(1));
+ if (using != null)
+ {
+ result.add(using);
+ }
+ }
+ return result;
+ }
+ catch (SQLException e)
+ {
+ trace.warn("Failed executing query.", e);
+ throw new PublicException(e);
+ }
+ finally
+ {
+ QueryUtils.closeResultSet(resultSet);
+ }
+ }
public static IModel resolveModel(IExternalPackage reference) throws UnresolvedExternalReference
{