summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-07-12 02:56:55 (EDT)
committer Manik Kishore2012-07-19 01:37:38 (EDT)
commit449897d7bf9e8c0d56b1d40ce5bddacdcc1f44ae (patch)
tree6bb8a1f85fc5c1b9a83f5a644abcee165c769175
parent2d31ab0aaad3709fccd7df2391c7e421d35b0e0e (diff)
downloadorg.eclipse.stardust.ide-449897d7bf9e8c0d56b1d40ce5bddacdcc1f44ae.zip
org.eclipse.stardust.ide-449897d7bf9e8c0d56b1d40ce5bddacdcc1f44ae.tar.gz
org.eclipse.stardust.ide-449897d7bf9e8c0d56b1d40ce5bddacdcc1f44ae.tar.bz2
CRNT-25134 Pepper: Cross-Model Support: Refactor Model Service
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@57601 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/strategy/SimpleManagementStrategy.java61
1 files changed, 26 insertions, 35 deletions
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/strategy/SimpleManagementStrategy.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/strategy/SimpleManagementStrategy.java
index 3834ccc..586983f 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/strategy/SimpleManagementStrategy.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/strategy/SimpleManagementStrategy.java
@@ -1,7 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
package org.eclipse.stardust.model.xpdl.builder.strategy;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.eclipse.stardust.engine.api.runtime.DmsUtils;
import org.eclipse.stardust.engine.api.runtime.Document;
@@ -26,28 +39,17 @@ public class SimpleManagementStrategy extends
private ServiceFactory serviceFactory;
private DocumentManagementService documentManagementService;
+ private List<ModelType> models = new ArrayList<ModelType>();
+
+ public Map<String, ModelType> getModels()
+ {
+ return getModels(true);
+ }
/**
*
*/
public List<ModelType> loadModels() {
-
- List<ModelType> models = new ArrayList<ModelType>();
- List<Document> candidateModelDocuments = getDocumentManagementService()
- .getFolder(MODELS_DIR).getDocuments();
-
- XpdlModelIoUtils.clearModelsMap();
-
- for (Document modelDocument : candidateModelDocuments) {
- if (modelDocument.getName().endsWith(".xpdl")) {
-
- ModelType model = XpdlModelIoUtils
- .loadModel(readModelContext(modelDocument));
-
- getModels().put(model.getId(), model);
- }
- }
-
return models;
}
@@ -55,19 +57,12 @@ public class SimpleManagementStrategy extends
*
*/
public ModelType loadModel(String id) {
-
- Folder folder = documentManagementService.getFolder(MODELS_DIR);
- List<Document> candidateModelDocuments = folder.getDocuments();
- for (Document modelDocument : candidateModelDocuments) {
- if (modelDocument.getName().endsWith(".xpdl"))
- {
- if(modelDocument.getName().equals(id))
- {
- return XpdlModelIoUtils
- .loadModel(readModelContext(modelDocument));
- }
+ for (Iterator<ModelType> i = models.iterator(); i.hasNext();) {
+ ModelType model = i.next();
+ if (model.getId().equalsIgnoreCase(id)) {
+ return model;
}
- }
+ }
return null;
}
@@ -77,12 +72,8 @@ public class SimpleManagementStrategy extends
*
*/
public ModelType attachModel(String id) {
- ModelType model = XpdlModelIoUtils
- .loadModel(readModelContext(getDocumentManagementService()
- .getDocument(MODELS_DIR + id + ".xpdl")));
-
- getModels().put(id, model);
-
+ ModelType model = this.loadModel(id);
+ models.add(model);
return model;
}