org.alfresco.repo.template
Class AVMTemplateNode

java.lang.Object
  extended by org.alfresco.repo.template.BaseContentNode
      extended by org.alfresco.repo.template.BasePermissionsNode
          extended by org.alfresco.repo.template.AVMTemplateNode
All Implemented Interfaces:
java.io.Serializable, TemplateContent, TemplateNodeRef, TemplatePermissions, TemplateProperties, org.alfresco.service.namespace.NamespacePrefixResolverProvider

public class AVMTemplateNode
extends BasePermissionsNode
implements org.alfresco.service.namespace.NamespacePrefixResolverProvider

AVM node class for use by a Template model.

The class exposes Node properties, children as dynamically populated maps and lists.

Various helper methods are provided to access common and useful node variables such as the content url and type information.

See http://wiki.alfresco.com/wiki/Template_Guide

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.alfresco.repo.template.BaseContentNode
BaseContentNode.TemplateContentData
 
Field Summary
 
Fields inherited from class org.alfresco.repo.template.BaseContentNode
aspects, children, CONTENT_DOWNLOAD_PROP_URL, CONTENT_DOWNLOAD_URL, CONTENT_GET_PROP_URL, CONTENT_GET_URL, CONTENT_SERVICE_GET_PROP_URL, CONTENT_SERVICE_GET_URL, FOLDER_BROWSE_URL, imageResolver, NAMESPACE_BEGIN, services
 
Constructor Summary
AVMTemplateNode(AVMNodeDescriptor descriptor, ServiceRegistry services, TemplateImageResolver resolver)
          Constructor
AVMTemplateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver)
          Constructor
AVMTemplateNode(java.lang.String path, int version, ServiceRegistry services, TemplateImageResolver resolver)
          Constructor
 
Method Summary
 java.util.Set getAspects()
           
 java.util.List getChildren()
           
 java.lang.String getContent()
           
 java.lang.String getDisplayMimetype()
           
 java.lang.String getDisplayPath()
           
 java.lang.String getDownloadUrl()
           
 java.lang.String getEncoding()
           
 boolean getHasLockAccess()
           
 java.lang.String getId()
           
 boolean getIsContainer()
           
 boolean getIsDeleted()
           
 boolean getIsDocument()
           
 boolean getIsLocked()
           
 boolean getIsLockOwner()
           
 java.lang.String getMimetype()
           
 java.lang.String getName()
           
 org.alfresco.service.namespace.NamespacePrefixResolver getNamespacePrefixResolver()
           
 org.alfresco.service.cmr.repository.NodeRef getNodeRef()
           
 TemplateProperties getParent()
           
 java.lang.String getParentPath()
           
 java.lang.String getPath()
           
 java.util.Map getProperties()
           
 long getSize()
           
 org.alfresco.service.namespace.QName getType()
           
 java.lang.String getUrl()
           
 int getVersion()
           
 freemarker.ext.dom.NodeModel getXmlNodeModel()
           
 
Methods inherited from class org.alfresco.repo.template.BasePermissionsNode
getDirectPermissions, getFullPermissions, getInheritsPermissions, getPermissions, hasPermission
 
Methods inherited from class org.alfresco.repo.template.BaseContentNode
getHasChildren, getIcon16, getIcon32, getIcon64, getIsLinkToContainer, getIsLinkToDocument, getQnamePath, getServiceUrl, getSiteShortName, getWebdavUrl, hasAspect, isTemplateContent, isTemplateNodeRef, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AVMTemplateNode

public AVMTemplateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                       ServiceRegistry services,
                       TemplateImageResolver resolver)
Constructor

Parameters:
nodeRef - The NodeRef for the AVM node this wrapper represents
services - The ServiceRegistry the Node can use to access services
resolver - Image resolver to use to retrieve icons

AVMTemplateNode

public AVMTemplateNode(java.lang.String path,
                       int version,
                       ServiceRegistry services,
                       TemplateImageResolver resolver)
Constructor

Parameters:
path - AVM path to the node
version - Version number for avm path
services - The ServiceRegistry the Node can use to access services
resolver - Image resolver to use to retrieve icons

AVMTemplateNode

public AVMTemplateNode(AVMNodeDescriptor descriptor,
                       ServiceRegistry services,
                       TemplateImageResolver resolver)
Constructor

Parameters:
descriptor - AVMNodeDescriptior
services -
resolver -
Method Detail

getId

public java.lang.String getId()
Specified by:
getId in interface TemplateNodeRef
Returns:
ID for the AVM path - the path.

getPath

public java.lang.String getPath()
Returns:
the path for this AVM node.

getVersion

public int getVersion()
Returns:
the version part of the AVM path.

getName

public java.lang.String getName()
Specified by:
getName in interface TemplateNodeRef
Returns:
file/folder name of the AVM path.

getParentPath

public java.lang.String getParentPath()
Returns:
AVM path to the parent node

getNodeRef

public org.alfresco.service.cmr.repository.NodeRef getNodeRef()
Specified by:
getNodeRef in interface TemplateNodeRef
Returns:
Returns the NodeRef this Node object represents
See Also:
TemplateNodeRef.getNodeRef()

getType

public org.alfresco.service.namespace.QName getType()
Specified by:
getType in interface TemplateNodeRef
Returns:
Returns the type.
See Also:
TemplateNodeRef.getType()

getIsDeleted

public boolean getIsDeleted()
Returns:
true if the item is a deleted node, false otherwise

getIsLocked

public boolean getIsLocked()
Returns:
true if the node is currently locked

getIsLockOwner

public boolean getIsLockOwner()
Returns:
true if this node is locked and the current user is the lock owner

getHasLockAccess

public boolean getHasLockAccess()
Returns:
true if this user can perform operations on the node when locked. This is true if the item is either unlocked, or locked and the current user is the lock owner, or locked and the current user has Content Manager role in the associated web project.

getParent

public TemplateProperties getParent()
Specified by:
getParent in interface TemplateProperties
Returns:
the immediate parent in the node path (null if root of store)

getIsContainer

public boolean getIsContainer()
Overrides:
getIsContainer in class BaseContentNode
Returns:
true if this Node is a container (i.e. a folder)

getIsDocument

public boolean getIsDocument()
Overrides:
getIsDocument in class BaseContentNode
Returns:
true if this Node is a document (i.e. a file)

getChildren

public java.util.List getChildren()
Specified by:
getChildren in interface TemplateProperties
Overrides:
getChildren in class BaseContentNode
Returns:
The children of this Node as objects that support the TemplateProperties contract.
See Also:
TemplateProperties.getChildren()

getProperties

public java.util.Map getProperties()
Specified by:
getProperties in interface TemplateProperties
Returns:
The properties available on this node.
See Also:
TemplateProperties.getProperties()

getAspects

public java.util.Set getAspects()
Specified by:
getAspects in interface TemplateProperties
Overrides:
getAspects in class BaseContentNode
Returns:
The list of aspects applied to this node

getContent

public java.lang.String getContent()
Specified by:
getContent in interface TemplateContent
Overrides:
getContent in class BaseContentNode
Returns:
the content String for this node from the default content property (@see ContentModel.PROP_CONTENT)

getUrl

public java.lang.String getUrl()
Specified by:
getUrl in interface TemplateContent
Overrides:
getUrl in class BaseContentNode
Returns:
For a content document, this method returns the URL to the content stream for the default content property (@see ContentModel.PROP_CONTENT)

For a container node, this method return the URL to browse to the folder in the web-client


getDownloadUrl

public java.lang.String getDownloadUrl()
Specified by:
getDownloadUrl in interface TemplateContent
Overrides:
getDownloadUrl in class BaseContentNode
Returns:
For a content document, this method returns the download URL to the content for the default content property (@see ContentModel.PROP_CONTENT)

For a container node, this method returns an empty string


getMimetype

public java.lang.String getMimetype()
Specified by:
getMimetype in interface TemplateContent
Overrides:
getMimetype in class BaseContentNode
Returns:
The mimetype encoding for content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)

getDisplayMimetype

public java.lang.String getDisplayMimetype()
Overrides:
getDisplayMimetype in class BaseContentNode
Returns:
The display label of the mimetype encoding for content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)

getEncoding

public java.lang.String getEncoding()
Overrides:
getEncoding in class BaseContentNode
Returns:
The character encoding for content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)

getSize

public long getSize()
Specified by:
getSize in interface TemplateContent
Overrides:
getSize in class BaseContentNode
Returns:
The size in bytes of the content attached to the node from the default content property (@see ContentModel.PROP_CONTENT)

getXmlNodeModel

public freemarker.ext.dom.NodeModel getXmlNodeModel()
Returns:
FreeMarker NodeModel for the XML content of this node, or null if no parsable XML found

getDisplayPath

public java.lang.String getDisplayPath()
Overrides:
getDisplayPath in class BaseContentNode
Returns:
Display path to this node - the path built of 'cm:name' attribute values.

getNamespacePrefixResolver

public org.alfresco.service.namespace.NamespacePrefixResolver getNamespacePrefixResolver()
Specified by:
getNamespacePrefixResolver in interface org.alfresco.service.namespace.NamespacePrefixResolverProvider


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.