summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/utils')
-rw-r--r--src/main/java/com/c2kernel/utils/LocalObjectLoader.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java
index 05f8aba..307cd97 100644
--- a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java
+++ b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java
@@ -1,11 +1,14 @@
package com.c2kernel.utils;
+import java.util.Enumeration;
+
import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.lifecycle.ActivityDef;
import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
import com.c2kernel.lookup.DomainPath;
+import com.c2kernel.lookup.Path;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.outcome.Schema;
@@ -20,8 +23,29 @@ public class LocalObjectLoader {
throws ObjectNotFoundException
{
DomainPath defRoot = new DomainPath(root);
- DomainPath defPath = (DomainPath)defRoot.find(name);
- return Gateway.getProxyManager().getProxy(defPath);
+ Enumeration<Path> e = Gateway.getLDAPLookup().search(defRoot, name);
+ ItemProxy defProxy = null; int currentLayer = -1;
+ while (e.hasMoreElements()) {
+ DomainPath defPath = (DomainPath)e.nextElement();
+ ItemProxy thisProxy = Gateway.getProxyManager().getProxy(defPath);
+ int thisLayer;
+ try {
+ String thisLayerProp = thisProxy.getProperty("Layer");
+ thisLayer = Integer.parseInt(thisLayerProp);
+ } catch (Exception ex) {
+ thisLayer = 0;
+ }
+ if (thisLayer > currentLayer) {
+ currentLayer = thisLayer;
+ defProxy = thisProxy;
+ }
+ else if (thisLayer == currentLayer) {
+ throw new ObjectNotFoundException("Duplicate definition for "+name+" in "+root+" found in Layer "+thisLayer, "");
+ }
+ }
+ if (defProxy == null)
+ throw new ObjectNotFoundException("No match for "+name+" in "+root, "");
+ return defProxy;
}
static public String getScript(String scriptName, int scriptVersion) throws ObjectNotFoundException {