try {
JCRSessionWrapper currentUserSession = JCRSessionFactory.getInstance().getCurrentUserSession();
if (StringUtils.isNotEmpty(siteId)) {
return currentUserSession.getNodeByUUID(siteId).getResolveSite();
} else {
JahiaSitesBaseService siteService = JahiaSitesBaseService.getInstance();
JahiaSite defaultSite = siteService.getDefaultSite();
if (defaultSite != null) {
return (JCRSiteNode) currentUserSession.getNodeByUUID(defaultSite.getUuid());
}
}
} catch (RepositoryException e) {