public static Resource getOrCreateChild ( Resource resource , String relPath , String primaryTypes ) throws RepositoryException { Resource child = null ; if ( resource != null ) { ResourceResolver resolver = resource . getResourceResolver ( ) ; String path = resource . getPath ( ) ; while ( relPath . startsWith ( "/" ) ) { relPath = relPath . substring ( 1 ) ; } if ( StringUtils . isNotBlank ( relPath ) ) { path += "/" + relPath ; } child = getOrCreateResource ( resolver , path , primaryTypes ) ; } return child ; }
Retrieves the resources child resource creates this child if not existing .