JavaScript AVM API enhancements. Template AVM API addition.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6049 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-06-21 11:59:52 +00:00
parent cefaf59d7b
commit fd36b00448
5 changed files with 293 additions and 21 deletions

View File

@@ -48,36 +48,35 @@ public class AVMNode extends ScriptNode
private AVMNodeDescriptor avmRef;
private QName type;
/**
* Constructor
*
* @param nodeRef
* @param services
* @param resolver
*/
public AVMNode(NodeRef nodeRef, ServiceRegistry services)
{
this(nodeRef, services, null);
}
/**
* Constructor
*
* @param nodeRef
* @param services
* @param resolver
* @param scope
*/
public AVMNode(NodeRef nodeRef, ServiceRegistry services, Scriptable scope)
{
super(nodeRef, services, scope);
Pair<Integer, String> versionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
this.path = versionPath.getSecond();
this.version = versionPath.getFirst();
AVMNodeDescriptor descriptor = this.services.getAVMService().lookup(this.version, this.path, true);
init(versionPath.getSecond(), versionPath.getFirst());
}
public AVMNode(String path, int version, ServiceRegistry services, Scriptable scope)
{
super(AVMNodeConverter.ToNodeRef(version, path), services, scope);
init(path, version);
}
private void init(String path, int version)
{
this.path = path;
this.version = version;
AVMNodeDescriptor descriptor = this.services.getAVMService().lookup(version, path, true);
if (descriptor == null)
{
throw new IllegalArgumentException("Invalid node specified: " + nodeRef.toString());
throw new IllegalArgumentException("Invalid node specified: " + this.nodeRef.toString());
}
this.avmRef = descriptor;
this.deleted = descriptor.isDeleted();