From 7e760cc9d0110a0139c6e4e09198b19928dcd622 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Thu, 3 Dec 2020 20:26:50 +0100 Subject: [PATCH] Im/Exporter for ContentSections Former-commit-id: f9e8311694f0f0acf85a107648a37d4908ea4ea6 --- .../ContentSectionImExporter.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java new file mode 100644 index 000000000..78135dee8 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java @@ -0,0 +1,47 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.librecms.contentsection; + +import org.libreccm.imexport.AbstractEntityImExporter; +import org.libreccm.imexport.Exportable; +import org.libreccm.imexport.Processes; + +import java.util.Collections; +import java.util.Set; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.transaction.Transactional; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Processes(ContentSection.class) +public class ContentSectionImExporter + extends AbstractEntityImExporter { + + @Inject + private ContentSectionRepository sectionRepository; + + @Override + protected Class getEntityClass() { + return ContentSection.class; + } + + @Override + protected Set> getRequiredEntities() { + return Collections.emptySet(); + } + + @Override + @Transactional(Transactional.TxType.REQUIRED) + protected void saveImportedEntity(final ContentSection entity) { + sectionRepository.save(entity); + } + +}