From 9262b37012eab31201b5d612b737a817bb4069ef Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 3 Oct 2018 09:23:46 +0000 Subject: [PATCH] CCM NG: Im/Exporter for CcmApplication git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5708 8810af33-2d31-482b-a856-94f89814c4df --- .../libreccm/web/ApplicationImExporter.java | 55 +++++++++++++++++++ .../java/org/libreccm/web/CcmApplication.java | 3 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 ccm-core/src/main/java/org/libreccm/web/ApplicationImExporter.java diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationImExporter.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationImExporter.java new file mode 100644 index 000000000..3c790cdfa --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationImExporter.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2018 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.web; + +import org.libreccm.imexport.AbstractEntityImExporter; +import org.libreccm.imexport.Processes; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.transaction.Transactional; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Processes(CcmApplication.class) +public class ApplicationImExporter + extends AbstractEntityImExporter{ + + @Inject + private ApplicationRepository applicationRepository; + + @Override + protected Class getEntityClass() { + + return CcmApplication.class; + } + + @Override + @Transactional(Transactional.TxType.REQUIRED) + protected void saveImportedEntity(final CcmApplication entity) { + + applicationRepository.save(entity); + } + + + +} diff --git a/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java b/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java index 9eee2bc76..9b986040c 100644 --- a/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java +++ b/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java @@ -81,7 +81,8 @@ import javax.persistence.Table; @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, resolver = ApplicationIdResolver.class, property = "uuid") -public class CcmApplication extends Resource implements Serializable, Portable, Exportable { +public class CcmApplication extends Resource implements Serializable, + Exportable { private static final long serialVersionUID = 9205226362368890784L;