Script specific Node class renamed to ScriptNode.

SVN rename command used to ensure file history is kept.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5920 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-06-12 15:10:48 +00:00
parent 4c6a93a5a9
commit f074450627
17 changed files with 148 additions and 148 deletions

View File

@@ -40,7 +40,7 @@ import org.mozilla.javascript.Scriptable;
* *
* @author Kevin Roast * @author Kevin Roast
*/ */
public class AVMNode extends Node public class AVMNode extends ScriptNode
{ {
private String path; private String path;
private int version; private int version;
@@ -87,12 +87,12 @@ public class AVMNode extends Node
* Factory methods * Factory methods
*/ */
@Override @Override
public Node newInstance(NodeRef nodeRef, ServiceRegistry services, Scriptable scope) public ScriptNode newInstance(NodeRef nodeRef, ServiceRegistry services, Scriptable scope)
{ {
return new AVMNode(nodeRef, services, scope); return new AVMNode(nodeRef, services, scope);
} }
public Node newInstance(String path, int version, ServiceRegistry services, Scriptable scope) public ScriptNode newInstance(String path, int version, ServiceRegistry services, Scriptable scope)
{ {
return new AVMNode(AVMNodeConverter.ToNodeRef(version, path), services, scope); return new AVMNode(AVMNodeConverter.ToNodeRef(version, path), services, scope);
} }
@@ -186,7 +186,7 @@ public class AVMNode extends Node
* @return the copy of this node * @return the copy of this node
*/ */
@Override @Override
public Node copy(Node destination) public ScriptNode copy(ScriptNode destination)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
@@ -200,7 +200,7 @@ public class AVMNode extends Node
* *
* @return the copy of this node * @return the copy of this node
*/ */
public Node copy(String destination) public ScriptNode copy(String destination)
{ {
ParameterCheck.mandatoryString("Destination Path", destination); ParameterCheck.mandatoryString("Destination Path", destination);
@@ -218,7 +218,7 @@ public class AVMNode extends Node
* @return true on successful move, false on failure to move. * @return true on successful move, false on failure to move.
*/ */
@Override @Override
public boolean move(Node destination) public boolean move(ScriptNode destination)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);

View File

@@ -90,22 +90,22 @@ public class Association implements Scopeable, Serializable
return getType(); return getType();
} }
public Node getSource() public ScriptNode getSource()
{ {
return (Node)new ValueConverter().convertValueForScript(this.services, this.scope, null, assocRef.getSourceRef()); return (ScriptNode)new ValueConverter().convertValueForScript(this.services, this.scope, null, assocRef.getSourceRef());
} }
public Node jsGet_source() public ScriptNode jsGet_source()
{ {
return getSource(); return getSource();
} }
public Node getTarget() public ScriptNode getTarget()
{ {
return (Node)new ValueConverter().convertValueForScript(this.services, this.scope, null, assocRef.getTargetRef()); return (ScriptNode)new ValueConverter().convertValueForScript(this.services, this.scope, null, assocRef.getTargetRef());
} }
public Node jsGet_target() public ScriptNode jsGet_target()
{ {
return getTarget(); return getTarget();
} }

View File

@@ -39,7 +39,7 @@ import org.mozilla.javascript.Scriptable;
* *
* @author Andy Hind * @author Andy Hind
*/ */
public class CategoryNode extends Node public class CategoryNode extends ScriptNode
{ {
/** /**
* Constructor * Constructor
@@ -69,12 +69,12 @@ public class CategoryNode extends Node
/** /**
* @return all the members of a category * @return all the members of a category
*/ */
public Node[] getCategoryMembers() public ScriptNode[] getCategoryMembers()
{ {
return buildNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.MEMBERS, CategoryService.Depth.ANY)); return buildNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.MEMBERS, CategoryService.Depth.ANY));
} }
public Node[] jsGet_categoryMembers() public ScriptNode[] jsGet_categoryMembers()
{ {
return getCategoryMembers(); return getCategoryMembers();
} }
@@ -95,12 +95,12 @@ public class CategoryNode extends Node
/** /**
* @return members and subcategories of a category * @return members and subcategories of a category
*/ */
public Node[] getMembersAndSubCategories() public ScriptNode[] getMembersAndSubCategories()
{ {
return buildMixedNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.ALL, CategoryService.Depth.ANY)); return buildMixedNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.ALL, CategoryService.Depth.ANY));
} }
public Node[] jsGet_membersAndSubCategories() public ScriptNode[] jsGet_membersAndSubCategories()
{ {
return getMembersAndSubCategories(); return getMembersAndSubCategories();
} }
@@ -108,12 +108,12 @@ public class CategoryNode extends Node
/** /**
* @return all the immediate member of a category * @return all the immediate member of a category
*/ */
public Node[] getImmediateCategoryMembers() public ScriptNode[] getImmediateCategoryMembers()
{ {
return buildNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.MEMBERS, CategoryService.Depth.IMMEDIATE)); return buildNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.MEMBERS, CategoryService.Depth.IMMEDIATE));
} }
public Node[] jsGet_immediateCategoryMembers() public ScriptNode[] jsGet_immediateCategoryMembers()
{ {
return getImmediateCategoryMembers(); return getImmediateCategoryMembers();
} }
@@ -134,12 +134,12 @@ public class CategoryNode extends Node
/** /**
* @return immediate members and subcategories of a category * @return immediate members and subcategories of a category
*/ */
public Node[] getImmediateMembersAndSubCategories() public ScriptNode[] getImmediateMembersAndSubCategories()
{ {
return buildMixedNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.ALL, CategoryService.Depth.IMMEDIATE)); return buildMixedNodes(services.getCategoryService().getChildren(getNodeRef(), CategoryService.Mode.ALL, CategoryService.Depth.IMMEDIATE));
} }
public Node[] jsGet_immediateMembersAndSubCategories() public ScriptNode[] jsGet_immediateMembersAndSubCategories()
{ {
return getImmediateMembersAndSubCategories(); return getImmediateMembersAndSubCategories();
} }
@@ -181,20 +181,20 @@ public class CategoryNode extends Node
return categoryNodes; return categoryNodes;
} }
private Node[] buildNodes(Collection<ChildAssociationRef> cars) private ScriptNode[] buildNodes(Collection<ChildAssociationRef> cars)
{ {
Node[] nodes = new Node[cars.size()]; ScriptNode[] nodes = new ScriptNode[cars.size()];
int i = 0; int i = 0;
for (ChildAssociationRef car : cars) for (ChildAssociationRef car : cars)
{ {
nodes[i++] = new Node(car.getChildRef(), this.services, this.scope); nodes[i++] = new ScriptNode(car.getChildRef(), this.services, this.scope);
} }
return nodes; return nodes;
} }
private Node[] buildMixedNodes(Collection<ChildAssociationRef> cars) private ScriptNode[] buildMixedNodes(Collection<ChildAssociationRef> cars)
{ {
Node[] nodes = new Node[cars.size()]; ScriptNode[] nodes = new ScriptNode[cars.size()];
int i = 0; int i = 0;
for (ChildAssociationRef car : cars) for (ChildAssociationRef car : cars)
{ {
@@ -205,7 +205,7 @@ public class CategoryNode extends Node
} }
else else
{ {
nodes[i++] = new Node(car.getChildRef(), this.services, this.scope); nodes[i++] = new ScriptNode(car.getChildRef(), this.services, this.scope);
} }
} }
return nodes; return nodes;

