Improved handling of required entities in ImExporters.
parent
72ee9fe032
commit
cbca30d705
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@librecms/ccm-cms",
|
"name": "@librecms/ccm-cms",
|
||||||
"version": "7.0.0-SNAPSHOT.2022-10-31T082859",
|
"version": "7.0.0-SNAPSHOT.2022-11-07T181703",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@librecms/ccm-cms",
|
"name": "@librecms/ccm-cms",
|
||||||
"version": "7.0.0-SNAPSHOT.2022-10-31T082859",
|
"version": "7.0.0-SNAPSHOT.2022-11-07T181703",
|
||||||
"license": "LGPL-3.0-or-later",
|
"license": "LGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tiptap/core": "^2.0.0-beta.127",
|
"@tiptap/core": "^2.0.0-beta.127",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@librecms/ccm-cms",
|
"name": "@librecms/ccm-cms",
|
||||||
"version": "7.0.0-SNAPSHOT.2022-10-31T082859",
|
"version": "7.0.0-SNAPSHOT.2022-11-07T181703",
|
||||||
"description": "JavaScript stuff for ccm-cms",
|
"description": "JavaScript stuff for ccm-cms",
|
||||||
"main": "target/generated-resources/assets/@content-sections/cms-admin.js",
|
"main": "target/generated-resources/assets/@content-sections/cms-admin.js",
|
||||||
"types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts",
|
"types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.contentsection;
|
package org.librecms.contentsection;
|
||||||
|
|
||||||
|
import org.libreccm.categorization.CategorizationImExporter;
|
||||||
import org.libreccm.categorization.Category;
|
import org.libreccm.categorization.Category;
|
||||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
import org.libreccm.imexport.Exportable;
|
||||||
|
import org.libreccm.security.PermissionImExporter;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
|
@ -40,16 +43,28 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemRepository itemRepository;
|
private ContentItemRepository itemRepository;
|
||||||
|
|
||||||
@Override
|
@Inject
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
private CategorizationImExporter categorizationImExporter;
|
||||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
|
||||||
entities.add(Category.class);
|
|
||||||
entities.add(ContentSection.class);
|
|
||||||
entities.add(ContentType.class);
|
|
||||||
|
|
||||||
return entities;
|
@Inject
|
||||||
|
private PermissionImExporter permissionImExporter;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
Category.class,
|
||||||
|
ContentSection.class,
|
||||||
|
ContentType.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
categorizationImExporter.addRequiredEntities(Set.of(getEntityClass()));
|
||||||
|
permissionImExporter.addRequiredEntities(Set.of(getEntityClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public void saveImportedEntity(final T entity) {
|
public void saveImportedEntity(final T entity) {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import org.librecms.lifecycle.LifecycleDefinition;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -45,19 +46,22 @@ public class ContentSectionImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private ContentSectionRepository sectionRepository;
|
private ContentSectionRepository sectionRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<ContentSection> getEntityClass() {
|
protected void init() {
|
||||||
return ContentSection.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
Category.class,
|
||||||
|
ResourceType.class,
|
||||||
|
LifecycleDefinition.class,
|
||||||
|
Workflow.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<ContentSection> getEntityClass() {
|
||||||
return Set.of(
|
return ContentSection.class;
|
||||||
Category.class,
|
|
||||||
ResourceType.class,
|
|
||||||
LifecycleDefinition.class,
|
|
||||||
Workflow.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import org.libreccm.imexport.Processes;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -41,16 +42,19 @@ public class ContentTypeImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private ContentTypeRepository contentTypeRepo;
|
private ContentTypeRepository contentTypeRepo;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<ContentType> getEntityClass() {
|
protected void init() {
|
||||||
return ContentType.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
ContentSection.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<ContentType> getEntityClass() {
|
||||||
return Set.of(
|
return ContentType.class;
|
||||||
ContentSection.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -43,18 +44,21 @@ public class FolderImExporter extends AbstractEntityImExporter<Folder> {
|
||||||
@Inject
|
@Inject
|
||||||
private FolderRepository folderRepo;
|
private FolderRepository folderRepo;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<Folder> getEntityClass() {
|
protected void init() {
|
||||||
return Folder.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
ContentSection.class,
|
||||||
|
Category.class,
|
||||||
|
Domain.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<Folder> getEntityClass() {
|
||||||
return Set.of(
|
return Folder.class;
|
||||||
ContentSection.class,
|
|
||||||
Category.class,
|
|
||||||
Domain.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import org.libreccm.imexport.Processes;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -40,16 +41,19 @@ public class LifecycleDefinitionImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private LifecycleDefinitionRepository lifecycleDefRepo;
|
private LifecycleDefinitionRepository lifecycleDefRepo;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<LifecycleDefinition> getEntityClass() {
|
protected void init() {
|
||||||
return LifecycleDefinition.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
PhaseDefinition.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<LifecycleDefinition> getEntityClass() {
|
||||||
return Set.of(
|
return LifecycleDefinition.class;
|
||||||
PhaseDefinition.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
import org.libreccm.imexport.Exportable;
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -41,17 +41,20 @@ public class LifecycleImExporter extends AbstractEntityImExporter<Lifecycle> {
|
||||||
@Inject
|
@Inject
|
||||||
private LifecycleRepository lifecycleRepo;
|
private LifecycleRepository lifecycleRepo;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<Lifecycle> getEntityClass() {
|
protected void init() {
|
||||||
return Lifecycle.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
LifecycleDefinition.class,
|
||||||
|
Phase.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<Lifecycle> getEntityClass() {
|
||||||
return Set.of(
|
return Lifecycle.class;
|
||||||
LifecycleDefinition.class,
|
|
||||||
Phase.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -41,14 +42,15 @@ public class PhaseDefinitionImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private PhaseDefinititionRepository phaseDefinitionRepo;
|
private PhaseDefinititionRepository phaseDefinitionRepo;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<PhaseDefinition> getEntityClass() {
|
protected void init() {
|
||||||
return PhaseDefinition.class;
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<PhaseDefinition> getEntityClass() {
|
||||||
return Collections.emptySet();
|
return PhaseDefinition.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -41,14 +42,15 @@ public class PhaseImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private PhaseRepository phaseRepo;
|
private PhaseRepository phaseRepo;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<Phase> getEntityClass() {
|
protected void init() {
|
||||||
return Phase.class;
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<Phase> getEntityClass() {
|
||||||
return Collections.emptySet();
|
return Phase.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -69,4 +71,5 @@ public class PhaseImExporter
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,16 @@
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
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.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,26 +44,21 @@ public class CategorizationImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@Inject
|
@PostConstruct
|
||||||
private Instance<CategorizationImExporterDependenciesProvider> dependenciesProviders;
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
Category.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Categorization> getEntityClass() {
|
public Class<Categorization> getEntityClass() {
|
||||||
return Categorization.class;
|
return Categorization.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
|
||||||
entities.add(Category.class);
|
|
||||||
|
|
||||||
dependenciesProviders.forEach(
|
|
||||||
provider -> entities.addAll(provider.getCategorizableEntities())
|
|
||||||
);
|
|
||||||
|
|
||||||
return entities;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected void saveImportedEntity(final Categorization entity) {
|
protected void saveImportedEntity(final Categorization entity) {
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2021 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.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();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -26,11 +26,11 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exporter/Importer for {@link Category} entities.
|
* Exporter/Importer for {@link Category} entities.
|
||||||
*
|
*
|
||||||
|
|
@ -44,15 +44,18 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
|
||||||
private CategoryRepository categoryRepository;
|
private CategoryRepository categoryRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Category> getEntityClass() {
|
@PostConstruct
|
||||||
return Category.class;
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
Domain.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<Category> getEntityClass() {
|
||||||
return Set.of(
|
return Category.class;
|
||||||
Domain.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -64,19 +67,19 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
|
||||||
|
|
||||||
final Category category;
|
final Category category;
|
||||||
if (result.isPresent()) {
|
if (result.isPresent()) {
|
||||||
category = result.get();
|
category = result.get();
|
||||||
category.setAbstractCategory(entity.isAbstractCategory());
|
category.setAbstractCategory(entity.isAbstractCategory());
|
||||||
category.setCategoryOrder(entity.getCategoryOrder());
|
category.setCategoryOrder(entity.getCategoryOrder());
|
||||||
category.setDescription(entity.getDescription());
|
category.setDescription(entity.getDescription());
|
||||||
category.setDisplayName(entity.getDisplayName());
|
category.setDisplayName(entity.getDisplayName());
|
||||||
category.setEnabled(entity.isEnabled());
|
category.setEnabled(entity.isEnabled());
|
||||||
category.setName(entity.getName());
|
category.setName(entity.getName());
|
||||||
category.setObjects(entity.getObjects());
|
category.setObjects(entity.getObjects());
|
||||||
category.setParentCategory(entity.getParentCategory());
|
category.setParentCategory(entity.getParentCategory());
|
||||||
category.setSubCategories(entity.getSubCategories());
|
category.setSubCategories(entity.getSubCategories());
|
||||||
category.setTitle(entity.getTitle());
|
category.setTitle(entity.getTitle());
|
||||||
category.setUniqueId(entity.getUniqueId());
|
category.setUniqueId(entity.getUniqueId());
|
||||||
category.setVisible(entity.isVisible());
|
category.setVisible(entity.isVisible());
|
||||||
} else {
|
} else {
|
||||||
category = entity;
|
category = entity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -41,6 +42,12 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
|
||||||
@Inject
|
@Inject
|
||||||
private DomainRepository domainRepository;
|
private DomainRepository domainRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PostConstruct
|
||||||
|
protected void init() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Domain> getEntityClass() {
|
public Class<Domain> getEntityClass() {
|
||||||
|
|
||||||
|
|
@ -53,12 +60,6 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
|
||||||
domainRepository.save(entity);
|
domainRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Domain reloadEntity(final Domain entity) {
|
protected Domain reloadEntity(final Domain entity) {
|
||||||
return domainRepository
|
return domainRepository
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -47,6 +48,17 @@ public class DomainOwnershipImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PostConstruct
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
CcmApplication.class,
|
||||||
|
Domain.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<DomainOwnership> getEntityClass() {
|
public Class<DomainOwnership> getEntityClass() {
|
||||||
return DomainOwnership.class;
|
return DomainOwnership.class;
|
||||||
|
|
@ -58,15 +70,6 @@ public class DomainOwnershipImExporter
|
||||||
entityManager.persist(entity);
|
entityManager.persist(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
|
||||||
classes.add(CcmApplication.class);
|
|
||||||
classes.add(Domain.class);
|
|
||||||
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DomainOwnership reloadEntity(final DomainOwnership entity) {
|
protected DomainOwnership reloadEntity(final DomainOwnership entity) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,11 +35,17 @@ import javax.inject.Inject;
|
||||||
*/
|
*/
|
||||||
@Processes(ResourceType.class)
|
@Processes(ResourceType.class)
|
||||||
public class ResourceTypeImExporter
|
public class ResourceTypeImExporter
|
||||||
extends AbstractEntityImExporter<ResourceType>{
|
extends AbstractEntityImExporter<ResourceType> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ResourceTypeRepository repository;
|
private ResourceTypeRepository repository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<ResourceType> getEntityClass() {
|
public Class<ResourceType> getEntityClass() {
|
||||||
return ResourceType.class;
|
return ResourceType.class;
|
||||||
|
|
@ -49,11 +56,6 @@ public class ResourceTypeImExporter
|
||||||
repository.save(entity);
|
repository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ResourceType reloadEntity(final ResourceType entity) {
|
protected ResourceType reloadEntity(final ResourceType entity) {
|
||||||
return repository
|
return repository
|
||||||
|
|
@ -71,6 +73,4 @@ public class ResourceTypeImExporter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
|
@ -42,12 +45,35 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A set of entities which should be processed before this implementation is
|
||||||
|
* used. We can't use an annotation for this because we can't access the
|
||||||
|
* annotations in a portable way in the rest of the code because CDI
|
||||||
|
* containers usually create a {@link java.lang.reflect.Proxy} class and
|
||||||
|
* there is no portable way to unproxy a class.
|
||||||
|
*
|
||||||
|
* The required entities for implementation of
|
||||||
|
* {@code AbstractEntityImExporter} should be added in the implementation of
|
||||||
|
* this class using {@link #addRequiredEntities(java.util.Set)}. Other
|
||||||
|
* implementations of {@code AbstractEntityImExporter} may also add themself
|
||||||
|
* to the list of required entities of another implementation of
|
||||||
|
* {@code AbstractEnitityImExporter}. For this, {@link #getEntityClass()}
|
||||||
|
* should be used, to add the concrete implementation.
|
||||||
|
*/
|
||||||
|
private final Set<Class<? extends Exportable>> requiredEntities;
|
||||||
|
|
||||||
public AbstractEntityImExporter() {
|
public AbstractEntityImExporter() {
|
||||||
objectMapper = new ObjectMapper()
|
objectMapper = new ObjectMapper()
|
||||||
.registerModule(new JavaTimeModule());
|
.registerModule(new JavaTimeModule());
|
||||||
|
requiredEntities = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract init method. Implementations MUST be annotated with
|
||||||
|
* {@link PostConstruct}. Th
|
||||||
|
*/
|
||||||
|
protected abstract void init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Entity class which is handled by the implementation. This
|
* Returns the Entity class which is handled by the implementation. This
|
||||||
* should be the same values than the class in the {@link Proceesses}
|
* should be the same values than the class in the {@link Proceesses}
|
||||||
|
|
@ -71,10 +97,24 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
*
|
*
|
||||||
* @return A {@link Set} of exportable entity classes which should be
|
* @return A {@link Set} of exportable entity classes which should be
|
||||||
* processed before the entities which are processed by this
|
* processed before the entities which are processed by this
|
||||||
* implementation. If the implementation has no dependencies an
|
* implementation.
|
||||||
* empty {@link Set} should be returned.
|
|
||||||
*/
|
*/
|
||||||
protected abstract Set<Class<? extends Exportable>> getRequiredEntities();
|
public final Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||||
|
return Collections.unmodifiableSet(requiredEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add entities that have be processed before this implementation is used.
|
||||||
|
* This method should only be called by the implementation of the
|
||||||
|
* {@link #init()} method.
|
||||||
|
*
|
||||||
|
* @param requiredEntities The additional required entities.
|
||||||
|
*/
|
||||||
|
public final void addRequiredEntities(
|
||||||
|
final Set<Class<? extends Exportable>> requiredEntities
|
||||||
|
) {
|
||||||
|
this.requiredEntities.addAll(requiredEntities);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public T importEntity(final String data) throws ImportExpection {
|
public T importEntity(final String data) throws ImportExpection {
|
||||||
|
|
@ -119,7 +159,7 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads the entity to export. Entities become detacted for several
|
* Reloads the entity to export. Entities become detacted for several
|
||||||
* reasons before they are passed to the null null null {@link #exportEntity(org.libreccm.imexport.Exportable) method. The
|
* reasons before they are passed to the null null null null null null null {@link #exportEntity(org.libreccm.imexport.Exportable) method. The
|
||||||
* implementation of this should reload the passed entity.
|
* implementation of this should reload the passed entity.
|
||||||
*
|
*
|
||||||
* @param entity The entity to reload.
|
* @param entity The entity to reload.
|
||||||
|
|
|
||||||
|
|
@ -231,48 +231,6 @@ public class ImportExport {
|
||||||
final List<EntityImExporterTreeNode> orderedNodes = treeManager
|
final List<EntityImExporterTreeNode> orderedNodes = treeManager
|
||||||
.orderImExporters(tree);
|
.orderImExporters(tree);
|
||||||
|
|
||||||
// Put the node for Categorizations to the end of the list
|
|
||||||
final EntityImExporterTreeNode categorizationsNode = orderedNodes
|
|
||||||
.stream()
|
|
||||||
.filter(
|
|
||||||
node -> node.getEntityImExporter().getEntityClass().equals(
|
|
||||||
Categorization.class
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.findAny()
|
|
||||||
.orElseThrow(
|
|
||||||
() -> new UnexpectedErrorException(
|
|
||||||
String.format(
|
|
||||||
"There should be an ImExporter in the tree for "
|
|
||||||
+ "%s, but it is not.",
|
|
||||||
Categorization.class.getName()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
orderedNodes.remove(categorizationsNode);
|
|
||||||
orderedNodes.add(categorizationsNode);
|
|
||||||
|
|
||||||
// Put the node for Permissions to the end of the list.
|
|
||||||
final EntityImExporterTreeNode permissionsNode = orderedNodes
|
|
||||||
.stream()
|
|
||||||
.filter(
|
|
||||||
node -> node.getEntityImExporter().getEntityClass().equals(
|
|
||||||
Permission.class
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.findAny()
|
|
||||||
.orElseThrow(
|
|
||||||
() -> new UnexpectedErrorException(
|
|
||||||
String.format(
|
|
||||||
"There should be an ImExporter in the tree for "
|
|
||||||
+ "%s, but it is not.",
|
|
||||||
Permission.class.getName()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
orderedNodes.remove(permissionsNode);
|
|
||||||
orderedNodes.add(permissionsNode);
|
|
||||||
|
|
||||||
final ImportManifest manifest = createImportManifest(importName);
|
final ImportManifest manifest = createImportManifest(importName);
|
||||||
|
|
||||||
final List<EntityImExporterTreeNode> importers = orderedNodes
|
final List<EntityImExporterTreeNode> importers = orderedNodes
|
||||||
|
|
@ -562,6 +520,7 @@ public class ImportExport {
|
||||||
public Class<? extends Exportable> value() {
|
public Class<? extends Exportable> value() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -46,6 +47,12 @@ public class GroupImExporter extends AbstractEntityImExporter<Group> {
|
||||||
@Inject
|
@Inject
|
||||||
private GroupRepository groupRepository;
|
private GroupRepository groupRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Group> getEntityClass() {
|
public Class<Group> getEntityClass() {
|
||||||
return Group.class;
|
return Group.class;
|
||||||
|
|
@ -58,11 +65,6 @@ public class GroupImExporter extends AbstractEntityImExporter<Group> {
|
||||||
entityManager.persist(entity);
|
entityManager.persist(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Group reloadEntity(final Group entity) {
|
protected Group reloadEntity(final Group entity) {
|
||||||
return groupRepository
|
return groupRepository
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,12 @@
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
|
|
@ -44,18 +43,20 @@ public class GroupMembershipImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<GroupMembership> getEntityClass() {
|
protected void init() {
|
||||||
return GroupMembership.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
User.class,
|
||||||
|
Group.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<GroupMembership> getEntityClass() {
|
||||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
return GroupMembership.class;
|
||||||
entities.add(User.class);
|
|
||||||
entities.add(Group.class);
|
|
||||||
|
|
||||||
return entities;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
import org.libreccm.imexport.Exportable;
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
@ -26,6 +25,7 @@ import org.libreccm.imexport.Processes;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -41,6 +41,16 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionRepository permissionRepository;
|
private PermissionRepository permissionRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
Role.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Permission> getEntityClass() {
|
public Class<Permission> getEntityClass() {
|
||||||
return Permission.class;
|
return Permission.class;
|
||||||
|
|
@ -51,13 +61,6 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
|
||||||
permissionRepository.save(entity);
|
permissionRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Set.of(
|
|
||||||
Role.class
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Permission reloadEntity(final Permission entity) {
|
protected Permission reloadEntity(final Permission entity) {
|
||||||
return permissionRepository
|
return permissionRepository
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.Dependent;
|
import javax.enterprise.context.Dependent;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -53,6 +54,12 @@ public class RoleImExporter extends AbstractEntityImExporter<Role> {
|
||||||
@Inject
|
@Inject
|
||||||
private RoleRepository roleRepository;
|
private RoleRepository roleRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Role> getEntityClass() {
|
public Class<Role> getEntityClass() {
|
||||||
return Role.class;
|
return Role.class;
|
||||||
|
|
@ -82,11 +89,6 @@ public class RoleImExporter extends AbstractEntityImExporter<Role> {
|
||||||
roleRepository.save(entity);
|
roleRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Role reloadEntity(final Role entity) {
|
protected Role reloadEntity(final Role entity) {
|
||||||
return roleRepository
|
return roleRepository
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,13 @@ import org.libreccm.imexport.Exportable;
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -48,6 +44,18 @@ public class RoleMembershipImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
User.class,
|
||||||
|
Group.class,
|
||||||
|
Role.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<RoleMembership> getEntityClass() {
|
public Class<RoleMembership> getEntityClass() {
|
||||||
return RoleMembership.class;
|
return RoleMembership.class;
|
||||||
|
|
@ -56,36 +64,6 @@ public class RoleMembershipImExporter
|
||||||
@Override
|
@Override
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected void saveImportedEntity(final RoleMembership entity) {
|
protected void saveImportedEntity(final RoleMembership entity) {
|
||||||
// final CriteriaBuilder criteriaBuilder = entityManager
|
|
||||||
// .getCriteriaBuilder();
|
|
||||||
// final CriteriaQuery<RoleMembership> criteriaQuery = criteriaBuilder
|
|
||||||
// .createQuery(RoleMembership.class);
|
|
||||||
// final Root<RoleMembership> from = criteriaQuery.from(
|
|
||||||
// RoleMembership.class
|
|
||||||
// );
|
|
||||||
// criteriaQuery.where(
|
|
||||||
// criteriaBuilder.equal(
|
|
||||||
// from.get("role"),
|
|
||||||
// entity.getRole()
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// criteriaQuery.where(
|
|
||||||
// criteriaBuilder.equal(
|
|
||||||
// from.get("member"),
|
|
||||||
// entity.getMember()
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// final TypedQuery<RoleMembership> query = entityManager.createQuery(
|
|
||||||
// criteriaQuery
|
|
||||||
// );
|
|
||||||
// final List<RoleMembership> results = query.getResultList();
|
|
||||||
// if (results.isEmpty()) {
|
|
||||||
// final RoleMembership membership = new RoleMembership();
|
|
||||||
// membership.setUuid(entity.getUuid());
|
|
||||||
// membership.setMember(entity.getMember());
|
|
||||||
// membership.setRole(entity.getRole());
|
|
||||||
// entityManager.persist(membership);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (entity.getMembershipId() == 0) {
|
if (entity.getMembershipId() == 0) {
|
||||||
entityManager.persist(entity);
|
entityManager.persist(entity);
|
||||||
|
|
@ -94,16 +72,6 @@ public class RoleMembershipImExporter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
|
||||||
classes.add(User.class);
|
|
||||||
classes.add(Group.class);
|
|
||||||
classes.add(Role.class);
|
|
||||||
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RoleMembership reloadEntity(final RoleMembership entity) {
|
protected RoleMembership reloadEntity(final RoleMembership entity) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -46,6 +47,12 @@ public class UserImExporter extends AbstractEntityImExporter<User> {
|
||||||
@Inject
|
@Inject
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<User> getEntityClass() {
|
public Class<User> getEntityClass() {
|
||||||
return User.class;
|
return User.class;
|
||||||
|
|
@ -60,11 +67,6 @@ public class UserImExporter extends AbstractEntityImExporter<User> {
|
||||||
entityManager.persist(entity);
|
entityManager.persist(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected User reloadEntity(final User entity) {
|
protected User reloadEntity(final User entity) {
|
||||||
return userRepository
|
return userRepository
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -43,6 +44,12 @@ public class ApplicationImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private ApplicationRepository applicationRepository;
|
private ApplicationRepository applicationRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<CcmApplication> getEntityClass() {
|
public Class<CcmApplication> getEntityClass() {
|
||||||
return CcmApplication.class;
|
return CcmApplication.class;
|
||||||
|
|
@ -54,11 +61,6 @@ public class ApplicationImExporter
|
||||||
applicationRepository.save(entity);
|
applicationRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CcmApplication reloadEntity(final CcmApplication entity) {
|
protected CcmApplication reloadEntity(final CcmApplication entity) {
|
||||||
return applicationRepository
|
return applicationRepository
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
import org.libreccm.imexport.Exportable;
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -45,17 +45,20 @@ public class AssignableTaskImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private AssignableTaskRepository assignableTaskRepository;
|
private AssignableTaskRepository assignableTaskRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
@Override
|
@Override
|
||||||
public Class<AssignableTask> getEntityClass() {
|
protected void init() {
|
||||||
return AssignableTask.class;
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
TaskComment.class,
|
||||||
|
Workflow.class
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
public Class<AssignableTask> getEntityClass() {
|
||||||
return Set.of(
|
return AssignableTask.class;
|
||||||
TaskComment.class,
|
|
||||||
Workflow.class
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -46,6 +47,16 @@ public class TaskAssignmentImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
AssignableTask.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<TaskAssignment> getEntityClass() {
|
public Class<TaskAssignment> getEntityClass() {
|
||||||
return TaskAssignment.class;
|
return TaskAssignment.class;
|
||||||
|
|
@ -58,14 +69,6 @@ public class TaskAssignmentImExporter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
|
||||||
classes.add(AssignableTask.class);
|
|
||||||
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TaskAssignment reloadEntity(final TaskAssignment entity) {
|
protected TaskAssignment reloadEntity(final TaskAssignment entity) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -43,6 +44,12 @@ public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment>
|
||||||
@Inject
|
@Inject
|
||||||
private TaskCommentRepository taskCommentRepository;
|
private TaskCommentRepository taskCommentRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<TaskComment> getEntityClass() {
|
public Class<TaskComment> getEntityClass() {
|
||||||
return TaskComment.class;
|
return TaskComment.class;
|
||||||
|
|
@ -54,11 +61,6 @@ public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment>
|
||||||
taskCommentRepository.save(entity);
|
taskCommentRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TaskComment reloadEntity(final TaskComment entity) {
|
protected TaskComment reloadEntity(final TaskComment entity) {
|
||||||
return taskCommentRepository
|
return taskCommentRepository
|
||||||
|
|
@ -73,5 +75,4 @@ public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -46,6 +47,16 @@ public class TaskDependencyImExporter
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
addRequiredEntities(
|
||||||
|
Set.of(
|
||||||
|
AssignableTask.class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<TaskDependency> getEntityClass() {
|
public Class<TaskDependency> getEntityClass() {
|
||||||
return TaskDependency.class;
|
return TaskDependency.class;
|
||||||
|
|
@ -54,18 +65,9 @@ public class TaskDependencyImExporter
|
||||||
@Override
|
@Override
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected void saveImportedEntity(final TaskDependency entity) {
|
protected void saveImportedEntity(final TaskDependency entity) {
|
||||||
// entityManager.persist(entity);
|
|
||||||
entityManager.merge(entity);
|
entityManager.merge(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
|
||||||
classes.add(AssignableTask.class);
|
|
||||||
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TaskDependency reloadEntity(final TaskDependency entity) {
|
protected TaskDependency reloadEntity(final TaskDependency entity) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -42,6 +43,12 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
|
||||||
@Inject
|
@Inject
|
||||||
private WorkflowRepository workflowRepository;
|
private WorkflowRepository workflowRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Workflow> getEntityClass() {
|
public Class<Workflow> getEntityClass() {
|
||||||
|
|
||||||
|
|
@ -54,11 +61,6 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
|
||||||
workflowRepository.save(entity);
|
workflowRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Workflow reloadEntity(final Workflow entity) {
|
protected Workflow reloadEntity(final Workflow entity) {
|
||||||
return workflowRepository
|
return workflowRepository
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,11 @@
|
||||||
package org.libreccm.docrepo;
|
package org.libreccm.docrepo;
|
||||||
|
|
||||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -45,6 +43,12 @@ public class BlobObjectImExporter extends AbstractEntityImExporter<BlobObject> {
|
||||||
@Inject
|
@Inject
|
||||||
private BlobObjectRepository blobObjectRepository;
|
private BlobObjectRepository blobObjectRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<BlobObject> getEntityClass() {
|
public Class<BlobObject> getEntityClass() {
|
||||||
return BlobObject.class;
|
return BlobObject.class;
|
||||||
|
|
@ -57,11 +61,6 @@ public class BlobObjectImExporter extends AbstractEntityImExporter<BlobObject> {
|
||||||
blobObjectRepository.save(entity);
|
blobObjectRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlobObject reloadEntity(final BlobObject entity) {
|
protected BlobObject reloadEntity(final BlobObject entity) {
|
||||||
return blobObjectRepository
|
return blobObjectRepository
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
@ -45,6 +46,12 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
||||||
@Inject
|
@Inject
|
||||||
private FileRepository fileRepository;
|
private FileRepository fileRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<File> getEntityClass() {
|
public Class<File> getEntityClass() {
|
||||||
return File.class;
|
return File.class;
|
||||||
|
|
@ -56,11 +63,6 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
||||||
fileRepository.save(portableObject);
|
fileRepository.save(portableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected File reloadEntity(final File entity) {
|
protected File reloadEntity(final File entity) {
|
||||||
return fileRepository
|
return fileRepository
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.docrepo;
|
package org.libreccm.docrepo;
|
||||||
|
|
||||||
import org.libreccm.imexport.Exportable;
|
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -43,6 +41,12 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
||||||
@Inject
|
@Inject
|
||||||
private FolderRepository folderRepository;
|
private FolderRepository folderRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Folder> getEntityClass() {
|
public Class<Folder> getEntityClass() {
|
||||||
return Folder.class;
|
return Folder.class;
|
||||||
|
|
@ -54,11 +58,6 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
||||||
folderRepository.save(entity);
|
folderRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Folder reloadEntity(final Folder entity) {
|
protected Folder reloadEntity(final Folder entity) {
|
||||||
return folderRepository
|
return folderRepository
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,11 @@
|
||||||
package org.libreccm.docrepo;
|
package org.libreccm.docrepo;
|
||||||
|
|
||||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||||
import org.libreccm.imexport.Exportable;
|
|
||||||
import org.libreccm.imexport.Processes;
|
import org.libreccm.imexport.Processes;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -40,6 +38,12 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
||||||
@Inject
|
@Inject
|
||||||
private RepositoryRepository repositoryRepository;
|
private RepositoryRepository repositoryRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Repository> getEntityClass() {
|
public Class<Repository> getEntityClass() {
|
||||||
return Repository.class;
|
return Repository.class;
|
||||||
|
|
@ -50,11 +54,6 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
||||||
repositoryRepository.save(portableObject);
|
repositoryRepository.save(portableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Repository reloadEntity(final Repository entity) {
|
protected Repository reloadEntity(final Repository entity) {
|
||||||
return repositoryRepository
|
return repositoryRepository
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue