mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
. WCM HEAD merge fixes
- fix ups - removal of obsolete JBPM files . Addition of AVM JavaScript integation files - ability to retrieve AVM node references by Path or from the root node of a store by lookup - getting and setting of AVM node properties and aspects - walking of child nodes - moving and renaming of AVM nodes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4308 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
109
source/java/org/alfresco/repo/jscript/AVM.java
Normal file
109
source/java/org/alfresco/repo/jscript/AVM.java
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.jscript;
|
||||||
|
|
||||||
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.mozilla.javascript.Scriptable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public final class AVM implements Scopeable
|
||||||
|
{
|
||||||
|
/** Root scope for this object */
|
||||||
|
private Scriptable scope;
|
||||||
|
|
||||||
|
private AVMService avmService;
|
||||||
|
private ServiceRegistry services;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public AVM(ServiceRegistry services)
|
||||||
|
{
|
||||||
|
this.services = services;
|
||||||
|
this.avmService = services.getAVMService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.jscript.Scopeable#setScope(org.mozilla.javascript.Scriptable)
|
||||||
|
*/
|
||||||
|
public void setScope(Scriptable scope)
|
||||||
|
{
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an AVM Node representing the public store root folder.
|
||||||
|
*
|
||||||
|
* @param store Store name to lookup root folder for
|
||||||
|
*
|
||||||
|
* @return AVM Node representing the public store root folder, or null if not found.
|
||||||
|
*/
|
||||||
|
public AVMNode lookupStoreRoot(String store)
|
||||||
|
{
|
||||||
|
AVMNode rootNode = null;
|
||||||
|
if (store != null && store.length() != 0)
|
||||||
|
{
|
||||||
|
String rootPath = store + ':' + getWebappsFolderPath();
|
||||||
|
AVMNodeDescriptor nodeDesc = this.avmService.lookup(-1, rootPath);
|
||||||
|
if (nodeDesc != null)
|
||||||
|
{
|
||||||
|
rootNode = new AVMNode(AVMNodeConverter.ToNodeRef(-1, rootPath), this.services, null, this.scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rootNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an AVM Node for the fully qualified path.
|
||||||
|
*
|
||||||
|
* @param path Fully qualified path to node to lookup
|
||||||
|
*
|
||||||
|
* @return AVM Node for the fully qualified path, or null if not found.
|
||||||
|
*/
|
||||||
|
public AVMNode lookupNode(String path)
|
||||||
|
{
|
||||||
|
AVMNode node = null;
|
||||||
|
if (path != null && path.length() != 0)
|
||||||
|
{
|
||||||
|
AVMNodeDescriptor nodeDesc = this.avmService.lookup(-1, path);
|
||||||
|
if (nodeDesc != null)
|
||||||
|
{
|
||||||
|
node = new AVMNode(AVMNodeConverter.ToNodeRef(-1, path), this.services, null, this.scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getWebappsFolderPath()
|
||||||
|
{
|
||||||
|
return '/' + DIR_APPBASE + '/' + DIR_WEBAPPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String jsGet_webappsFolderPath()
|
||||||
|
{
|
||||||
|
return getWebappsFolderPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
// system directories at the top level of an AVM website
|
||||||
|
private final static String DIR_APPBASE = "appBase";
|
||||||
|
private final static String DIR_WEBAPPS = "avm_webapps";
|
||||||
|
}
|
192
source/java/org/alfresco/repo/jscript/AVMNode.java
Normal file
192
source/java/org/alfresco/repo/jscript/AVMNode.java
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.jscript;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
|
import org.mozilla.javascript.Scriptable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class AVMNode extends Node
|
||||||
|
{
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param nodeRef
|
||||||
|
* @param services
|
||||||
|
* @param resolver
|
||||||
|
*/
|
||||||
|
public AVMNode(NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver)
|
||||||
|
{
|
||||||
|
super(nodeRef, services, resolver);
|
||||||
|
this.path = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param nodeRef
|
||||||
|
* @param services
|
||||||
|
* @param resolver
|
||||||
|
* @param scope
|
||||||
|
*/
|
||||||
|
public AVMNode(NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver, Scriptable scope)
|
||||||
|
{
|
||||||
|
super(nodeRef, services, resolver, scope);
|
||||||
|
this.path = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Node newInstance(NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver, Scriptable scope)
|
||||||
|
{
|
||||||
|
return new AVMNode(nodeRef, services, resolver, scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: changing the 'name' property (either directly using .name or with .properties.name)
|
||||||
|
// invalidates the path and the base noderef instance!
|
||||||
|
// AVMService has a specific rename method - use this and block name property changes?
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the full AVM Path to this node
|
||||||
|
*/
|
||||||
|
public String getPath()
|
||||||
|
{
|
||||||
|
return this.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String jsGet_path()
|
||||||
|
{
|
||||||
|
return getPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public Node copy(Node destination)
|
||||||
|
{
|
||||||
|
AVM
|
||||||
|
this.services.getAVMService().
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move this Node to a new parent destination node.
|
||||||
|
*
|
||||||
|
* @param destination Node
|
||||||
|
*
|
||||||
|
* @return true on successful move, false on failure to move.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean move(Node destination)
|
||||||
|
{
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
if (destination instanceof AVMNode)
|
||||||
|
{
|
||||||
|
success = move(((AVMNode)destination).getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move this Node to a new parent destination path.
|
||||||
|
*
|
||||||
|
* @param destination Path
|
||||||
|
*
|
||||||
|
* @return true on successful move, false on failure to move.
|
||||||
|
*/
|
||||||
|
public boolean move(String destination)
|
||||||
|
{
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
if (destination != null && destination.length() != 0)
|
||||||
|
{
|
||||||
|
AVMNode parent = (AVMNode)this.getParent();
|
||||||
|
this.services.getAVMService().rename(
|
||||||
|
parent.getPath(), getName(), destination, getName());
|
||||||
|
|
||||||
|
reset(destination + '/' + getName());
|
||||||
|
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename this node to the specified name
|
||||||
|
*
|
||||||
|
* @param name New name for the node
|
||||||
|
*
|
||||||
|
* @return true on success, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean rename(String name)
|
||||||
|
{
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
if (name != null && name.length() != 0)
|
||||||
|
{
|
||||||
|
String parentPath = ((AVMNode)this.getParent()).getPath();
|
||||||
|
this.services.getAVMService().rename(
|
||||||
|
parentPath, getName(), parentPath, name);
|
||||||
|
|
||||||
|
reset(parentPath + '/' + name);
|
||||||
|
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the Node cached state
|
||||||
|
*/
|
||||||
|
private void reset(String path)
|
||||||
|
{
|
||||||
|
super.reset();
|
||||||
|
this.path = path;
|
||||||
|
this.nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
|
||||||
|
this.id = nodeRef.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
if (this.services.getAVMService().lookup(-1, this.path) != null)
|
||||||
|
{
|
||||||
|
return "AVM Path: " + getPath() +
|
||||||
|
"\nNode Type: " + getType() +
|
||||||
|
"\nNode Properties: " + this.getProperties().size() +
|
||||||
|
"\nNode Aspects: " + this.getAspects().toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "Node no longer exists: " + nodeRef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -95,13 +95,13 @@ public class Node implements Serializable, Scopeable
|
|||||||
protected Scriptable scope;
|
protected Scriptable scope;
|
||||||
|
|
||||||
/** Node Value Converter */
|
/** Node Value Converter */
|
||||||
private NodeValueConverter converter = null;
|
protected NodeValueConverter converter = null;
|
||||||
|
|
||||||
/** Cached values */
|
/** Cached values */
|
||||||
private NodeRef nodeRef;
|
protected NodeRef nodeRef;
|
||||||
private String name;
|
private String name;
|
||||||
private QName type;
|
private QName type;
|
||||||
private String id;
|
protected String id;
|
||||||
/** The aspects applied to this node */
|
/** The aspects applied to this node */
|
||||||
private Set<QName> aspects = null;
|
private Set<QName> aspects = null;
|
||||||
/** The associations from this node */
|
/** The associations from this node */
|
||||||
@@ -116,7 +116,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;
|
||||||
private Node parent = null;
|
protected Node 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!
|
||||||
|
|
||||||
@@ -164,6 +164,14 @@ public class Node implements Serializable, Scopeable
|
|||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method
|
||||||
|
*/
|
||||||
|
public Node newInstance(NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver, Scriptable scope)
|
||||||
|
{
|
||||||
|
return new Node(nodeRef, services, resolver, scope);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.jscript.Scopeable#setScope(org.mozilla.javascript.Scriptable)
|
* @see org.alfresco.repo.jscript.Scopeable#setScope(org.mozilla.javascript.Scriptable)
|
||||||
*/
|
*/
|
||||||
@@ -283,7 +291,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
for (int i=0; i<childRefs.size(); i++)
|
for (int i=0; i<childRefs.size(); i++)
|
||||||
{
|
{
|
||||||
// create our Node representation from the NodeRef
|
// create our Node representation from the NodeRef
|
||||||
Node child = new Node(
|
Node child = newInstance(
|
||||||
childRefs.get(i).getChildRef(), this.services, this.imageResolver, this.scope);
|
childRefs.get(i).getChildRef(), this.services, this.imageResolver, this.scope);
|
||||||
this.children[i] = child;
|
this.children[i] = child;
|
||||||
}
|
}
|
||||||
@@ -374,7 +382,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
|
System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
|
||||||
nodes = newNodes;
|
nodes = newNodes;
|
||||||
}
|
}
|
||||||
nodes[nodes.length - 1] = new Node(
|
nodes[nodes.length - 1] = newInstance(
|
||||||
ref.getTargetRef(), this.services, this.imageResolver, this.scope);
|
ref.getTargetRef(), this.services, this.imageResolver, this.scope);
|
||||||
|
|
||||||
this.assocs.put(ref.getTypeQName().toString(), nodes);
|
this.assocs.put(ref.getTypeQName().toString(), nodes);
|
||||||
@@ -657,7 +665,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
// handle root node (no parent!)
|
// handle root node (no parent!)
|
||||||
if (parentRef != null)
|
if (parentRef != null)
|
||||||
{
|
{
|
||||||
parent = new Node(parentRef, this.services, this.imageResolver, this.scope);
|
parent = newInstance(parentRef, this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,10 +729,15 @@ public class Node implements Serializable, Scopeable
|
|||||||
public void setContent(String content)
|
public void setContent(String content)
|
||||||
{
|
{
|
||||||
ScriptContentData contentData = (ScriptContentData)getProperties().get(ContentModel.PROP_CONTENT);
|
ScriptContentData contentData = (ScriptContentData)getProperties().get(ContentModel.PROP_CONTENT);
|
||||||
if (contentData != null)
|
if (contentData == null)
|
||||||
{
|
{
|
||||||
contentData.setContent(content);
|
// guess a mimetype based on the filename
|
||||||
|
String mimetype = this.services.getMimetypeService().guessMimetype(getName());
|
||||||
|
ContentData cdata = new ContentData(null, mimetype, 0L, "UTF-8");
|
||||||
|
contentData = new ScriptContentData(cdata, ContentModel.PROP_CONTENT);
|
||||||
|
getProperties().put(ContentModel.PROP_CONTENT.toString(), contentData);
|
||||||
}
|
}
|
||||||
|
contentData.setContent(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void jsSet_content(String content)
|
public void jsSet_content(String content)
|
||||||
@@ -1018,7 +1031,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
{
|
{
|
||||||
FileInfo fileInfo = this.services.getFileFolderService().create(
|
FileInfo fileInfo = this.services.getFileFolderService().create(
|
||||||
this.nodeRef, name, ContentModel.TYPE_CONTENT);
|
this.nodeRef, name, ContentModel.TYPE_CONTENT);
|
||||||
node = new Node(fileInfo.getNodeRef(), this.services, this.imageResolver, this.scope);
|
node = newInstance(fileInfo.getNodeRef(), this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FileExistsException fileErr)
|
catch (FileExistsException fileErr)
|
||||||
@@ -1051,7 +1064,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
{
|
{
|
||||||
FileInfo fileInfo = this.services.getFileFolderService().create(
|
FileInfo fileInfo = this.services.getFileFolderService().create(
|
||||||
this.nodeRef, name, ContentModel.TYPE_FOLDER);
|
this.nodeRef, name, ContentModel.TYPE_FOLDER);
|
||||||
node = new Node(fileInfo.getNodeRef(), this.services, this.imageResolver, this.scope);
|
node = newInstance(fileInfo.getNodeRef(), this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FileExistsException fileErr)
|
catch (FileExistsException fileErr)
|
||||||
@@ -1092,7 +1105,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
QName.createQName(NamespaceService.ALFRESCO_URI, QName.createValidLocalName(name)),
|
QName.createQName(NamespaceService.ALFRESCO_URI, QName.createValidLocalName(name)),
|
||||||
createQName(type),
|
createQName(type),
|
||||||
props);
|
props);
|
||||||
node = new Node(childAssocRef.getChildRef(), this.services, this.imageResolver, this.scope);
|
node = newInstance(childAssocRef.getChildRef(), this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AccessDeniedException accessErr)
|
catch (AccessDeniedException accessErr)
|
||||||
@@ -1165,7 +1178,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
ContentModel.ASSOC_CONTAINS,
|
ContentModel.ASSOC_CONTAINS,
|
||||||
getPrimaryParentAssoc().getQName(),
|
getPrimaryParentAssoc().getQName(),
|
||||||
deepCopy);
|
deepCopy);
|
||||||
copy = new Node(copyRef, this.services, this.imageResolver, this.scope);
|
copy = newInstance(copyRef, this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AccessDeniedException accessErr)
|
catch (AccessDeniedException accessErr)
|
||||||
@@ -1302,7 +1315,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
public Node checkout()
|
public Node checkout()
|
||||||
{
|
{
|
||||||
NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef);
|
NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef);
|
||||||
Node workingCopy = new Node(workingCopyRef, this.services, this.imageResolver, this.scope);
|
Node workingCopy = newInstance(workingCopyRef, this.services, this.imageResolver, 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;
|
||||||
@@ -1323,7 +1336,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
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 = new Node(workingCopyRef, this.services, this.imageResolver, this.scope);
|
Node workingCopy = newInstance(workingCopyRef, this.services, this.imageResolver, 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;
|
||||||
@@ -1374,7 +1387,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
props.put(Version.PROP_DESCRIPTION, history);
|
props.put(Version.PROP_DESCRIPTION, history);
|
||||||
props.put(VersionModel.PROP_VERSION_TYPE, majorVersion ? VersionType.MAJOR : VersionType.MINOR);
|
props.put(VersionModel.PROP_VERSION_TYPE, majorVersion ? VersionType.MAJOR : VersionType.MINOR);
|
||||||
NodeRef original = this.services.getCheckOutCheckInService().checkin(this.nodeRef, props);
|
NodeRef original = this.services.getCheckOutCheckInService().checkin(this.nodeRef, props);
|
||||||
return new Node(original, this.services, this.imageResolver, this.scope);
|
return newInstance(original, this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1387,7 +1400,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
public Node cancelCheckout()
|
public Node cancelCheckout()
|
||||||
{
|
{
|
||||||
NodeRef original = this.services.getCheckOutCheckInService().cancelCheckout(this.nodeRef);
|
NodeRef original = this.services.getCheckOutCheckInService().cancelCheckout(this.nodeRef);
|
||||||
return new Node(original, this.services, this.imageResolver, this.scope);
|
return newInstance(original, this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1435,7 +1448,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
contentService.transform(reader, writer);
|
contentService.transform(reader, writer);
|
||||||
transformedNode = new Node(nodeRef, services, imageResolver, scope);
|
transformedNode = newInstance(nodeRef, services, imageResolver, scope);
|
||||||
}
|
}
|
||||||
catch (NoTransformerException err)
|
catch (NoTransformerException err)
|
||||||
{
|
{
|
||||||
@@ -1570,7 +1583,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
Map<String, Object> opts = new HashMap<String, Object>(1);
|
Map<String, Object> opts = new HashMap<String, Object>(1);
|
||||||
opts.put(ImageMagickContentTransformer.KEY_OPTIONS, options != null ? options : "");
|
opts.put(ImageMagickContentTransformer.KEY_OPTIONS, options != null ? options : "");
|
||||||
contentService.getImageTransformer().transform(reader, writer, opts);
|
contentService.getImageTransformer().transform(reader, writer, opts);
|
||||||
transformedNode = new Node(nodeRef, services, imageResolver, scope);
|
transformedNode = newInstance(nodeRef, services, imageResolver, scope);
|
||||||
}
|
}
|
||||||
catch (NoTransformerException err)
|
catch (NoTransformerException err)
|
||||||
{
|
{
|
||||||
@@ -1783,7 +1796,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
if (nodes.size() != 0)
|
if (nodes.size() != 0)
|
||||||
{
|
{
|
||||||
result = new Node[1];
|
result = new Node[1];
|
||||||
result[0] = new Node(nodes.get(0), this.services, this.imageResolver, this.scope);
|
result[0] = newInstance(nodes.get(0), this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// or all the results
|
// or all the results
|
||||||
@@ -1793,7 +1806,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
for (int i=0; i<nodes.size(); i++)
|
for (int i=0; i<nodes.size(); i++)
|
||||||
{
|
{
|
||||||
NodeRef ref = nodes.get(i);
|
NodeRef ref = nodes.get(i);
|
||||||
result[i] = new Node(ref, this.services, this.imageResolver, this.scope);
|
result[i] = newInstance(ref, this.services, this.imageResolver, this.scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -234,7 +234,8 @@ public class RhinoScriptService implements ScriptService
|
|||||||
for (ScriptImplementation script : this.globalScripts)
|
for (ScriptImplementation script : this.globalScripts)
|
||||||
{
|
{
|
||||||
model.put(script.getScriptName(), script);
|
model.put(script.getScriptName(), script);
|
||||||
}
|
}
|
||||||
|
model.put("avm", new AVM(services));
|
||||||
|
|
||||||
// insert supplied object model into root of the default scope
|
// insert supplied object model into root of the default scope
|
||||||
for (String key : model.keySet())
|
for (String key : model.keySet())
|
||||||
|
Reference in New Issue
Block a user