View File

@@ -106,22 +106,22 @@ public class ChildAssociation implements Scopeable, Serializable
return getName(); return getName();
} }
public Node getParent() public ScriptNode getParent()
{ {
return (Node)new ValueConverter().convertValueForScript(this.services, this.scope, null, childAssocRef.getParentRef()); return (ScriptNode)new ValueConverter().convertValueForScript(this.services, this.scope, null, childAssocRef.getParentRef());
} }
public Node jsGet_parent() public ScriptNode jsGet_parent()
{ {
return getParent(); return getParent();
} }
public Node getChild() public ScriptNode getChild()
{ {
return (Node)new ValueConverter().convertValueForScript(this.services, this.scope, null, childAssocRef.getChildRef()); return (ScriptNode)new ValueConverter().convertValueForScript(this.services, this.scope, null, childAssocRef.getChildRef());
} }
public Node jsGet_child() public ScriptNode jsGet_child()
{ {
return getChild(); return getChild();
} }

View File

@@ -68,13 +68,13 @@ public final class CrossRepositoryCopy extends BaseScopableProcessorExtension
* *
* @throws org.alfresco.error.AlfrescoRuntimeException on copy error * @throws org.alfresco.error.AlfrescoRuntimeException on copy error
*/ */
public Node copy(Node src, Node dest, String name) public ScriptNode copy(ScriptNode src, ScriptNode dest, String name)
{ {
ParameterCheck.mandatory("Node source", src); ParameterCheck.mandatory("Node source", src);
ParameterCheck.mandatory("Node destination", dest); ParameterCheck.mandatory("Node destination", dest);
ParameterCheck.mandatory("Node destination name", name); ParameterCheck.mandatory("Node destination name", name);
Node result = null; ScriptNode result = null;
// perform the copy operation using the repository service // perform the copy operation using the repository service
this.services.getCrossRepositoryCopyService().copy(src.getNodeRef(), dest.getNodeRef(), name); this.services.getCrossRepositoryCopyService().copy(src.getNodeRef(), dest.getNodeRef(), name);

View File

@@ -83,15 +83,15 @@ public final class People extends BaseScopableProcessorExtension
* @param username the username of the person to get * @param username the username of the person to get
* @return the person node (type cm:person) or null if no such person exists * @return the person node (type cm:person) or null if no such person exists
*/ */
public Node getPerson(String username) public ScriptNode getPerson(String username)
{ {
ParameterCheck.mandatoryString("Username", username); ParameterCheck.mandatoryString("Username", username);
Node person = null; ScriptNode person = null;
PersonService personService = services.getPersonService(); PersonService personService = services.getPersonService();
if (personService.personExists(username)) if (personService.personExists(username))
{ {
NodeRef personRef = personService.getPerson(username); NodeRef personRef = personService.getPerson(username);
person = new Node(personRef, services, getScope()); person = new ScriptNode(personRef, services, getScope());
} }
return person; return person;
} }
@@ -102,14 +102,14 @@ public final class People extends BaseScopableProcessorExtension
* @param groupName name of group to get * @param groupName name of group to get
* @return the group node (type usr:authorityContainer) or null if no such group exists * @return the group node (type usr:authorityContainer) or null if no such group exists
*/ */
public Node getGroup(String groupName) public ScriptNode getGroup(String groupName)
{ {
ParameterCheck.mandatoryString("GroupName", groupName); ParameterCheck.mandatoryString("GroupName", groupName);
Node group = null; ScriptNode group = null;
NodeRef groupRef = authorityDAO.getAuthorityNodeRefOrNull(groupName); NodeRef groupRef = authorityDAO.getAuthorityNodeRefOrNull(groupName);
if (groupRef != null) if (groupRef != null)
{ {
group = new Node(groupRef, services, getScope()); group = new ScriptNode(groupRef, services, getScope());
} }
return group; return group;
} }
@@ -119,7 +119,7 @@ public final class People extends BaseScopableProcessorExtension
* *
* @param group The group to delete * @param group The group to delete
*/ */
public void deleteGroup(Node group) public void deleteGroup(ScriptNode group)
{ {
ParameterCheck.mandatory("Group", group); ParameterCheck.mandatory("Group", group);
if (group.getType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER)) if (group.getType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER))
@@ -136,7 +136,7 @@ public final class People extends BaseScopableProcessorExtension
* *
* @return the group reference if successful or null if failed * @return the group reference if successful or null if failed
*/ */
public Node createGroup(String groupName) public ScriptNode createGroup(String groupName)
{ {
return createGroup(null, groupName); return createGroup(null, groupName);
} }
@@ -149,11 +149,11 @@ public final class People extends BaseScopableProcessorExtension
* *
* @return the group reference if successful or null if failed * @return the group reference if successful or null if failed
*/ */
public Node createGroup(Node parentGroup, String groupName) public ScriptNode createGroup(ScriptNode parentGroup, String groupName)
{ {
ParameterCheck.mandatoryString("GroupName", groupName); ParameterCheck.mandatoryString("GroupName", groupName);
Node group = null; ScriptNode group = null;
String actualName = services.getAuthorityService().getName(AuthorityType.GROUP, groupName); String actualName = services.getAuthorityService().getName(AuthorityType.GROUP, groupName);
if (authorityService.authorityExists(groupName) == false) if (authorityService.authorityExists(groupName) == false)
@@ -176,7 +176,7 @@ public final class People extends BaseScopableProcessorExtension
* @param parentGroup The parent container group * @param parentGroup The parent container group
* @param authority The authority (user or group) to add * @param authority The authority (user or group) to add
*/ */
public void addAuthority(Node parentGroup, Node authority) public void addAuthority(ScriptNode parentGroup, ScriptNode authority)
{ {
ParameterCheck.mandatory("Authority", authority); ParameterCheck.mandatory("Authority", authority);
ParameterCheck.mandatory("ParentGroup", parentGroup); ParameterCheck.mandatory("ParentGroup", parentGroup);
@@ -202,7 +202,7 @@ public final class People extends BaseScopableProcessorExtension
* @param parentGroup The parent container group * @param parentGroup The parent container group
* @param authority The authority (user or group) to remove * @param authority The authority (user or group) to remove
*/ */
public void removeAuthority(Node parentGroup, Node authority) public void removeAuthority(ScriptNode parentGroup, ScriptNode authority)
{ {
ParameterCheck.mandatory("Authority", authority); ParameterCheck.mandatory("Authority", authority);
ParameterCheck.mandatory("ParentGroup", parentGroup); ParameterCheck.mandatory("ParentGroup", parentGroup);
@@ -230,7 +230,7 @@ public final class People extends BaseScopableProcessorExtension
* *
* @return members of the group as a JavaScript array * @return members of the group as a JavaScript array
*/ */
public Scriptable getMembers(Node group) public Scriptable getMembers(ScriptNode group)
{ {
ParameterCheck.mandatory("Group", group); ParameterCheck.mandatory("Group", group);
Object[] members = getContainedAuthorities(group, AuthorityType.USER, true); Object[] members = getContainedAuthorities(group, AuthorityType.USER, true);
@@ -245,7 +245,7 @@ public final class People extends BaseScopableProcessorExtension
* *
* @return the members of the group as a JavaScript array * @return the members of the group as a JavaScript array
*/ */
public Scriptable getMembers(Node group, boolean recurse) public Scriptable getMembers(ScriptNode group, boolean recurse)
{ {
ParameterCheck.mandatory("Group", group); ParameterCheck.mandatory("Group", group);
Object[] members = getContainedAuthorities(group, AuthorityType.USER, recurse); Object[] members = getContainedAuthorities(group, AuthorityType.USER, recurse);
@@ -259,7 +259,7 @@ public final class People extends BaseScopableProcessorExtension
* *
* @return the containing groups as a JavaScript array, can be null * @return the containing groups as a JavaScript array, can be null
*/ */
public Scriptable getContainerGroups(Node person) public Scriptable getContainerGroups(ScriptNode person)
{ {
ParameterCheck.mandatory("Person", person); ParameterCheck.mandatory("Person", person);
Object[] parents = null; Object[] parents = null;
@@ -271,7 +271,7 @@ public final class People extends BaseScopableProcessorExtension
int i = 0; int i = 0;
for (String authority : authorities) for (String authority : authorities)
{ {
Node group = getGroup(authority); ScriptNode group = getGroup(authority);
if (group != null) if (group != null)
{ {
parents[i++] = group; parents[i++] = group;
@@ -289,7 +289,7 @@ public final class People extends BaseScopableProcessorExtension
* *
* @return contained authorities * @return contained authorities
*/ */
private Object[] getContainedAuthorities(Node container, AuthorityType type, boolean recurse) private Object[] getContainedAuthorities(ScriptNode container, AuthorityType type, boolean recurse)
{ {
Object[] members = null; Object[] members = null;
@@ -304,7 +304,7 @@ public final class People extends BaseScopableProcessorExtension
AuthorityType authorityType = AuthorityType.getAuthorityType(authority); AuthorityType authorityType = AuthorityType.getAuthorityType(authority);
if (authorityType.equals(AuthorityType.GROUP)) if (authorityType.equals(AuthorityType.GROUP))
{ {
Node group = getGroup(authority); ScriptNode group = getGroup(authority);
if (group != null) if (group != null)
{ {
members[i++] = group; members[i++] = group;
@@ -312,7 +312,7 @@ public final class People extends BaseScopableProcessorExtension
} }
else if (authorityType.equals(AuthorityType.USER)) else if (authorityType.equals(AuthorityType.USER))
{ {
Node person = getPerson(authority); ScriptNode person = getPerson(authority);
if (person != null) if (person != null)
{ {
members[i++] = person; members[i++] = person;

View File

@@ -555,7 +555,7 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
{ {
if (entry.getValue() instanceof NodeRef) if (entry.getValue() instanceof NodeRef)
{ {
newModel.put(entry.getKey(), new Node((NodeRef)entry.getValue(), this.services)); newModel.put(entry.getKey(), new ScriptNode((NodeRef)entry.getValue(), this.services));
} }
else else
{ {

View File

@@ -191,7 +191,7 @@ public class RhinoScriptTest extends TestCase
assertEquals(ref1.getId(), cx.toString(result)); assertEquals(ref1.getId(), cx.toString(result));
// wrap a scriptable Alfresco Node object - the Node object is a wrapper like TemplateNode // wrap a scriptable Alfresco Node object - the Node object is a wrapper like TemplateNode
Node node1 = new Node(root, serviceRegistry, scope); ScriptNode node1 = new ScriptNode(root, serviceRegistry, scope);
Object wrappedNode = Context.javaToJS(node1, scope); Object wrappedNode = Context.javaToJS(node1, scope);
ScriptableObject.putProperty(scope, "root", wrappedNode); ScriptableObject.putProperty(scope, "root", wrappedNode);
@@ -232,7 +232,7 @@ public class RhinoScriptTest extends TestCase
// create an Alfresco scriptable Node object // create an Alfresco scriptable Node object
// the Node object is a wrapper similar to the TemplateNode concept // the Node object is a wrapper similar to the TemplateNode concept
Node rootNode = new Node(root, serviceRegistry, null); ScriptNode rootNode = new ScriptNode(root, serviceRegistry, null);
model.put("root", rootNode); model.put("root", rootNode);
// execute test scripts using the various entry points of the ScriptService // execute test scripts using the various entry points of the ScriptService
@@ -304,8 +304,8 @@ public class RhinoScriptTest extends TestCase
// create an Alfresco scriptable Node object // create an Alfresco scriptable Node object
// the Node object is a wrapper similar to the TemplateNode concept // the Node object is a wrapper similar to the TemplateNode concept
Map<String, Object> model = new HashMap<String, Object>(); Map<String, Object> model = new HashMap<String, Object>();
model.put("doc", new Node(childRef.getChildRef(), serviceRegistry, null)); model.put("doc", new ScriptNode(childRef.getChildRef(), serviceRegistry, null));
model.put("root", new Node(root, serviceRegistry, null)); model.put("root", new ScriptNode(root, serviceRegistry, null));
// execute to add aspect via action // execute to add aspect via action
Object result = scriptService.executeScript(TESTSCRIPT_CLASSPATH2, model); Object result = scriptService.executeScript(TESTSCRIPT_CLASSPATH2, model);
@@ -358,8 +358,8 @@ public class RhinoScriptTest extends TestCase
// create an Alfresco scriptable Node object // create an Alfresco scriptable Node object
// the Node object is a wrapper similar to the TemplateNode concept // the Node object is a wrapper similar to the TemplateNode concept
Map<String, Object> model = new HashMap<String, Object>(); Map<String, Object> model = new HashMap<String, Object>();
model.put("doc", new Node(childRef.getChildRef(), serviceRegistry, null)); model.put("doc", new ScriptNode(childRef.getChildRef(), serviceRegistry, null));
model.put("root", new Node(root, serviceRegistry, null)); model.put("root", new ScriptNode(root, serviceRegistry, null));
// execute to add aspect via action // execute to add aspect via action
Object result = scriptService.executeScript(TESTSCRIPT_CLASSPATH3, model); Object result = scriptService.executeScript(TESTSCRIPT_CLASSPATH3, model);

View File

@@ -133,7 +133,7 @@ public final class ScriptAction implements Serializable, Scopeable
* the node to execute action upon * the node to execute action upon
*/ */
@SuppressWarnings("synthetic-access") @SuppressWarnings("synthetic-access")
public void execute(Node node) public void execute(ScriptNode node)
{ {
if (this.parameters != null && this.parameters.isModified()) if (this.parameters != null && this.parameters.isModified())
{ {

View File

@@ -87,11 +87,11 @@ import org.springframework.util.StringUtils;
* *
* @author Kevin Roast * @author Kevin Roast
*/ */
public class Node implements Serializable, Scopeable public class ScriptNode implements Serializable, Scopeable
{ {
private static final long serialVersionUID = -3378946227712939600L; private static final long serialVersionUID = -3378946227712939600L;
private static Log logger = LogFactory.getLog(Node.class); private static Log logger = LogFactory.getLog(ScriptNode.class);
private final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN; private final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN;
@@ -132,7 +132,7 @@ public class Node implements Serializable, Scopeable
private Boolean isContainer = null; private Boolean isContainer = null;
private String displayPath = null; private String displayPath = null;
protected TemplateImageResolver imageResolver = null; protected TemplateImageResolver imageResolver = null;
protected Node parent = null; protected ScriptNode parent = null;
private ChildAssociationRef primaryParentAssoc = null; private ChildAssociationRef primaryParentAssoc = null;
// NOTE: see the reset() method when adding new cached members! // NOTE: see the reset() method when adding new cached members!
@@ -147,7 +147,7 @@ public class Node implements Serializable, Scopeable
* @param services The ServiceRegistry the Node can use to access services * @param services The ServiceRegistry the Node can use to access services
* @param resolver Image resolver to use to retrieve icons * @param resolver Image resolver to use to retrieve icons
*/ */
public Node(NodeRef nodeRef, ServiceRegistry services) public ScriptNode(NodeRef nodeRef, ServiceRegistry services)
{ {
this(nodeRef, services, null); this(nodeRef, services, null);
} }
@@ -160,7 +160,7 @@ public class Node implements Serializable, Scopeable
* @param resolver Image resolver to use to retrieve icons * @param resolver Image resolver to use to retrieve icons
* @param scope Root scope for this Node * @param scope Root scope for this Node
*/ */
public Node(NodeRef nodeRef, ServiceRegistry services, Scriptable scope) public ScriptNode(NodeRef nodeRef, ServiceRegistry services, Scriptable scope)
{ {
if (nodeRef == null) if (nodeRef == null)
{ {
@@ -194,16 +194,16 @@ public class Node implements Serializable, Scopeable
if (this == obj) return true; if (this == obj) return true;
if (obj == null) return false; if (obj == null) return false;
if (getClass() != obj.getClass()) return false; if (getClass() != obj.getClass()) return false;
if (!nodeRef.equals(((Node)obj).nodeRef)) return false; if (!nodeRef.equals(((ScriptNode)obj).nodeRef)) return false;
return true; return true;
} }
/** /**
* Factory method * Factory method
*/ */
public Node newInstance(NodeRef nodeRef, ServiceRegistry services, Scriptable scope) public ScriptNode newInstance(NodeRef nodeRef, ServiceRegistry services, Scriptable scope)
{ {
return new Node(nodeRef, services, scope); return new ScriptNode(nodeRef, services, scope);
} }
/** /**
@@ -361,7 +361,7 @@ public class Node implements Serializable, Scopeable
* So a valid call might be: * So a valid call might be:
* <code>mynode.childByNamePath("/QA/Testing/Docs");</code> * <code>mynode.childByNamePath("/QA/Testing/Docs");</code>
*/ */
public Node childByNamePath(String path) public ScriptNode childByNamePath(String path)
{ {
// convert the name based path to a valid XPath query // convert the name based path to a valid XPath query
StringBuilder xpath = new StringBuilder(path.length() << 1); StringBuilder xpath = new StringBuilder(path.length() << 1);
@@ -390,7 +390,7 @@ public class Node implements Serializable, Scopeable
Object[] nodes = getChildrenByXPath(xpath.toString(), params, true); Object[] nodes = getChildrenByXPath(xpath.toString(), params, true);
return (nodes.length != 0) ? (Node)nodes[0] : null; return (nodes.length != 0) ? (ScriptNode)nodes[0] : null;
} }
// TODO: find out why this doesn't work - the function defs do not seem to get found // TODO: find out why this doesn't work - the function defs do not seem to get found
@@ -429,11 +429,11 @@ public class Node implements Serializable, Scopeable
for (AssociationRef ref : refs) for (AssociationRef ref : refs)
{ {
String qname = ref.getTypeQName().toString(); String qname = ref.getTypeQName().toString();
List<Node> nodes = (List<Node>)this.assocs.get(qname); List<ScriptNode> nodes = (List<ScriptNode>)this.assocs.get(qname);
if (nodes == null) if (nodes == null)
{ {
// first access of the list for this qname // first access of the list for this qname
nodes = new ArrayList<Node>(4); nodes = new ArrayList<ScriptNode>(4);
this.assocs.put(ref.getTypeQName().toString(), nodes); this.assocs.put(ref.getTypeQName().toString(), nodes);
} }
nodes.add(newInstance(ref.getTargetRef(), this.services, this.scope)); nodes.add(newInstance(ref.getTargetRef(), this.services, this.scope));
@@ -442,7 +442,7 @@ public class Node implements Serializable, Scopeable
// convert each Node list into a JavaScript array object // convert each Node list into a JavaScript array object
for (String qname : this.assocs.keySet()) for (String qname : this.assocs.keySet())
{ {
List<Node> nodes = (List<Node>)this.assocs.get(qname); List<ScriptNode> nodes = (List<ScriptNode>)this.assocs.get(qname);
Object[] objs = nodes.toArray(new Object[nodes.size()]); Object[] objs = nodes.toArray(new Object[nodes.size()]);
this.assocs.put(qname, Context.getCurrentContext().newArray(this.scope, objs)); this.assocs.put(qname, Context.getCurrentContext().newArray(this.scope, objs));
} }
@@ -482,11 +482,11 @@ public class Node implements Serializable, Scopeable
for (ChildAssociationRef ref : refs) for (ChildAssociationRef ref : refs)
{ {
String qname = ref.getTypeQName().toString(); String qname = ref.getTypeQName().toString();
List<Node> nodes = (List<Node>)this.childAssocs.get(qname); List<ScriptNode> nodes = (List<ScriptNode>)this.childAssocs.get(qname);
if (nodes == null) if (nodes == null)
{ {
// first access of the list for this qname // first access of the list for this qname
nodes = new ArrayList<Node>(4); nodes = new ArrayList<ScriptNode>(4);
this.childAssocs.put(ref.getTypeQName().toString(), nodes); this.childAssocs.put(ref.getTypeQName().toString(), nodes);
} }
nodes.add(newInstance(ref.getChildRef(), this.services, this.scope)); nodes.add(newInstance(ref.getChildRef(), this.services, this.scope));
@@ -495,7 +495,7 @@ public class Node implements Serializable, Scopeable
// convert each Node list into a JavaScript array object // convert each Node list into a JavaScript array object
for (String qname : this.childAssocs.keySet()) for (String qname : this.childAssocs.keySet())
{ {
List<Node> nodes = (List<Node>)this.childAssocs.get(qname); List<ScriptNode> nodes = (List<ScriptNode>)this.childAssocs.get(qname);
Object[] objs = nodes.toArray(new Object[nodes.size()]); Object[] objs = nodes.toArray(new Object[nodes.size()]);
this.childAssocs.put(qname, Context.getCurrentContext().newArray(this.scope, objs)); this.childAssocs.put(qname, Context.getCurrentContext().newArray(this.scope, objs));
} }
@@ -706,7 +706,7 @@ public class Node implements Serializable, Scopeable
/** /**
* @return the parent node * @return the parent node
*/ */
public Node getParent() public ScriptNode getParent()
{ {
if (parent == null) if (parent == null)
{ {
@@ -721,7 +721,7 @@ public class Node implements Serializable, Scopeable
return parent; return parent;
} }
public Node jsGet_parent() public ScriptNode jsGet_parent()
{ {
return getParent(); return getParent();
} }
@@ -1109,7 +1109,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Newly created Node or null if failed to create. * @return Newly created Node or null if failed to create.
*/ */
public Node createFile(String name) public ScriptNode createFile(String name)
{ {
ParameterCheck.mandatoryString("Node Name", name); ParameterCheck.mandatoryString("Node Name", name);
@@ -1125,7 +1125,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Newly created Node or null if failed to create. * @return Newly created Node or null if failed to create.
*/ */
public Node createFolder(String name) public ScriptNode createFolder(String name)
{ {
ParameterCheck.mandatoryString("Node Name", name); ParameterCheck.mandatoryString("Node Name", name);
@@ -1142,7 +1142,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Newly created Node or null if failed to create. * @return Newly created Node or null if failed to create.
*/ */
public Node createNode(String name, String type) public ScriptNode createNode(String name, String type)
{ {
return createNode(name, type, null, ContentModel.ASSOC_CONTAINS.toString()); return createNode(name, type, null, ContentModel.ASSOC_CONTAINS.toString());
} }
@@ -1156,7 +1156,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Newly created Node or null if failed to create. * @return Newly created Node or null if failed to create.
*/ */
public Node createNode(String name, String type, String assocName) public ScriptNode createNode(String name, String type, String assocName)
{ {
return createNode(name, type, null, assocName); return createNode(name, type, null, assocName);
} }
@@ -1170,7 +1170,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Newly created Node or null if failed to create. * @return Newly created Node or null if failed to create.
*/ */
public Node createNode(String name, String type, Object properties) public ScriptNode createNode(String name, String type, Object properties)
{ {
return createNode(name, type, properties, ContentModel.ASSOC_CONTAINS.toString()); return createNode(name, type, properties, ContentModel.ASSOC_CONTAINS.toString());
} }
@@ -1185,7 +1185,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Newly created Node or null if failed to create. * @return Newly created Node or null if failed to create.
*/ */
public Node createNode(String name, String type, Object properties, String assocName) public ScriptNode createNode(String name, String type, Object properties, String assocName)
{ {
ParameterCheck.mandatoryString("Node Type", type); ParameterCheck.mandatoryString("Node Type", type);
ParameterCheck.mandatoryString("Association Name", assocName); ParameterCheck.mandatoryString("Association Name", assocName);
@@ -1223,7 +1223,7 @@ public class Node implements Serializable, Scopeable
* @param target Destination node for the association * @param target Destination node for the association
* @param assocType Association type qname (short form or fully qualified) * @param assocType Association type qname (short form or fully qualified)
*/ */
public void createAssociation(Node target, String assocType) public void createAssociation(ScriptNode target, String assocType)
{ {
ParameterCheck.mandatory("Target", target); ParameterCheck.mandatory("Target", target);
ParameterCheck.mandatoryString("Association Type Name", assocType); ParameterCheck.mandatoryString("Association Type Name", assocType);
@@ -1237,7 +1237,7 @@ public class Node implements Serializable, Scopeable
* @param target Destination node on the end of the association * @param target Destination node on the end of the association
* @param assocType Association type qname (short form or fully qualified) * @param assocType Association type qname (short form or fully qualified)
*/ */
public void removeAssociation(Node target, String assocType) public void removeAssociation(ScriptNode target, String assocType)
{ {
ParameterCheck.mandatory("Target", target); ParameterCheck.mandatory("Target", target);
ParameterCheck.mandatoryString("Association Type Name", assocType); ParameterCheck.mandatoryString("Association Type Name", assocType);
@@ -1270,7 +1270,7 @@ public class Node implements Serializable, Scopeable
* *
* @return The newly copied Node instance or null if failed to copy. * @return The newly copied Node instance or null if failed to copy.
*/ */
public Node copy(Node destination) public ScriptNode copy(ScriptNode destination)
{ {
return copy(destination, false); return copy(destination, false);
} }
@@ -1283,11 +1283,11 @@ public class Node implements Serializable, Scopeable
* *
* @return The newly copied Node instance or null if failed to copy. * @return The newly copied Node instance or null if failed to copy.
*/ */
public Node copy(Node destination, boolean deepCopy) public ScriptNode copy(ScriptNode destination, boolean deepCopy)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
Node copy = null; ScriptNode copy = null;
if (destination.getNodeRef().getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_WORKSPACE)) if (destination.getNodeRef().getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_WORKSPACE))
{ {
@@ -1311,7 +1311,7 @@ public class Node implements Serializable, Scopeable
* *
* @return true on successful move, false on failure to move. * @return true on successful move, false on failure to move.
*/ */
public boolean move(Node destination) public boolean move(ScriptNode destination)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
@@ -1424,10 +1424,10 @@ public class Node implements Serializable, Scopeable
* *
* @return the working copy Node for the checked out document * @return the working copy Node for the checked out document
*/ */
public Node checkout() public ScriptNode checkout()
{ {
NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef); NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef);
Node workingCopy = newInstance(workingCopyRef, this.services, this.scope); ScriptNode workingCopy = newInstance(workingCopyRef, this.services, this.scope);
// reset the aspect and properties as checking out a document causes changes // reset the aspect and properties as checking out a document causes changes
this.properties = null; this.properties = null;
@@ -1443,14 +1443,14 @@ public class Node implements Serializable, Scopeable
* Destination for the checked out document working copy Node. * Destination for the checked out document working copy Node.
* @return the working copy Node for the checked out document * @return the working copy Node for the checked out document
*/ */
public Node checkout(Node destination) public ScriptNode checkout(ScriptNode destination)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(destination.getNodeRef()); ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(destination.getNodeRef());
NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef, NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef,
destination.getNodeRef(), ContentModel.ASSOC_CONTAINS, childAssocRef.getQName()); destination.getNodeRef(), ContentModel.ASSOC_CONTAINS, childAssocRef.getQName());
Node workingCopy = newInstance(workingCopyRef, this.services, this.scope); ScriptNode workingCopy = newInstance(workingCopyRef, this.services, this.scope);
// reset the aspect and properties as checking out a document causes changes // reset the aspect and properties as checking out a document causes changes
this.properties = null; this.properties = null;
@@ -1466,7 +1466,7 @@ public class Node implements Serializable, Scopeable
* *
* @return the original Node that was checked out. * @return the original Node that was checked out.
*/ */
public Node checkin() public ScriptNode checkin()
{ {
return checkin("", false); return checkin("", false);
} }
@@ -1480,7 +1480,7 @@ public class Node implements Serializable, Scopeable
* *
* @return the original Node that was checked out. * @return the original Node that was checked out.
*/ */
public Node checkin(String history) public ScriptNode checkin(String history)
{ {
return checkin(history, false); return checkin(history, false);
} }
@@ -1495,7 +1495,7 @@ public class Node implements Serializable, Scopeable
* *
* @return the original Node that was checked out. * @return the original Node that was checked out.
*/ */
public Node checkin(String history, boolean majorVersion) public ScriptNode checkin(String history, boolean majorVersion)
{ {
Map<String, Serializable> props = new HashMap<String, Serializable>(2, 1.0f); Map<String, Serializable> props = new HashMap<String, Serializable>(2, 1.0f);
props.put(Version.PROP_DESCRIPTION, history); props.put(Version.PROP_DESCRIPTION, history);
@@ -1511,7 +1511,7 @@ public class Node implements Serializable, Scopeable
* *
* @return the original Node that was checked out. * @return the original Node that was checked out.
*/ */
public Node cancelCheckout() public ScriptNode cancelCheckout()
{ {
NodeRef original = this.services.getCheckOutCheckInService().cancelCheckout(this.nodeRef); NodeRef original = this.services.getCheckOutCheckInService().cancelCheckout(this.nodeRef);
return newInstance(original, this.services, this.scope); return newInstance(original, this.services, this.scope);
@@ -1529,7 +1529,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the newly transformed document. * @return Node representing the newly transformed document.
*/ */
public Node transformDocument(String mimetype) public ScriptNode transformDocument(String mimetype)
{ {
return transformDocument(mimetype, getPrimaryParentAssoc().getParentRef()); return transformDocument(mimetype, getPrimaryParentAssoc().getParentRef());
} }
@@ -1543,12 +1543,12 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the newly transformed document. * @return Node representing the newly transformed document.
*/ */
public Node transformDocument(String mimetype, Node destination) public ScriptNode transformDocument(String mimetype, ScriptNode destination)
{ {
return transformDocument(mimetype, destination.getNodeRef()); return transformDocument(mimetype, destination.getNodeRef());
} }
private Node transformDocument(String mimetype, NodeRef destination) private ScriptNode transformDocument(String mimetype, NodeRef destination)
{ {
ParameterCheck.mandatoryString("Mimetype", mimetype); ParameterCheck.mandatoryString("Mimetype", mimetype);
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
@@ -1556,10 +1556,10 @@ public class Node implements Serializable, Scopeable
// the delegate definition for transforming a document // the delegate definition for transforming a document
Transformer transformer = new Transformer() Transformer transformer = new Transformer()
{ {
public Node transform(ContentService contentService, NodeRef nodeRef, ContentReader reader, public ScriptNode transform(ContentService contentService, NodeRef nodeRef, ContentReader reader,
ContentWriter writer) ContentWriter writer)
{ {
Node transformedNode = null; ScriptNode transformedNode = null;
if (contentService.isTransformable(reader, writer)) if (contentService.isTransformable(reader, writer))
{ {
contentService.transform(reader, writer); contentService.transform(reader, writer);
@@ -1581,9 +1581,9 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the transformed content - or null if the transform failed * @return Node representing the transformed content - or null if the transform failed
*/ */
private Node transformNode(Transformer transformer, String mimetype, NodeRef destination) private ScriptNode transformNode(Transformer transformer, String mimetype, NodeRef destination)
{ {
Node transformedNode = null; ScriptNode transformedNode = null;
// get the content reader // get the content reader
ContentService contentService = this.services.getContentService(); ContentService contentService = this.services.getContentService();
@@ -1623,7 +1623,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the newly transformed image. * @return Node representing the newly transformed image.
*/ */
public Node transformImage(String mimetype) public ScriptNode transformImage(String mimetype)
{ {
return transformImage(mimetype, null, getPrimaryParentAssoc().getParentRef()); return transformImage(mimetype, null, getPrimaryParentAssoc().getParentRef());
} }
@@ -1637,7 +1637,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the newly transformed image. * @return Node representing the newly transformed image.
*/ */
public Node transformImage(String mimetype, String options) public ScriptNode transformImage(String mimetype, String options)
{ {
return transformImage(mimetype, options, getPrimaryParentAssoc().getParentRef()); return transformImage(mimetype, options, getPrimaryParentAssoc().getParentRef());
} }
@@ -1651,7 +1651,7 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the newly transformed image. * @return Node representing the newly transformed image.
*/ */
public Node transformImage(String mimetype, Node destination) public ScriptNode transformImage(String mimetype, ScriptNode destination)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
return transformImage(mimetype, null, destination.getNodeRef()); return transformImage(mimetype, null, destination.getNodeRef());
@@ -1668,20 +1668,20 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the newly transformed image. * @return Node representing the newly transformed image.
*/ */
public Node transformImage(String mimetype, String options, Node destination) public ScriptNode transformImage(String mimetype, String options, ScriptNode destination)
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
return transformImage(mimetype, options, destination.getNodeRef()); return transformImage(mimetype, options, destination.getNodeRef());
} }
private Node transformImage(String mimetype, final String options, NodeRef destination) private ScriptNode transformImage(String mimetype, final String options, NodeRef destination)
{ {
ParameterCheck.mandatoryString("Mimetype", mimetype); ParameterCheck.mandatoryString("Mimetype", mimetype);
// the delegate definition for transforming an image // the delegate definition for transforming an image
Transformer transformer = new Transformer() Transformer transformer = new Transformer()
{ {
public Node transform(ContentService contentService, NodeRef nodeRef, ContentReader reader, public ScriptNode transform(ContentService contentService, NodeRef nodeRef, ContentReader reader,
ContentWriter writer) ContentWriter writer)
{ {
Map<String, Object> opts = new HashMap<String, Object>(1); Map<String, Object> opts = new HashMap<String, Object>(1);
@@ -1702,7 +1702,7 @@ public class Node implements Serializable, Scopeable
* *
* @return output of the template execution * @return output of the template execution
*/ */
public String processTemplate(Node template) public String processTemplate(ScriptNode template)
{ {
ParameterCheck.mandatory("Template Node", template); ParameterCheck.mandatory("Template Node", template);
return processTemplate(template.getContent(), null, null); return processTemplate(template.getContent(), null, null);
@@ -1717,7 +1717,7 @@ public class Node implements Serializable, Scopeable
* *
* @return output of the template execution * @return output of the template execution
*/ */
public String processTemplate(Node template, Object args) public String processTemplate(ScriptNode template, Object args)
{ {
ParameterCheck.mandatory("Template Node", template); ParameterCheck.mandatory("Template Node", template);
return processTemplate(template.getContent(), null, (ScriptableObject)args); return processTemplate(template.getContent(), null, (ScriptableObject)args);
@@ -1755,9 +1755,9 @@ public class Node implements Serializable, Scopeable
{ {
// build default model for the template processing // build default model for the template processing
Map<String, Object> model = this.services.getTemplateService().buildDefaultModel( Map<String, Object> model = this.services.getTemplateService().buildDefaultModel(
((Node)((Wrapper)scope.get("person", scope)).unwrap()).getNodeRef(), ((ScriptNode)((Wrapper)scope.get("person", scope)).unwrap()).getNodeRef(),
((Node)((Wrapper)scope.get("companyhome", scope)).unwrap()).getNodeRef(), ((ScriptNode)((Wrapper)scope.get("companyhome", scope)).unwrap()).getNodeRef(),
((Node)((Wrapper)scope.get("userhome", scope)).unwrap()).getNodeRef(), ((ScriptNode)((Wrapper)scope.get("userhome", scope)).unwrap()).getNodeRef(),
templateRef, templateRef,
null); null);
@@ -2149,6 +2149,6 @@ public class Node implements Serializable, Scopeable
* *
* @return Node representing the transformed entity * @return Node representing the transformed entity
*/ */
Node transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer); ScriptNode transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer);
} }
} }

View File

@@ -71,9 +71,9 @@ public final class ScriptUtils extends BaseScopableProcessorExtension
* @param nodeRefString string reference to a node * @param nodeRefString string reference to a node
* @return a JS node object * @return a JS node object
*/ */
public Node getNodeFromString(String nodeRefString) public ScriptNode getNodeFromString(String nodeRefString)
{ {
NodeRef nodeRef = new NodeRef(nodeRefString); NodeRef nodeRef = new NodeRef(nodeRefString);
return (Node)new ValueConverter().convertValueForScript(this.services, getScope(), null, nodeRef); return (ScriptNode)new ValueConverter().convertValueForScript(this.services, getScope(), null, nodeRef);
} }
} }

View File

@@ -91,7 +91,7 @@ public final class Search extends BaseScopableProcessorExtension
* *
* @return the Node if found or null if failed to find * @return the Node if found or null if failed to find
*/ */
public Node findNode(NodeRef ref) public ScriptNode findNode(NodeRef ref)
{ {
return findNode(ref.toString()); return findNode(ref.toString());
} }
@@ -103,13 +103,13 @@ public final class Search extends BaseScopableProcessorExtension
* *
* @return the Node if found or null if failed to find * @return the Node if found or null if failed to find
*/ */
public Node findNode(String ref) public ScriptNode findNode(String ref)
{ {
String query = "ID:" + LuceneQueryParser.escape(ref); String query = "ID:" + LuceneQueryParser.escape(ref);
Object[] result = query(query, SearchService.LANGUAGE_LUCENE); Object[] result = query(query, SearchService.LANGUAGE_LUCENE);
if (result.length != 0) if (result.length != 0)
{ {
return (Node)result[0]; return (ScriptNode)result[0];
} }
else else
{ {
@@ -164,7 +164,7 @@ public final class Search extends BaseScopableProcessorExtension
* *
* @return JavaScript array of Node results from the search - can be empty but not null * @return JavaScript array of Node results from the search - can be empty but not null
*/ */
public Scriptable savedSearch(Node savedSearch) public Scriptable savedSearch(ScriptNode savedSearch)
{ {
String search = null; String search = null;
@@ -217,7 +217,7 @@ public final class Search extends BaseScopableProcessorExtension
{ {
if (searchRef != null) if (searchRef != null)
{ {
return savedSearch(new Node(new NodeRef(searchRef), services, null)); return savedSearch(new ScriptNode(new NodeRef(searchRef), services, null));
} }
else else
{ {
@@ -237,7 +237,7 @@ public final class Search extends BaseScopableProcessorExtension
*/ */
private Object[] query(String search, String language) private Object[] query(String search, String language)
{ {
LinkedHashSet<Node> set = new LinkedHashSet<Node>(); LinkedHashSet<ScriptNode> set = new LinkedHashSet<ScriptNode>();
// perform the search against the repo // perform the search against the repo
ResultSet results = null; ResultSet results = null;
@@ -253,7 +253,7 @@ public final class Search extends BaseScopableProcessorExtension
for (ResultSetRow row: results) for (ResultSetRow row: results)
{ {
NodeRef nodeRef = row.getNodeRef(); NodeRef nodeRef = row.getNodeRef();
set.add(new Node(nodeRef, this.services, getScope())); set.add(new ScriptNode(nodeRef, this.services, getScope()));
} }
} }
} }

View File

@@ -71,7 +71,7 @@ public class ValueConverter
{ {
// NodeRef object properties are converted to new Node objects // NodeRef object properties are converted to new Node objects
// so they can be used as objects within a template // so they can be used as objects within a template
value = new Node(((NodeRef)value), services, scope); value = new ScriptNode(((NodeRef)value), services, scope);
} }
else if (value instanceof QName || value instanceof StoreRef) else if (value instanceof QName || value instanceof StoreRef)
{ {
@@ -128,10 +128,10 @@ public class ValueConverter
{ {
return null; return null;
} }
else if (value instanceof Node) else if (value instanceof ScriptNode)
{ {
// convert back to NodeRef // convert back to NodeRef
value = ((Node)value).getNodeRef(); value = ((ScriptNode)value).getNodeRef();
} }
else if (value instanceof ChildAssociation) else if (value instanceof ChildAssociation)
{ {

View File

@@ -25,7 +25,7 @@
package org.alfresco.repo.workflow.jbpm; package org.alfresco.repo.workflow.jbpm;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.jscript.Node; import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.repo.security.authority.AuthorityDAO; import org.alfresco.repo.security.authority.AuthorityDAO;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.workflow.WorkflowException; import org.alfresco.service.cmr.workflow.WorkflowException;
@@ -97,9 +97,9 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
{ {
actor = (String)eval; actor = (String)eval;
} }
else if (eval instanceof Node) else if (eval instanceof ScriptNode)
{ {
actor = mapAuthorityToName((Node)eval, false); actor = mapAuthorityToName((ScriptNode)eval, false);
} }
if (actor == null) if (actor == null)
{ {
@@ -133,13 +133,13 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
throw new WorkflowException("pooledactors expression '" + pooledactorValStr + "' evaluates to null"); throw new WorkflowException("pooledactors expression '" + pooledactorValStr + "' evaluates to null");
} }
if (eval instanceof Node[]) if (eval instanceof ScriptNode[])
{ {
Node[] nodes = (Node[])eval; ScriptNode[] nodes = (ScriptNode[])eval;
assignedPooledActors = new String[nodes.length]; assignedPooledActors = new String[nodes.length];
int i = 0; int i = 0;
for (Node node : (Node[])nodes) for (ScriptNode node : (ScriptNode[])nodes)
{ {
String actor = mapAuthorityToName(node, true); String actor = mapAuthorityToName(node, true);
if (actor == null) if (actor == null)
@@ -149,9 +149,9 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
assignedPooledActors[i++] = actor; assignedPooledActors[i++] = actor;
} }
} }
else if (eval instanceof Node) else if (eval instanceof ScriptNode)
{ {
Node node = (Node)eval; ScriptNode node = (ScriptNode)eval;
String actor = mapAuthorityToName(node, true); String actor = mapAuthorityToName(node, true);
if (actor == null) if (actor == null)
{ {
@@ -195,7 +195,7 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
* @param authority * @param authority
* @return actor id * @return actor id
*/ */
private String mapAuthorityToName(Node authority, boolean allowGroup) private String mapAuthorityToName(ScriptNode authority, boolean allowGroup)
{ {
String name = null; String name = null;
QName type = authority.getType(); QName type = authority.getType();

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.jscript.Node; import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -125,9 +125,9 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
// execute // execute
Object result = executeScript(executionContext, services, expression, variableAccesses); Object result = executeScript(executionContext, services, expression, variableAccesses);
if (result instanceof Node) if (result instanceof ScriptNode)
{ {
result = new JBPMNode(((Node)result).getNodeRef(), services); result = new JBPMNode(((ScriptNode)result).getNodeRef(), services);
} }
// map script return variable to process context // map script return variable to process context

View File

@@ -105,11 +105,11 @@ public class ForEachFork extends JBPMSpringActionHandler
} }
// expression evaluates to Node array // expression evaluates to Node array
else if (eval instanceof org.alfresco.repo.jscript.Node[]) else if (eval instanceof org.alfresco.repo.jscript.ScriptNode[])
{ {
org.alfresco.repo.jscript.Node[] nodes = (org.alfresco.repo.jscript.Node[])eval; org.alfresco.repo.jscript.ScriptNode[] nodes = (org.alfresco.repo.jscript.ScriptNode[])eval;
forEachColl = new ArrayList(nodes.length); forEachColl = new ArrayList(nodes.length);
for (org.alfresco.repo.jscript.Node node : nodes) for (org.alfresco.repo.jscript.ScriptNode node : nodes)
{ {
forEachColl.add(new JBPMNode(node.getNodeRef(), services)); forEachColl.add(new JBPMNode(node.getNodeRef(), services));
} }

View File

@@ -42,7 +42,7 @@ import org.mozilla.javascript.Scriptable;
* *
* @author davidc * @author davidc
*/ */
public class JBPMNode extends org.alfresco.repo.jscript.Node public class JBPMNode extends org.alfresco.repo.jscript.ScriptNode
{ {
private static final long serialVersionUID = -826970280203254365L; private static final long serialVersionUID = -826970280203254365L;
@@ -69,7 +69,7 @@ public class JBPMNode extends org.alfresco.repo.jscript.Node
/** /**
* Value converter for beanshell. * Value converter for beanshell.
*/ */
private class JBPMNodeConverter extends org.alfresco.repo.jscript.Node.NodeValueConverter private class JBPMNodeConverter extends org.alfresco.repo.jscript.ScriptNode.NodeValueConverter
{ {
@Override @Override
public Serializable convertValueForRepo(Serializable value) public Serializable convertValueForRepo(Serializable value)