]>
git.argeo.org Git - gpl/argeo-suite.git/blob - suite/core/SuiteTypology.java
1 package org
.argeo
.suite
.core
;
3 import java
.util
.ArrayList
;
8 import org
.argeo
.entity
.Term
;
9 import org
.argeo
.entity
.Typology
;
10 import org
.argeo
.jcr
.Jcr
;
12 /** A typology. Helper to optimise {@link SuiteTermsManager} implementation. */
13 class SuiteTypology
implements Typology
{
14 private final String name
;
15 private final Node node
;
16 private boolean isFlat
= true;
18 private final List
<SuiteTerm
> subTerms
= new ArrayList
<>();
20 public SuiteTypology(Node node
) {
22 this.name
= Jcr
.getName(this.node
);
26 public String
getId() {
30 public String
getName() {
34 public Node
getNode() {
44 public boolean isFlat() {
49 public List
<SuiteTerm
> getSubTerms() {
53 public List
<SuiteTerm
> getAllTerms() {
57 List
<SuiteTerm
> terms
= new ArrayList
<>();
58 for (SuiteTerm subTerm
: subTerms
) {
60 collectSubTerms(terms
, subTerm
);
66 private void collectSubTerms(List
<SuiteTerm
> terms
, SuiteTerm term
) {
67 for (SuiteTerm subTerm
: term
.getSubTerms()) {
69 collectSubTerms(terms
, subTerm
);