use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeNode in project conquery by bakdata.
the class FrontEndConceptBuilder method createCTRoot.
private static FENode createCTRoot(Concept<?> c, StructureNode[] structureNodes) {
MatchingStats matchingStats = c.getMatchingStats();
StructureNodeId structureParent = Arrays.stream(structureNodes).filter(sn -> sn.getContainedRoots().contains(c.getId())).findAny().map(StructureNode::getId).orElse(null);
FENode n = FENode.builder().active(true).description(c.getDescription()).label(c.getLabel()).additionalInfos(c.getAdditionalInfos()).matchingEntries(matchingStats.countEvents()).matchingEntities(matchingStats.countEntities()).dateRange(matchingStats.spanEvents() != null ? matchingStats.spanEvents().toSimpleRange() : null).detailsAvailable(Boolean.TRUE).codeListResolvable(c.countElements() > 1).parent(structureParent).selects(c.getSelects().stream().map(FrontEndConceptBuilder::createSelect).collect(Collectors.toList())).tables(c.getConnectors().stream().map(FrontEndConceptBuilder::createTable).collect(Collectors.toList())).build();
if (c instanceof ConceptTreeNode) {
ConceptTreeNode<?> tree = (ConceptTreeNode<?>) c;
if (tree.getChildren() != null) {
n.setChildren(tree.getChildren().stream().map(ConceptTreeChild::getId).toArray(ConceptTreeChildId[]::new));
}
}
return n;
}
use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeNode in project conquery by bakdata.
the class FrontEndConceptBuilder method createCTNode.
private static FENode createCTNode(ConceptElement<?> ce) {
MatchingStats matchingStats = ce.getMatchingStats();
FENode n = FENode.builder().active(null).description(ce.getDescription()).label(ce.getLabel()).additionalInfos(ce.getAdditionalInfos()).matchingEntries(matchingStats.countEvents()).matchingEntities(matchingStats.countEntities()).dateRange(matchingStats.spanEvents() != null ? matchingStats.spanEvents().toSimpleRange() : null).build();
if (ce instanceof ConceptTreeNode) {
ConceptTreeNode<?> tree = (ConceptTreeNode<?>) ce;
if (tree.getChildren() != null) {
n.setChildren(tree.getChildren().stream().map(IdentifiableImpl::getId).toArray(ConceptTreeChildId[]::new));
}
if (tree.getParent() != null) {
n.setParent(tree.getParent().getId());
}
}
return n;
}
Aggregations