Fixed some bugs in importers and in the Categorization step

deploy_packages_to_gitea
Jens Pelzetter 2023-03-21 17:58:42 +01:00
parent 1701551fbc
commit 3463bb7f4d
6 changed files with 29 additions and 24 deletions

View File

@ -1,12 +1,12 @@
{ {
"name": "@librecms/ccm-cms", "name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-03-20T173612", "version": "7.0.0-SNAPSHOT.2023-03-21T165148",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@librecms/ccm-cms", "name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-03-20T173612", "version": "7.0.0-SNAPSHOT.2023-03-21T165148",
"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",

View File

@ -1,6 +1,6 @@
{ {
"name": "@librecms/ccm-cms", "name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-03-20T173612", "version": "7.0.0-SNAPSHOT.2023-03-21T165148",
"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",

View File

@ -359,6 +359,13 @@ public class CategorizationStep extends AbstractMvcAuthoringStep {
.map(this::buildCategorizationTreeNode) .map(this::buildCategorizationTreeNode)
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
node.setSubCategoryAssigned(
node
.getSubCategories()
.stream()
.map(subNode -> subNode.isAssigned() || subNode.isSubCategoryAssigned())
.reduce(false, (value1, value2) -> value1 || value2)
);
// node.setSubCategoryAssigned( // node.setSubCategoryAssigned(
// isSubCategoryAssigned(category) // isSubCategoryAssigned(category)
//// category //// category

View File

@ -71,11 +71,11 @@ public class CategorizationTreeNode {
*/ */
private boolean assigned; private boolean assigned;
// /** /**
// * Is any subcategory of the category represented by this node assigned to * Is any subcategory of the category represented by this node assigned to
// * the current content item? * the current content item?
// */ */
// private boolean subCategoryAssigned; private boolean subCategoryAssigned;
/** /**
* Nodes for the subcategories of the category represented by this node. * Nodes for the subcategories of the category represented by this node.
@ -139,16 +139,16 @@ public class CategorizationTreeNode {
} }
public boolean isSubCategoryAssigned() { public boolean isSubCategoryAssigned() {
// return subCategoryAssigned; return subCategoryAssigned;
return subCategories // return subCategories
.stream() // .stream()
.map(CategorizationTreeNode::isAssigned) // .map(CategorizationTreeNode::isAssigned)
.reduce(false, (value1, value2) -> value1 || value2); // .reduce(false, (value1, value2) -> value1 || value2);
} }
// public void setSubCategoryAssigned(final boolean subCategoryAssigned) { public void setSubCategoryAssigned(final boolean subCategoryAssigned) {
// this.subCategoryAssigned = subCategoryAssigned; this.subCategoryAssigned = subCategoryAssigned;
// } }
public List<CategorizationTreeNode> getSubCategories() { public List<CategorizationTreeNode> getSubCategories() {
return Collections.unmodifiableList(subCategories); return Collections.unmodifiableList(subCategories);

View File

@ -24,7 +24,6 @@ import org.libreccm.imexport.Processes;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
@ -48,11 +47,11 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
@Override @Override
@PostConstruct @PostConstruct
protected void init() { protected void init() {
addRequiredEntities( // addRequiredEntities(
Set.of( // Set.of(
Domain.class // Domain.class
) // )
); // );
} }
@Override @Override

View File

@ -24,7 +24,6 @@ import org.libreccm.imexport.Processes;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
@ -48,7 +47,7 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
@Override @Override
@PostConstruct @PostConstruct
protected void init() { protected void init() {
//Nothing addRequiredEntities(Set.of(Category.class));
} }
@Override @Override