Powered By Blogger

Tuesday, November 3, 2015

Getting NodeRef of CompanyHome

 NodeRef getCompanyHomeNodeRef(){
        NodeRef companyNoderef = null ;
        NodeRef parentRef =    nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
        //NodeRef companyNodeRef  = nodeService.getChildByName(parentRef, ContentModel.ASSOC_CONTAINS, "Company Home");
        QName qname = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "company_home");
        List assocRefs = nodeService.getChildAssocs(parentRef, ContentModel.ASSOC_CHILDREN, qname);
        if(assocRefs != null){
            companyNoderef =  assocRefs.get(0).getChildRef();
        }else{
            LOGGER.error("Not able to find the Company Home nodeReference");
        }      
        return companyNoderef;
    }