Search in sources :

Example 1 with StructureType

use of com.ableneo.liferay.portal.setup.domain.StructureType in project liferay-db-setup-core by ableneo.

the class SetupArticles method setupSiteStructuresAndTemplates.

public static void setupSiteStructuresAndTemplates(final Site site, long groupId) throws PortalException {
    List<StructureType> articleStructures = site.getArticleStructure();
    if (articleStructures != null && false == articleStructures.isEmpty()) {
        long classNameId = ClassNameLocalServiceUtil.getClassNameId(JournalArticle.class);
        for (StructureType structure : articleStructures) {
            addDDMStructure(structure, groupId, classNameId);
        }
    }
    List<StructureType> ddlStructures = site.getDdlStructure();
    if (ddlStructures != null && false == ddlStructures.isEmpty()) {
        long classNameId = ClassNameLocalServiceUtil.getClassNameId(DDLRecordSet.class);
        for (StructureType structure : ddlStructures) {
            LOG.info(String.format("Adding DDL structure %1$s", structure.getName()));
            addDDMStructure(structure, groupId, classNameId);
        }
    }
    List<ArticleTemplate> articleTemplates = site.getArticleTemplate();
    if (articleTemplates != null) {
        for (ArticleTemplate template : articleTemplates) {
            try {
                addDDMTemplate(template, groupId);
            } catch (TemplateDuplicateTemplateKeyException e) {
                LOG.error(e);
            }
        }
    }
}
Also used : StructureType(com.ableneo.liferay.portal.setup.domain.StructureType) ArticleTemplate(com.ableneo.liferay.portal.setup.domain.ArticleTemplate) TemplateDuplicateTemplateKeyException(com.liferay.dynamic.data.mapping.exception.TemplateDuplicateTemplateKeyException)

Aggregations

ArticleTemplate (com.ableneo.liferay.portal.setup.domain.ArticleTemplate)1 StructureType (com.ableneo.liferay.portal.setup.domain.StructureType)1 TemplateDuplicateTemplateKeyException (com.liferay.dynamic.data.mapping.exception.TemplateDuplicateTemplateKeyException)1