Provide a way to dependencies to the CategorizationImExporter
Former-commit-id: ed13e31429
pull/2/head
parent
1511873311
commit
7f3dfd5dd5
|
|
@ -25,6 +25,8 @@ import org.libreccm.imexport.Processes;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.enterprise.inject.Instance;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -33,6 +35,7 @@ import javax.transaction.Transactional;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
@RequestScoped
|
||||||
@Processes(Categorization.class)
|
@Processes(Categorization.class)
|
||||||
public class CategorizationImExporter
|
public class CategorizationImExporter
|
||||||
extends AbstractEntityImExporter<Categorization> {
|
extends AbstractEntityImExporter<Categorization> {
|
||||||
|
|
@ -40,6 +43,9 @@ public class CategorizationImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Instance<CategorizationImExporterDependenciesProvider> dependenciesProviders;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<Categorization> getEntityClass() {
|
protected Class<Categorization> getEntityClass() {
|
||||||
|
|
||||||
|
|
@ -52,6 +58,10 @@ public class CategorizationImExporter
|
||||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
||||||
entities.add(Category.class);
|
entities.add(Category.class);
|
||||||
|
|
||||||
|
dependenciesProviders.forEach(
|
||||||
|
provider -> entities.addAll(provider.getCategorizableEntities())
|
||||||
|
);
|
||||||
|
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* 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.libreccm.categorization;
|
||||||
|
|
||||||
|
import org.libreccm.imexport.Exportable;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public interface CategorizationImExporterDependenciesProvider {
|
||||||
|
|
||||||
|
Set<Class<Exportable>> getCategorizableEntities();
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue