Package org.alfresco.repo.template
Class TemplateNode
- java.lang.Object
-
- org.alfresco.repo.template.BaseContentNode
-
- org.alfresco.repo.template.BasePermissionsNode
-
- org.alfresco.repo.template.TemplateNode
-
- All Implemented Interfaces:
java.io.Serializable,TemplateContent,TemplateNodeRef,TemplatePermissions,TemplateProperties,org.alfresco.service.namespace.NamespacePrefixResolverProvider
- Direct Known Subclasses:
CategoryTemplateNode
public class TemplateNode extends BasePermissionsNode implements org.alfresco.service.namespace.NamespacePrefixResolverProvider
Node class specific for use by Template pages that support Bean objects as part of the model. The default template engine FreeMarker can use these objects and they are provided to support it. A single method is completely freemarker specific - getXmlNodeModel()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 Template_Guide
- Author:
- Kevin Roast
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classTemplateNode.TemplateAuditInfo-
Nested classes/interfaces inherited from class org.alfresco.repo.template.BaseContentNode
BaseContentNode.TemplateContentData
-
-
Field Summary
Fields Modifier and Type Field Description protected org.alfresco.service.cmr.repository.NodeRefnodeRefCached values-
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
Constructors Constructor Description TemplateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.util.List<TemplateNode>>getAssociations()java.util.Map<java.lang.String,java.util.List<TemplateNode>>getAssocs()java.util.List<TemplateNode.TemplateAuditInfo>getAuditTrail()java.util.Map<java.lang.String,java.util.List<TemplateNode>>getChildAssociations()java.util.Map<java.lang.String,java.util.List<TemplateNode>>getChildAssocs()java.util.List<TemplateNode>getChildAssocsByType(java.lang.String type)java.util.MapgetChildByNamePath()java.util.MapgetChildrenByLuceneSearch()java.util.MapgetChildrenBySavedSearch()java.util.MapgetChildrenByXPath()booleangetExists()java.lang.StringgetId()TemplateImageResolvergetImageResolver()booleangetIsCategory()booleangetIsLocked()booleangetIsWorkingCopy()java.lang.StringgetName()org.alfresco.service.namespace.NamespacePrefixResolvergetNamespacePrefixResolver()java.util.MapgetNodeByReference()org.alfresco.service.cmr.repository.NodeRefgetNodeRef()TemplatePropertiesgetParent()java.lang.StringgetParentTypeShort()org.alfresco.service.cmr.repository.ChildAssociationRefgetPrimaryParentAssoc()java.util.Map<java.lang.String,java.io.Serializable>getProperties()java.lang.StringgetShareUrl()This method returns a URL string which resolves to an Alfresco Share view of this node.java.util.Map<java.lang.String,java.util.List<TemplateNode>>getSourceAssociations()java.util.Map<java.lang.String,java.util.List<TemplateNode>>getSourceAssocs()java.lang.StringgetStoreId()java.lang.StringgetStoreType()org.alfresco.service.namespace.QNamegetType()java.lang.StringgetTypeShort()java.util.List<VersionHistoryNode>getVersionHistory()freemarker.ext.dom.NodeModelgetXmlNodeModel()-
Methods inherited from class org.alfresco.repo.template.BasePermissionsNode
getDirectPermissions, getFullPermissions, getInheritsPermissions, getPermissions, hasPermission
-
Methods inherited from class org.alfresco.repo.template.BaseContentNode
getAspects, getChildren, getContent, getDisplayMimetype, getDisplayPath, getDownloadUrl, getEncoding, getHasChildren, getIcon16, getIcon32, getIcon64, getIsContainer, getIsDocument, getIsLinkToContainer, getIsLinkToDocument, getMimetype, getQnamePath, getServiceUrl, getSiteShortName, getSize, getUrl, getWebdavUrl, hasAspect, isTemplateContent, isTemplateNodeRef, toString
-
-
-
-
Constructor Detail
-
TemplateNode
public TemplateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver)Constructor- Parameters:
nodeRef- The NodeRef this Node wrapper representsservices- The ServiceRegistry the TemplateNode can use to access servicesresolver- Image resolver to use to retrieve icons
-
-
Method Detail
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceTemplateNodeRef- Returns:
- The GUID for the node
-
getStoreType
public java.lang.String getStoreType()
- Returns:
- the store type for the node
-
getStoreId
public java.lang.String getStoreId()
- Returns:
- the store id for the node
-
getNodeRef
public org.alfresco.service.cmr.repository.NodeRef getNodeRef()
- Specified by:
getNodeRefin interfaceTemplateNodeRef- Returns:
- Returns the NodeRef this Node object represents
-
getExists
public boolean getExists()
- Returns:
trueif this node still exists
-
getIsWorkingCopy
public boolean getIsWorkingCopy()
- Returns:
trueif this node is a working copy
-
getType
public org.alfresco.service.namespace.QName getType()
- Specified by:
getTypein interfaceTemplateNodeRef- Returns:
- Returns the type.
-
getParentTypeShort
public java.lang.String getParentTypeShort()
- Returns:
- Returns the type of the parent
-
getTypeShort
public java.lang.String getTypeShort()
- Returns:
- Returns the type in short format.
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceTemplateNodeRef- Returns:
- The display name for the node
-
getProperties
public java.util.Map<java.lang.String,java.io.Serializable> getProperties()
- Specified by:
getPropertiesin interfaceTemplateProperties- Returns:
- All the properties known about this node.
-
getAssocs
public java.util.Map<java.lang.String,java.util.List<TemplateNode>> getAssocs()
- Returns:
- Target associations for this Node. As a Map of assoc name to a List of TemplateNodes.
-
getAssociations
public java.util.Map<java.lang.String,java.util.List<TemplateNode>> getAssociations()
-
getSourceAssocs
public java.util.Map<java.lang.String,java.util.List<TemplateNode>> getSourceAssocs()
- Returns:
- Source associations for this Node. As a Map of assoc name to a List of TemplateNodes.
-
getSourceAssociations
public java.util.Map<java.lang.String,java.util.List<TemplateNode>> getSourceAssociations()
-
getChildAssocs
public java.util.Map<java.lang.String,java.util.List<TemplateNode>> getChildAssocs()
- Returns:
- The child associations for this Node. As a Map of assoc name to a List of TemplateNodes.
-
getChildAssociations
public java.util.Map<java.lang.String,java.util.List<TemplateNode>> getChildAssociations()
-
getChildAssocsByType
public java.util.List<TemplateNode> getChildAssocsByType(java.lang.String type)
- Returns:
- The list of children of this Node that match a specific object type.
-
getIsLocked
public boolean getIsLocked()
- Returns:
- true if the node is currently locked
-
getIsCategory
public boolean getIsCategory()
- Returns:
- true if the node is a Category instance
-
getParent
public TemplateProperties getParent()
- Specified by:
getParentin interfaceTemplateProperties- Returns:
- the primary parent node
-
getPrimaryParentAssoc
public org.alfresco.service.cmr.repository.ChildAssociationRef getPrimaryParentAssoc()
- Returns:
- the primary parent association so we can access the association QName and association type QName.
-
getVersionHistory
public java.util.List<VersionHistoryNode> getVersionHistory()
- Returns:
- a list of objects representing the version history of this node.
- See Also:
VersionHistoryNode
-
getXmlNodeModel
public freemarker.ext.dom.NodeModel getXmlNodeModel()
- Returns:
- FreeMarker NodeModel for the XML content of this node, or null if no parsable XML found
-
getChildByNamePath
public java.util.Map getChildByNamePath()
- Returns:
- A map capable of returning the TemplateNode at the specified Path as a child of this node.
-
getChildrenByXPath
public java.util.Map getChildrenByXPath()
- Returns:
- A map capable of returning a List of TemplateNode objects from an XPath query as children of this node.
-
getChildrenBySavedSearch
public java.util.Map getChildrenBySavedSearch()
- Returns:
- A map capable of returning a List of TemplateNode objects from an NodeRef to a Saved Search object. The Saved Search is executed and the resulting nodes supplied as a sequence.
-
getChildrenByLuceneSearch
public java.util.Map getChildrenByLuceneSearch()
- Returns:
- A map capable of returning a List of TemplateNode objects from an NodeRef to a Lucene search string. The Saved Search is executed and the resulting nodes supplied as a sequence.
-
getNodeByReference
public java.util.Map getNodeByReference()
- Returns:
- A map capable of returning a TemplateNode for a single specified NodeRef reference.
-
getAuditTrail
public java.util.List<TemplateNode.TemplateAuditInfo> getAuditTrail()
- Returns:
- a list of AuditInfo objects describing the Audit Trail for this node instance
-
getImageResolver
public TemplateImageResolver getImageResolver()
- Returns:
- the image resolver instance used by this node
-
getShareUrl
public java.lang.String getShareUrl()
This method returns a URL string which resolves to an Alfresco Share view of this node. Note that in order for this method to return meaningful data, thesysAdminParamsbean must have been configured. Currently this method only produces valid URls for documents and not for folders.
-
getNamespacePrefixResolver
public org.alfresco.service.namespace.NamespacePrefixResolver getNamespacePrefixResolver()
- Specified by:
getNamespacePrefixResolverin interfaceorg.alfresco.service.namespace.NamespacePrefixResolverProvider
-
-