ImExporters for Article, News and Event
parent
fcae87d7f9
commit
f9f1124a71
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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.categorization.Category;
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
||||
extends AbstractEntityImExporter<T> {
|
||||
|
||||
@Inject
|
||||
private ContentItemRepository itemRepository;
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
|
||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
||||
entities.add(Category.class);
|
||||
entities.add(ContentSection.class);
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void saveImportedEntity(final T entity) {
|
||||
itemRepository.save(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -56,6 +56,7 @@ import org.hibernate.search.annotations.IndexedEmbedded;
|
|||
import javax.persistence.FetchType;
|
||||
|
||||
import org.hibernate.envers.NotAudited;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||
|
||||
import javax.persistence.OrderBy;
|
||||
|
|
@ -594,7 +595,7 @@ import javax.persistence.OrderBy;
|
|||
+ " )"
|
||||
)
|
||||
})
|
||||
public class ContentItem extends CcmObject implements Serializable {
|
||||
public class ContentItem extends CcmObject implements Serializable, Exportable {
|
||||
|
||||
private static final long serialVersionUID = 5897287630227129653L;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.security.RecursivePermissions;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
|
@ -116,7 +117,9 @@ import static org.librecms.CmsConstants.*;
|
|||
// creator = ContentSectionCreator.class,
|
||||
// servlet = ContentSectionServlet.class,
|
||||
// instanceForm = ApplicationInstanceForm.class)
|
||||
public class ContentSection extends CcmApplication implements Serializable {
|
||||
public class ContentSection
|
||||
extends CcmApplication
|
||||
implements Serializable, Exportable {
|
||||
|
||||
private static final long serialVersionUID = -671718122153931727L;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.contenttypes;
|
||||
|
||||
import org.libreccm.imexport.Processes;
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Processes(Article.class)
|
||||
public class ArticleImExporter extends AbstractContentItemImExporter<Article> {
|
||||
|
||||
@Override
|
||||
protected Class<Article> getEntityClass() {
|
||||
return Article.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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.contenttypes;
|
||||
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class EventImExporter extends AbstractContentItemImExporter<Event> {
|
||||
|
||||
@Override
|
||||
protected Class<Event> getEntityClass() {
|
||||
return Event.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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.contenttypes;
|
||||
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class NewsImExporter extends AbstractContentItemImExporter<News> {
|
||||
|
||||
@Override
|
||||
protected Class<News> getEntityClass() {
|
||||
return News.class;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue