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?
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:
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.