mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
. Reformatting issues fixed after merge
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4673 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -121,6 +121,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
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!
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Construction
|
// Construction
|
||||||
|
|
||||||
@@ -202,6 +203,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
{
|
{
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Node Wrapper API
|
// Node Wrapper API
|
||||||
@@ -286,8 +288,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Helper to set the 'name' property for the node.
|
* Helper to set the 'name' property for the node.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name Name to set
|
||||||
* Name to set
|
|
||||||
*/
|
*/
|
||||||
public void setName(String name)
|
public void setName(String name)
|
||||||
{
|
{
|
||||||
@@ -328,7 +329,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the Node at the specified 'cm:name' based Path walking the children of this Node. So a valid call might be
|
* @return Returns the Node at the specified 'cm:name' based Path walking the children of this Node.
|
||||||
|
* 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 Node childByNamePath(String path)
|
||||||
@@ -364,15 +366,11 @@ public class Node implements Serializable, Scopeable
|
|||||||
return getChildrenByXPath(xpath, false);
|
return getChildrenByXPath(xpath, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: find out why this doesn't work - the function defs do not seem to get found
|
|
||||||
// public Node[] jsFunction_childrenByXPath(String xpath)
|
|
||||||
// {
|
|
||||||
// return childrenByXPath(xpath);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the associations for this Node. As a Map of assoc name to an Array of Nodes. The Map returned implements the Scriptable interface to allow access to the assoc arrays
|
* Return the associations for this Node. As a Map of assoc name to an Array of Nodes.
|
||||||
* via JavaScript associative array access. This means associations of this node can be access thus: <code>node.assocs["translations"][0]</code>
|
* The Map returned implements the Scriptable interface to allow access to the assoc arrays via JavaScript
|
||||||
|
* associative array access. This means associations of this node can be access thus:
|
||||||
|
* <code>node.assocs["translations"][0]</code>
|
||||||
*
|
*
|
||||||
* @return associations as a Map of assoc name to an Array of Nodes.
|
* @return associations as a Map of assoc name to an Array of Nodes.
|
||||||
*/
|
*/
|
||||||
@@ -415,8 +413,9 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all the properties known about this node. The Map returned implements the Scriptable interface to allow access to the properties via JavaScript associative array
|
* Return all the properties known about this node. The Map returned implements the Scriptable interface to
|
||||||
* access. This means properties of a node can be access thus: <code>node.properties["name"]</code>
|
* allow access to the properties via JavaScript associative array access. This means properties of a node can
|
||||||
|
* be access thus: <code>node.properties["name"]</code>
|
||||||
*
|
*
|
||||||
* @return Map of properties for this Node.
|
* @return Map of properties for this Node.
|
||||||
*/
|
*/
|
||||||
@@ -455,8 +454,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
if (isContainer == null)
|
if (isContainer == null)
|
||||||
{
|
{
|
||||||
DictionaryService dd = this.services.getDictionaryService();
|
DictionaryService dd = this.services.getDictionaryService();
|
||||||
isContainer = Boolean.valueOf((dd.isSubClass(getType(), ContentModel.TYPE_FOLDER) == true && dd.isSubClass(
|
isContainer = Boolean.valueOf((dd.isSubClass(getType(), ContentModel.TYPE_FOLDER) == true &&
|
||||||
getType(), ContentModel.TYPE_SYSTEM_FOLDER) == false));
|
dd.isSubClass(getType(), ContentModel.TYPE_SYSTEM_FOLDER) == false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return isContainer.booleanValue();
|
return isContainer.booleanValue();
|
||||||
@@ -526,8 +525,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param aspect
|
* @param aspect The aspect name to test for (full qualified or short-name form)
|
||||||
* The aspect name to test for (full qualified or short-name form)
|
|
||||||
* @return true if the node has the aspect false otherwise
|
* @return true if the node has the aspect false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean hasAspect(String aspect)
|
public boolean hasAspect(String aspect)
|
||||||
@@ -538,10 +536,10 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Return true if the user has the specified permission on the node.
|
* Return true if the user has the specified permission on the node.
|
||||||
* <p>
|
* <p>
|
||||||
* The default permissions are found in <code>org.alfresco.service.cmr.security.PermissionService</code>. Most commonly used are "Write", "Delete" and "AddChildren".
|
* The default permissions are found in <code>org.alfresco.service.cmr.security.PermissionService</code>.
|
||||||
|
* Most commonly used are "Write", "Delete" and "AddChildren".
|
||||||
*
|
*
|
||||||
* @param permission
|
* @param permission as found in <code>org.alfresco.service.cmr.security.PermissionService</code>
|
||||||
* as found in <code>org.alfresco.service.cmr.security.PermissionService</code>
|
|
||||||
* @return true if the user has the specified permission on the node.
|
* @return true if the user has the specified permission on the node.
|
||||||
*/
|
*/
|
||||||
public boolean hasPermission(String permission)
|
public boolean hasPermission(String permission)
|
||||||
@@ -699,8 +697,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Set the content for this node
|
* Set the content for this node
|
||||||
*
|
*
|
||||||
* @param content
|
* @param content Content string to set
|
||||||
* Content string to set
|
|
||||||
*/
|
*/
|
||||||
public void setContent(String content)
|
public void setContent(String content)
|
||||||
{
|
{
|
||||||
@@ -722,7 +719,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return For a content document, this method returns the URL to the content stream for the default content property (@see ContentModel.PROP_CONTENT)
|
* @return For a content document, this method returns the URL to the content stream for the default content
|
||||||
|
* property (@see ContentModel.PROP_CONTENT)
|
||||||
* <p>
|
* <p>
|
||||||
* For a container node, this method return the URL to browse to the folder in the web-client
|
* For a container node, this method return the URL to browse to the folder in the web-client
|
||||||
*/
|
*/
|
||||||
@@ -754,7 +752,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The mimetype encoding for content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)
|
* @return The mimetype encoding for content attached to the node from the default content property
|
||||||
|
* (@see ContentModel.PROP_CONTENT)
|
||||||
*/
|
*/
|
||||||
public String getMimetype()
|
public String getMimetype()
|
||||||
{
|
{
|
||||||
@@ -774,10 +773,10 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the mimetype encoding for the content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)
|
* Set the mimetype encoding for the content attached to the node from the default content property
|
||||||
|
* (@see ContentModel.PROP_CONTENT)
|
||||||
*
|
*
|
||||||
* @param mimetype
|
* @param mimetype Mimetype to set
|
||||||
* Mimetype to set
|
|
||||||
*/
|
*/
|
||||||
public void setMimetype(String mimetype)
|
public void setMimetype(String mimetype)
|
||||||
{
|
{
|
||||||
@@ -794,7 +793,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The size in bytes of the content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)
|
* @return The size in bytes of the content attached to the node from the default content property
|
||||||
|
* (@see ContentModel.PROP_CONTENT)
|
||||||
*/
|
*/
|
||||||
public long getSize()
|
public long getSize()
|
||||||
{
|
{
|
||||||
@@ -812,7 +812,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
{
|
{
|
||||||
return getSize();
|
return getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Security API
|
// Security API
|
||||||
|
|
||||||
@@ -827,8 +828,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Set whether this node should inherit permissions from the parent node.
|
* Set whether this node should inherit permissions from the parent node.
|
||||||
*
|
*
|
||||||
* @param inherit
|
* @param inherit True to inherit parent permissions, false otherwise.
|
||||||
* True to inherit parent permissions, false otherwise.
|
|
||||||
*/
|
*/
|
||||||
public void setInheritsPermissions(boolean inherit)
|
public void setInheritsPermissions(boolean inherit)
|
||||||
{
|
{
|
||||||
@@ -838,8 +838,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Apply a permission for ALL users to the node.
|
* Apply a permission for ALL users to the node.
|
||||||
*
|
*
|
||||||
* @param permission
|
* @param permission Permission to apply
|
||||||
* Permission to apply
|
|
||||||
* @see org.alfresco.service.cmr.security.PermissionService
|
* @see org.alfresco.service.cmr.security.PermissionService
|
||||||
*/
|
*/
|
||||||
public void setPermission(String permission)
|
public void setPermission(String permission)
|
||||||
@@ -851,11 +850,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Apply a permission for the specified authority (e.g. username or group) to the node.
|
* Apply a permission for the specified authority (e.g. username or group) to the node.
|
||||||
*
|
*
|
||||||
* @param permission
|
* @param permission Permission to apply @see org.alfresco.service.cmr.security.PermissionService
|
||||||
* Permission to apply
|
* @param authority Authority (generally a username or group name) to apply the permission for
|
||||||
* @see org.alfresco.service.cmr.security.PermissionService
|
|
||||||
* @param authority
|
|
||||||
* Authority (generally a username or group name) to apply the permission for
|
|
||||||
*/
|
*/
|
||||||
public void setPermission(String permission, String authority)
|
public void setPermission(String permission, String authority)
|
||||||
{
|
{
|
||||||
@@ -865,9 +861,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Remove a permission for ALL user from the node.
|
* Remove a permission for ALL user from the node.
|
||||||
*
|
*
|
||||||
* @param permission
|
* @param permission Permission to remove @see org.alfresco.service.cmr.security.PermissionService
|
||||||
* Permission to remove
|
|
||||||
* @see org.alfresco.service.cmr.security.PermissionService
|
|
||||||
*/
|
*/
|
||||||
public void removePermission(String permission)
|
public void removePermission(String permission)
|
||||||
{
|
{
|
||||||
@@ -878,17 +872,15 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Remove a permission for the specified authority (e.g. username or group) from the node.
|
* Remove a permission for the specified authority (e.g. username or group) from the node.
|
||||||
*
|
*
|
||||||
* @param permission
|
* @param permission Permission to remove @see org.alfresco.service.cmr.security.PermissionService
|
||||||
* Permission to remove
|
* @param authority Authority (generally a username or group name) to apply the permission for
|
||||||
* @see org.alfresco.service.cmr.security.PermissionService
|
|
||||||
* @param authority
|
|
||||||
* Authority (generally a username or group name) to apply the permission for
|
|
||||||
*/
|
*/
|
||||||
public void removePermission(String permission, String authority)
|
public void removePermission(String permission, String authority)
|
||||||
{
|
{
|
||||||
this.services.getPermissionService().deletePermission(this.nodeRef, authority, permission);
|
this.services.getPermissionService().deletePermission(this.nodeRef, authority, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Ownership API
|
// Ownership API
|
||||||
|
|
||||||
@@ -928,6 +920,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
return getOwner();
|
return getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Create and Modify API
|
// Create and Modify API
|
||||||
|
|
||||||
@@ -951,12 +944,13 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-sets the type of the node. Can be called in order specialise a node to a sub-type. This should be used with caution since calling it changes the type of the node and thus
|
* Re-sets the type of the node. Can be called in order specialise a node to a sub-type. This should be used
|
||||||
* implies a different set of aspects, properties and associations. It is the responsibility of the caller to ensure that the node is in a approriate state after changing the
|
* with caution since calling it changes the type of the node and thus* implies a different set of aspects,
|
||||||
* type.
|
* properties and associations. It is the responsibility of the caller to ensure that the node is in a
|
||||||
|
* approriate state after changing the type.
|
||||||
|
*
|
||||||
|
* @param type Type to specialize the node
|
||||||
*
|
*
|
||||||
* @param type
|
|
||||||
* Type to specialize the node
|
|
||||||
* @return true if successful, false otherwise
|
* @return true if successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean specializeType(String type)
|
public boolean specializeType(String type)
|
||||||
@@ -964,8 +958,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
QName qnameType = createQName(type);
|
QName qnameType = createQName(type);
|
||||||
|
|
||||||
// Ensure that we are performing a specialise
|
// Ensure that we are performing a specialise
|
||||||
if (getType().equals(qnameType) == false
|
if (getType().equals(qnameType) == false &&
|
||||||
&& this.services.getDictionaryService().isSubClass(qnameType, getType()) == true)
|
this.services.getDictionaryService().isSubClass(qnameType, getType()) == true)
|
||||||
{
|
{
|
||||||
// Specialise the type of the node
|
// Specialise the type of the node
|
||||||
try
|
try
|
||||||
@@ -988,8 +982,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
* <p>
|
* <p>
|
||||||
* Once created the file should have content set using the <code>content</code> property.
|
* Once created the file should have content set using the <code>content</code> property.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name Name of the file to create
|
||||||
* Name of the file to create
|
*
|
||||||
* @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 Node createFile(String name)
|
||||||
@@ -1021,8 +1015,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Create a new folder (cm:folder) node as a child of this node.
|
* Create a new folder (cm:folder) node as a child of this node.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name Name of the folder to create
|
||||||
* Name of the folder to create
|
*
|
||||||
* @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 Node createFolder(String name)
|
||||||
@@ -1054,10 +1048,9 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Create a new Node of the specified type as a child of this node.
|
* Create a new Node of the specified type as a child of this node.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name Name of the node to create
|
||||||
* Name of the node to create
|
* @param type QName type (can either be fully qualified or short form such as 'cm:content')
|
||||||
* @param type
|
*
|
||||||
* QName type (can either be fully qualified or short form such as 'cm:content')
|
|
||||||
* @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 Node createNode(String name, String type)
|
||||||
@@ -1114,8 +1107,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Copy this Node to a new parent destination. Note that children of the source Node are not copied.
|
* Copy this Node to a new parent destination. Note that children of the source Node are not copied.
|
||||||
*
|
*
|
||||||
* @param destination
|
* @param destination Node
|
||||||
* Node
|
*
|
||||||
* @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 Node copy(Node destination)
|
||||||
@@ -1126,10 +1119,9 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Copy this Node and potentially all child nodes to a new parent destination.
|
* Copy this Node and potentially all child nodes to a new parent destination.
|
||||||
*
|
*
|
||||||
* @param destination
|
* @param destination Node
|
||||||
* Node
|
* @param deepCopy True for a deep copy, false otherwise.
|
||||||
* @param deepCopy
|
*
|
||||||
* True for a deep copy, false otherwise.
|
|
||||||
* @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 Node copy(Node destination, boolean deepCopy)
|
||||||
@@ -1160,8 +1152,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Move this Node to a new parent destination.
|
* Move this Node to a new parent destination.
|
||||||
*
|
*
|
||||||
* @param destination
|
* @param destination Node
|
||||||
* Node
|
*
|
||||||
* @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(Node destination)
|
||||||
@@ -1196,8 +1188,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Add an aspect to the Node. As no properties are provided in this call, it can only be used to add aspects that do not require any mandatory properties.
|
* Add an aspect to the Node. As no properties are provided in this call, it can only be used to add aspects that do not require any mandatory properties.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type Type name of the aspect to add
|
||||||
* Type name of the aspect to add
|
*
|
||||||
* @return true if the aspect was added successfully, false if an error occured.
|
* @return true if the aspect was added successfully, false if an error occured.
|
||||||
*/
|
*/
|
||||||
public boolean addAspect(String type)
|
public boolean addAspect(String type)
|
||||||
@@ -1208,10 +1200,10 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Add an aspect to the Node.
|
* Add an aspect to the Node.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type Type name of the aspect to add
|
||||||
* Type name of the aspect to add
|
* @param props ScriptableObject (generally an assocative array) providing the named properties for the aspect
|
||||||
* @param props
|
* - any mandatory properties for the aspect must be provided!
|
||||||
* ScriptableObject (generally an assocative array) providing the named properties for the aspect - any mandatory properties for the aspect must be provided!
|
*
|
||||||
* @return true if the aspect was added successfully, false if an error occured.
|
* @return true if the aspect was added successfully, false if an error occured.
|
||||||
*/
|
*/
|
||||||
public boolean addAspect(String type, Object props)
|
public boolean addAspect(String type, Object props)
|
||||||
@@ -1267,6 +1259,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
* Remove aspect from the node.
|
* Remove aspect from the node.
|
||||||
*
|
*
|
||||||
* @param type the aspect type
|
* @param type the aspect type
|
||||||
|
*
|
||||||
* @return true if successful, false otherwise
|
* @return true if successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean removeAspect(String type)
|
public boolean removeAspect(String type)
|
||||||
@@ -1287,6 +1280,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Checkout/Checkin Services
|
// Checkout/Checkin Services
|
||||||
|
|
||||||
@@ -1329,8 +1323,9 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check-in a working copy document. The current state of the working copy is copied to the original node, this will include any content updated in the working node. Note that
|
* Check-in a working copy document. The current state of the working copy is copied to the original node,
|
||||||
* this method can only be called on a working copy Node.
|
* this will include any content updated in the working node. Note that this method can only be called on a
|
||||||
|
* working copy Node.
|
||||||
*
|
*
|
||||||
* @return the original Node that was checked out.
|
* @return the original Node that was checked out.
|
||||||
*/
|
*/
|
||||||
@@ -1340,11 +1335,12 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check-in a working copy document. The current state of the working copy is copied to the original node, this will include any content updated in the working node. Note that
|
* Check-in a working copy document. The current state of the working copy is copied to the original node,
|
||||||
* this method can only be called on a working copy Node.
|
* this will include any content updated in the working node. Note that this method can only be called on a
|
||||||
|
* working copy Node.
|
||||||
|
*
|
||||||
|
* @param history Version history note
|
||||||
*
|
*
|
||||||
* @param history
|
|
||||||
* Version history note
|
|
||||||
* @return the original Node that was checked out.
|
* @return the original Node that was checked out.
|
||||||
*/
|
*/
|
||||||
public Node checkin(String history)
|
public Node checkin(String history)
|
||||||
@@ -1353,13 +1349,13 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check-in a working copy document. The current state of the working copy is copied to the original node, this will include any content updated in the working node. Note that
|
* Check-in a working copy document. The current state of the working copy is copied to the original node,
|
||||||
* this method can only be called on a working copy Node.
|
* this will include any content updated in the working node. Note that this method can only be called on a
|
||||||
|
* working copy Node.
|
||||||
|
*
|
||||||
|
* @param history Version history note
|
||||||
|
* @param majorVersion True to save as a major version increment, false for minor version.
|
||||||
*
|
*
|
||||||
* @param history
|
|
||||||
* Version history note
|
|
||||||
* @param majorVersion
|
|
||||||
* True to save as a major version increment, false for minor version.
|
|
||||||
* @return the original Node that was checked out.
|
* @return the original Node that was checked out.
|
||||||
*/
|
*/
|
||||||
public Node checkin(String history, boolean majorVersion)
|
public Node checkin(String history, boolean majorVersion)
|
||||||
@@ -1372,8 +1368,9 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the check-out of a working copy document. The working copy will be deleted and any changes made to it are lost. Note that this method can only be called on a working
|
* Cancel the check-out of a working copy document. The working copy will be deleted and any changes made to it
|
||||||
* copy Node. The reference to this working copy Node should be discarded.
|
* are lost. Note that this method can only be called on a working copy Node. The reference to this working copy
|
||||||
|
* Node should be discarded.
|
||||||
*
|
*
|
||||||
* @return the original Node that was checked out.
|
* @return the original Node that was checked out.
|
||||||
*/
|
*/
|
||||||
@@ -1387,11 +1384,11 @@ public class Node implements Serializable, Scopeable
|
|||||||
// Transformation and Rendering API
|
// Transformation and Rendering API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform a document to a new document mimetype format. A copy of the document is made and the extension changed to match the new mimetype, then the transformation is
|
* Transform a document to a new document mimetype format. A copy of the document is made and the extension
|
||||||
* applied.
|
* changed to match the new mimetype, then the transformation isapplied.
|
||||||
|
*
|
||||||
|
* @param mimetype Mimetype destination for the transformation
|
||||||
*
|
*
|
||||||
* @param mimetype
|
|
||||||
* Mimetype destination for the transformation
|
|
||||||
* @return Node representing the newly transformed document.
|
* @return Node representing the newly transformed document.
|
||||||
*/
|
*/
|
||||||
public Node transformDocument(String mimetype)
|
public Node transformDocument(String mimetype)
|
||||||
@@ -1400,13 +1397,12 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform a document to a new document mimetype format. A copy of the document is made in the specified destination folder and the extension changed to match the new
|
* Transform a document to a new document mimetype format. A copy of the document is made in the specified
|
||||||
* mimetype, then then transformation is applied.
|
* destination folder and the extension changed to match the new mimetype, then then transformation is applied.
|
||||||
|
*
|
||||||
|
* @param mimetype Mimetype destination for the transformation
|
||||||
|
* @param destination Destination folder location
|
||||||
*
|
*
|
||||||
* @param mimetype
|
|
||||||
* Mimetype destination for the transformation
|
|
||||||
* @param destination
|
|
||||||
* Destination folder location
|
|
||||||
* @return Node representing the newly transformed document.
|
* @return Node representing the newly transformed document.
|
||||||
*/
|
*/
|
||||||
public Node transformDocument(String mimetype, Node destination)
|
public Node transformDocument(String mimetype, Node destination)
|
||||||
@@ -1445,12 +1441,10 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Generic method to transform Node content from one mimetype to another.
|
* Generic method to transform Node content from one mimetype to another.
|
||||||
*
|
*
|
||||||
* @param transformer
|
* @param transformer The Transformer delegate supplying the transformation logic
|
||||||
* The Transformer delegate supplying the transformation logic
|
* @param mimetype Mimetype of the destination content
|
||||||
* @param mimetype
|
* @param destination Destination folder location for the resulting document
|
||||||
* Mimetype of the destination content
|
*
|
||||||
* @param destination
|
|
||||||
* Destination folder location for the resulting document
|
|
||||||
* @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 Node transformNode(Transformer transformer, String mimetype, NodeRef destination)
|
||||||
@@ -1488,10 +1482,11 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an image to a new image format. A copy of the image document is made and the extension changed to match the new mimetype, then the transformation is applied.
|
* Transform an image to a new image format. A copy of the image document is made and the extension changed to
|
||||||
|
* match the new mimetype, then the transformation is applied.
|
||||||
|
*
|
||||||
|
* @param mimetype Mimetype destination for the transformation
|
||||||
*
|
*
|
||||||
* @param mimetype
|
|
||||||
* Mimetype destination for the transformation
|
|
||||||
* @return Node representing the newly transformed image.
|
* @return Node representing the newly transformed image.
|
||||||
*/
|
*/
|
||||||
public Node transformImage(String mimetype)
|
public Node transformImage(String mimetype)
|
||||||
@@ -1500,12 +1495,12 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an image to a new image format. A copy of the image document is made and the extension changed to match the new mimetype, then the transformation is applied.
|
* Transform an image to a new image format. A copy of the image document is made and the extension changed to
|
||||||
|
* match the new mimetype, then the transformation is applied.
|
||||||
|
*
|
||||||
|
* @param mimetype Mimetype destination for the transformation
|
||||||
|
* @param options Image convert command options
|
||||||
*
|
*
|
||||||
* @param mimetype
|
|
||||||
* Mimetype destination for the transformation
|
|
||||||
* @param options
|
|
||||||
* Image convert command options
|
|
||||||
* @return Node representing the newly transformed image.
|
* @return Node representing the newly transformed image.
|
||||||
*/
|
*/
|
||||||
public Node transformImage(String mimetype, String options)
|
public Node transformImage(String mimetype, String options)
|
||||||
@@ -1514,13 +1509,12 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an image to a new image mimetype format. A copy of the image document is made in the specified destination folder and the extension changed to match the new
|
* Transform an image to a new image mimetype format. A copy of the image document is made in the specified
|
||||||
* mimetype, then then transformation is applied.
|
* destination folder and the extension changed to match the newmimetype, then then transformation is applied.
|
||||||
|
*
|
||||||
|
* @param mimetype Mimetype destination for the transformation
|
||||||
|
* @param destination Destination folder location
|
||||||
*
|
*
|
||||||
* @param mimetype
|
|
||||||
* Mimetype destination for the transformation
|
|
||||||
* @param destination
|
|
||||||
* Destination folder location
|
|
||||||
* @return Node representing the newly transformed image.
|
* @return Node representing the newly transformed image.
|
||||||
*/
|
*/
|
||||||
public Node transformImage(String mimetype, Node destination)
|
public Node transformImage(String mimetype, Node destination)
|
||||||
@@ -1529,15 +1523,14 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an image to a new image mimetype format. A copy of the image document is made in the specified destination folder and the extension changed to match the new
|
* Transform an image to a new image mimetype format. A copy of the image document is made in the specified
|
||||||
|
* destination folder and the extension changed to match the new
|
||||||
* mimetype, then then transformation is applied.
|
* mimetype, then then transformation is applied.
|
||||||
*
|
*
|
||||||
* @param mimetype
|
* @param mimetype Mimetype destination for the transformation
|
||||||
* Mimetype destination for the transformation
|
* @param options Image convert command options
|
||||||
* @param options
|
* @param destination Destination folder location
|
||||||
* Image convert command options
|
*
|
||||||
* @param destination
|
|
||||||
* Destination folder location
|
|
||||||
* @return Node representing the newly transformed image.
|
* @return Node representing the newly transformed image.
|
||||||
*/
|
*/
|
||||||
public Node transformImage(String mimetype, String options, Node destination)
|
public Node transformImage(String mimetype, String options, Node destination)
|
||||||
@@ -1575,8 +1568,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Process a FreeMarker Template against the current node.
|
* Process a FreeMarker Template against the current node.
|
||||||
*
|
*
|
||||||
* @param template
|
* @param template Node of the template to execute
|
||||||
* Node of the template to execute
|
*
|
||||||
* @return output of the template execution
|
* @return output of the template execution
|
||||||
*/
|
*/
|
||||||
public String processTemplate(Node template)
|
public String processTemplate(Node template)
|
||||||
@@ -1587,10 +1580,10 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Process a FreeMarker Template against the current node.
|
* Process a FreeMarker Template against the current node.
|
||||||
*
|
*
|
||||||
* @param template
|
* @param template Node of the template to execute
|
||||||
* Node of the template to execute
|
* @param args Scriptable object (generally an associative array) containing the name/value pairs of
|
||||||
* @param args
|
* arguments to be passed to the template
|
||||||
* Scriptable object (generally an associative array) containing the name/value pairs of arguments to be passed to the template
|
*
|
||||||
* @return output of the template execution
|
* @return output of the template execution
|
||||||
*/
|
*/
|
||||||
public String processTemplate(Node template, Object args)
|
public String processTemplate(Node template, Object args)
|
||||||
@@ -1601,8 +1594,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Process a FreeMarker Template against the current node.
|
* Process a FreeMarker Template against the current node.
|
||||||
*
|
*
|
||||||
* @param template
|
* @param template The template to execute
|
||||||
* The template to execute
|
*
|
||||||
* @return output of the template execution
|
* @return output of the template execution
|
||||||
*/
|
*/
|
||||||
public String processTemplate(String template)
|
public String processTemplate(String template)
|
||||||
@@ -1613,10 +1606,10 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Process a FreeMarker Template against the current node.
|
* Process a FreeMarker Template against the current node.
|
||||||
*
|
*
|
||||||
* @param template
|
* @param template The template to execute
|
||||||
* The template to execute
|
* @param args Scriptable object (generally an associative array) containing the name/value pairs of
|
||||||
* @param args
|
* arguments to be passed to the template
|
||||||
* Scriptable object (generally an associative array) containing the name/value pairs of arguments to be passed to the template
|
*
|
||||||
* @return output of the template execution
|
* @return output of the template execution
|
||||||
*/
|
*/
|
||||||
public String processTemplate(String template, Object args)
|
public String processTemplate(String template, Object args)
|
||||||
@@ -1675,6 +1668,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
return this.services.getTemplateService().processTemplateString(null, template, model);
|
return this.services.getTemplateService().processTemplateString(null, template, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Helper methods
|
// Helper methods
|
||||||
|
|
||||||
@@ -1700,8 +1694,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Helper to create a QName from either a fully qualified or short-name QName string
|
* Helper to create a QName from either a fully qualified or short-name QName string
|
||||||
*
|
*
|
||||||
* @param s
|
* @param s Fully qualified or short-name QName string
|
||||||
* Fully qualified or short-name QName string
|
*
|
||||||
* @return QName
|
* @return QName
|
||||||
*/
|
*/
|
||||||
private QName createQName(String s)
|
private QName createQName(String s)
|
||||||
@@ -1739,10 +1733,9 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Return a list or a single Node from executing an xpath against the parent Node.
|
* Return a list or a single Node from executing an xpath against the parent Node.
|
||||||
*
|
*
|
||||||
* @param xpath
|
* @param xpath XPath to execute
|
||||||
* XPath to execute
|
* @param firstOnly True to return the first result only
|
||||||
* @param firstOnly
|
*
|
||||||
* True to return the first result only
|
|
||||||
* @return Node[] can be empty but never null
|
* @return Node[] can be empty but never null
|
||||||
*/
|
*/
|
||||||
private Node[] getChildrenByXPath(String xpath, boolean firstOnly)
|
private Node[] getChildrenByXPath(String xpath, boolean firstOnly)
|
||||||
@@ -1780,6 +1773,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
return result != null ? result : new Node[0];
|
return result != null ? result : new Node[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Value Conversion
|
// Value Conversion
|
||||||
|
|
||||||
@@ -1815,13 +1809,12 @@ public class Node implements Serializable, Scopeable
|
|||||||
public class NodeValueConverter extends ValueConverter
|
public class NodeValueConverter extends ValueConverter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Convert an object from any repository serialized value to a valid script object. This includes converting Collection multi-value properties into JavaScript Array
|
* Convert an object from any repository serialized value to a valid script object. This includes converting
|
||||||
* objects.
|
* Collection multi-value properties into JavaScript Array objects.
|
||||||
|
*
|
||||||
|
* @param qname QName of the property value for conversion
|
||||||
|
* @param value Property value
|
||||||
*
|
*
|
||||||
* @param qname
|
|
||||||
* QName of the property value for conversion
|
|
||||||
* @param value
|
|
||||||
* Property value
|
|
||||||
* @return Value safe for scripting usage
|
* @return Value safe for scripting usage
|
||||||
*/
|
*/
|
||||||
public Serializable convertValueForScript(QName qname, Serializable value)
|
public Serializable convertValueForScript(QName qname, Serializable value)
|
||||||
@@ -1832,8 +1825,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.alfresco.repo.jscript.ValueConverter#convertValueForScript(org.alfresco.service.ServiceRegistry, org.mozilla.javascript.Scriptable,
|
* @see org.alfresco.repo.jscript.ValueConverter#convertValueForScript(org.alfresco.service.ServiceRegistry,
|
||||||
* org.alfresco.service.namespace.QName, java.io.Serializable)
|
* org.mozilla.javascript.Scriptable, org.alfresco.service.namespace.QName, java.io.Serializable)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Serializable convertValueForScript(ServiceRegistry services, Scriptable scope, QName qname,
|
public Serializable convertValueForScript(ServiceRegistry services, Scriptable scope, QName qname,
|
||||||
@@ -1873,6 +1866,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Inner Classes
|
// Inner Classes
|
||||||
|
|
||||||
@@ -1886,10 +1880,8 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param contentData
|
* @param contentData The ContentData object this object wraps
|
||||||
* The ContentData object this object wraps
|
* @param property The property the ContentData is attached too
|
||||||
* @param property
|
|
||||||
* The property the ContentData is attached too
|
|
||||||
*/
|
*/
|
||||||
public ScriptContentData(ContentData contentData, QName property)
|
public ScriptContentData(ContentData contentData, QName property)
|
||||||
{
|
{
|
||||||
@@ -1916,8 +1908,7 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Set the content stream
|
* Set the content stream
|
||||||
*
|
*
|
||||||
* @param content
|
* @param content Content string to set
|
||||||
* Content string to set
|
|
||||||
*/
|
*/
|
||||||
public void setContent(String content)
|
public void setContent(String content)
|
||||||
{
|
{
|
||||||
@@ -2005,14 +1996,11 @@ public class Node implements Serializable, Scopeable
|
|||||||
/**
|
/**
|
||||||
* Transform the reader to the specified writer
|
* Transform the reader to the specified writer
|
||||||
*
|
*
|
||||||
* @param contentService
|
* @param contentService ContentService
|
||||||
* ContentService
|
* @param noderef NodeRef of the destination for the transform
|
||||||
* @param noderef
|
* @param reader Source reader
|
||||||
* NodeRef of the destination for the transform
|
* @param writer Destination writer
|
||||||
* @param reader
|
*
|
||||||
* Source reader
|
|
||||||
* @param writer
|
|
||||||
* Destination writer
|
|
||||||
* @return Node representing the transformed entity
|
* @return Node representing the transformed entity
|
||||||
*/
|
*/
|
||||||
Node transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer);
|
Node transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer);
|
||||||
|
Reference in New Issue
Block a user