SiteDefinitions sitedefs = (SiteDefinitions) ExtensionManager.getInstance().getBean("olatsites");
List<SiteDefinition> sitedeflist = sitedefs.getSiteDefList();
for (Iterator<SiteDefinition> it_sites = sitedeflist.iterator(); it_sites.hasNext();) {
SiteDefinition sitedef = it_sites.next();
SiteInstance site = sitedef.createSite(ureq, wControl);
if (site != null) {
// site == null means that site is not visible to the current user
sites.add(site);
}
}
// let all extensions add sitedefinitions
ExtManager extm = ExtManager.getInstance();
Class extensionPointSites = DTabs.class;
int cnt = extm.getExtensionCnt();
for (int i = 0; i < cnt; i++) {
Extension anExt = extm.getExtension(i);
// check for sites
SitesCreator sc = (SitesCreator) anExt.getExtensionFor(extensionPointSites.getName());
if (sc != null) {
List extsitedefs = sc.createSiteDefinitions();
for (Iterator it_extsites = extsitedefs.iterator(); it_extsites.hasNext();) {
SiteDefinition sdef = (SiteDefinition) it_extsites.next();
SiteInstance si = sdef.createSite(ureq, wControl);
sites.add(si);
extm.inform(extensionPointSites, anExt, "added sitedefinition " + sdef.getClass().getName());
}
}
}