Exemplo n.º 1
0
  @Override
  public void createDefaultWebsiteObjects(AplosContextListener aplosContextListener) {
    super.createDefaultWebsiteObjects(aplosContextListener);
    SystemUser adminUser = CommonConfiguration.getCommonConfiguration().getDefaultAdminUser();

    CssResource cssResource = new CssResource();
    cssResource.setParentWebsite(this);
    cssResource.setName("Main");
    cssResource.saveDetails(this, adminUser);
    setEditorCss(cssResource);
    saveDetails();

    CmsDatabaseLoader.createMenus(this, adminUser);
    TopLevelTemplate mainTemplate = getOrCreateMainTemplate(adminUser);
    TopLevelTemplate holdingTemplate = CmsDatabaseLoader.createHoldingTemplate(this, adminUser);
    CmsDatabaseLoader.createDefaultUserCmsModules(this, adminUser);
    CmsDatabaseLoader.createDefaultPages(this, mainTemplate, holdingTemplate, adminUser);
  }
Exemplo n.º 2
0
 protected TopLevelTemplate getOrCreateMainTemplate(SystemUser adminUser) {
   if (getMainTemplate() == null) {
     BeanDao dao = new BeanDao(TopLevelTemplate.class);
     dao.setWhereCriteria("bean.name='Main' and bean.parentWebsite.id = " + getId());
     dao.setMaxResults(1);
     this.setMainTemplate(
         (TopLevelTemplate) dao.setIsReturningActiveBeans(true).getFirstBeanResult());
   }
   if (getMainTemplate() == null) {
     this.setMainTemplate(
         CmsDatabaseLoader.createMainTemplate(this, this.getMainMenu(), adminUser));
   }
   return getMainTemplate();
 }