05-13-2020 12:59 PM
I have a particular nodeRef variable and nodeService variable in scope inside the java code/method. How can I know the type of the nodeRef - whether it is of type contnet, or type folder.
It seems that nodeRef ( org.alfresco.service.cmr.repository.NodeRef API does not offer any method like getType, or getNodeType.
With nodeRef in scope, how can I know whether the type is content or folder?
05-13-2020 05:05 PM
Well you are looking into wrong class. You have nodeRef and nodeService.
when you call nodeService.getType(nodeRef), you will get the type as QName.
final QName nodeType = nodeService.getType(nodeRef); Some examples: If nodeRef is of content type (cm:content), you will get following result when you print the node type: {http://www.alfresco.org/model/content/1.0}content If nodeRef is of content type (cm:folder), you will get following result when you print the node type: {http://www.alfresco.org/model/content/1.0}folder If nodeRef is of custom type (demo:whitePaper), you will get following result when you print the node type: {http://www.xyz.com/model/demo/1.0}whitePaper (here http://www.xyz.com/model/demo/1.0 is namespace of your custom model) Refer this javadoc to know more about QName : http://dev.alfresco.com/resource/AlfrescoOne/5.0/PublicAPI/org/alfresco/service/namespace/QName.html
Refer this javadoc for more detail on nodeService methods and getType method:
Explore our Alfresco products with the links below. Use labels to filter content by product module.