wlu: updated
diff --git a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java
index 0700736..95a6a0e 100644
--- a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java
+++ b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java
@@ -21,6 +21,7 @@
import org.eclipse.epf.uma.MethodElement;
import org.eclipse.epf.uma.MethodLibrary;
import org.eclipse.epf.uma.MethodPlugin;
+import org.eclipse.epf.uma.ProcessElement;
import org.eclipse.epf.uma.ProcessPackage;
/**
@@ -88,7 +89,24 @@
return getMethodConfiguration(lib, firstPath);
}
- public static ProcessPackage getBreakdownElementParent(MethodLibrary lib,
+ public static ProcessElement getProcessElement(MethodLibrary lib, String path) {
+ int ix = path.lastIndexOf("/");
+ String parentPath = path.substring(0, ix);
+ String name = path.substring(ix);
+
+ ProcessPackage outerParent = getProcessElementParent(lib, parentPath, name);
+
+ Map nameMap = getMethodElementNameMap(outerParent.getChildPackages());
+ ProcessPackage innerParent = (ProcessPackage) nameMap.get(name);
+ List pes = innerParent.getProcessElements();
+ if (pes.size() != 1) {
+ System.out.println("LD> pes.size() != 1");
+ }
+
+ return (ProcessElement) pes.get(0);
+ }
+
+ public static ProcessPackage getProcessElementParent(MethodLibrary lib,
String parentPath, String beName) {
if (parentPath == null || parentPath.length() == 0) {
return null;
diff --git a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCEditMethodElementBase.java b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCEditMethodElementBase.java
index 83ac6b9..fe25a5f 100644
--- a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCEditMethodElementBase.java
+++ b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCEditMethodElementBase.java
@@ -23,7 +23,6 @@
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.epf.library.tester.LibraryTestService;
import org.eclipse.epf.library.tester.TesterOutputUtil;
import org.eclipse.epf.library.tester.iface.TCExeReply;
import org.eclipse.epf.library.tester.iface.TestCommand;
@@ -32,7 +31,8 @@
import org.eclipse.epf.uma.DescribableElement;
import org.eclipse.epf.uma.MethodElement;
import org.eclipse.epf.uma.MethodLibrary;
-import org.eclipse.epf.uma.MethodPlugin;
+import org.eclipse.epf.uma.ProcessElement;
+import org.eclipse.epf.uma.UmaFactory;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -212,7 +212,11 @@
MethodLibrary currLib = getOwner().getCurrentBaseLib();
String path = getAttribute(AT_Path);
if (methodElement == null) {
- methodElement = (MethodElement) TesterOutputUtil.getMethodElement(currLib, path);
+ if (UmaFactory.eINSTANCE.create(eclass) instanceof ProcessElement) {
+ methodElement = TesterOutputUtil.getProcessElement(currLib, path);
+ } else {
+ methodElement = TesterOutputUtil.getMethodElement(currLib, path);
+ }
}
if (methodElement == null) {
return null;
diff --git a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java
index d804bfa..3028375 100644
--- a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java
+++ b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java
@@ -35,6 +35,7 @@
import org.eclipse.epf.uma.MethodPackage;
import org.eclipse.epf.uma.MethodPlugin;
import org.eclipse.epf.uma.ProcessComponent;
+import org.eclipse.epf.uma.ProcessElement;
import org.eclipse.epf.uma.ProcessPackage;
import org.eclipse.epf.uma.UmaFactory;
import org.eclipse.epf.uma.UmaPackage;
@@ -111,7 +112,7 @@
private TCExeReply addToLib(String parentPath, MethodElement me) {
if (me instanceof BreakdownElement) {
- return addBeToLib(parentPath, (BreakdownElement) me);
+ return addBeToLib(parentPath, (ProcessElement) me);
}
MethodLibrary currLib = getOwner().getCurrentBaseLib();
MethodElement parentMe = TesterOutputUtil.getMethodElement(currLib, parentPath);
@@ -126,23 +127,23 @@
return null;
}
- private TCExeReply addBeToLib(String parentPath, BreakdownElement be) {
+ private TCExeReply addBeToLib(String parentPath, ProcessElement pe) {
MethodLibrary currLib = getOwner().getCurrentBaseLib();
- ProcessPackage parentMe = TesterOutputUtil.getBreakdownElementParent(currLib, parentPath, be.getName());
+ ProcessPackage parentMe = TesterOutputUtil.getProcessElementParent(currLib, parentPath, pe.getName());
if (parentMe == null) {
return new TCExeReplyImpl("parentMe == null", false);
}
- if (be instanceof CapabilityPattern) {
- CapabilityPattern cp = (CapabilityPattern) be;
+ if (pe instanceof CapabilityPattern) {
+ CapabilityPattern cp = (CapabilityPattern) pe;
//cp.setDefaultContext(defaultConfig);
ProcessComponent pc = UmaFactory.eINSTANCE.createProcessComponent();
pc.setGuid(EcoreUtil.generateUUID());
- pc.setName(be.getName());
+ pc.setName(pe.getName());
parentMe.getChildPackages().add(pc);
pc.setProcess(cp);
- addToParent(be, pc);
+ addToParent(pe, pc);
}
save(parentMe);