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