Fix bug where object prototypes where stored by lower case
prototype name instead of as-is prototype name. some cleanup of prototype object handling.
This commit is contained in:
parent
c4fa72c66e
commit
8f39946692
1 changed files with 21 additions and 8 deletions
|
@ -829,12 +829,15 @@ public class RequestEvaluator implements Runnable {
|
||||||
|
|
||||||
|
|
||||||
public ESObject getElementWrapper (IPathElement e) {
|
public ESObject getElementWrapper (IPathElement e) {
|
||||||
|
|
||||||
if (e instanceof INode)
|
if (e instanceof INode)
|
||||||
return getNodeWrapper ((INode) e);
|
return getNodeWrapper ((INode) e);
|
||||||
|
|
||||||
String protoname = e.getPrototype ();
|
String protoname = e.getPrototype ();
|
||||||
|
|
||||||
ObjectPrototype op = (ObjectPrototype) prototypes.get (protoname);
|
ObjectPrototype op = getPrototype (protoname);
|
||||||
|
if (op == null)
|
||||||
|
op = esNodePrototype;
|
||||||
|
|
||||||
return new ESGenericObject (op, evaluator, e);
|
return new ESGenericObject (op, evaluator, e);
|
||||||
}
|
}
|
||||||
|
@ -861,12 +864,11 @@ public class RequestEvaluator implements Runnable {
|
||||||
n.setDbMapping (app.getDbMapping (protoname));
|
n.setDbMapping (app.getDbMapping (protoname));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
op = getPrototype (protoname);
|
||||||
op = (ObjectPrototype) prototypes.get (protoname);
|
|
||||||
} catch (Exception ignore) {}
|
|
||||||
|
|
||||||
|
// no prototype found for this node?
|
||||||
if (op == null)
|
if (op == null)
|
||||||
op = esNodePrototype; // no prototype found for this node.
|
op = esNodePrototype;
|
||||||
|
|
||||||
esn = new ESNode (op, evaluator, n, this);
|
esn = new ESNode (op, evaluator, n, this);
|
||||||
|
|
||||||
|
@ -877,7 +879,9 @@ public class RequestEvaluator implements Runnable {
|
||||||
return esn;
|
return esn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a scripting wrapper object for a user object. Active user objects use different wrapper classes.
|
||||||
|
*/
|
||||||
public ESNode getNodeWrapper (User u) {
|
public ESNode getNodeWrapper (User u) {
|
||||||
if (u == null)
|
if (u == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -896,12 +900,21 @@ public class RequestEvaluator implements Runnable {
|
||||||
return esn;
|
return esn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the object prototype for a prototype name
|
||||||
|
*/
|
||||||
public ObjectPrototype getPrototype (String protoName) {
|
public ObjectPrototype getPrototype (String protoName) {
|
||||||
return (ObjectPrototype) prototypes.get (protoName.toLowerCase ());
|
if (protoName == null)
|
||||||
|
return null;
|
||||||
|
return (ObjectPrototype) prototypes.get (protoName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an object prototype for a certain prototype name.
|
||||||
|
*/
|
||||||
public void putPrototype (String protoName, ObjectPrototype op) {
|
public void putPrototype (String protoName, ObjectPrototype op) {
|
||||||
prototypes.put (protoName.toLowerCase (), op);
|
if (protoName != null && op != null)
|
||||||
|
prototypes.put (protoName, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue