Revision 299a6ffc
Added by Andreas Müller about 13 years ago
XperCdmIntegration/src/main/java/eu/etaxonomy/xper/AdaptaterCdmXper.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
// Recursive methode to load FeatureNode and all its children |
56 | 56 |
public void loadFeatureNode(FeatureNode featureNode, int indiceParent){ |
57 |
if(featureNode.getChildCount() > 0){ |
|
58 |
List<FeatureNode> featureList = featureNode.getChildren(); |
|
59 |
for(FeatureNode child : featureList){ |
|
60 |
boolean alreadyExist = false; |
|
61 |
Variable variable = new Variable(child.getFeature().getLabel()); |
|
62 |
variable.setUuid(child.getFeature().getUuid()); |
|
63 |
List<Variable> vars = Utils.currentBase.getVariables(); |
|
64 |
for(Variable var : vars){ |
|
65 |
if(var.getName().equals(variable.getName())) |
|
66 |
alreadyExist = true; |
|
67 |
} |
|
57 |
List<FeatureNode> featureList = featureNode.getChildren(); |
|
58 |
for(FeatureNode child : featureList){ |
|
59 |
boolean alreadyExist = false; |
|
60 |
Variable variable = new Variable(child.getFeature().getLabel()); |
|
61 |
variable.setUuid(child.getFeature().getUuid()); |
|
62 |
List<Variable> vars = Utils.currentBase.getVariables(); |
|
63 |
for(Variable var : vars){ |
|
64 |
if(var.getName().equals(variable.getName())) |
|
65 |
alreadyExist = true; |
|
66 |
} |
|
67 |
|
|
68 |
if(!alreadyExist && (child.getFeature().isSupportsCategoricalData() || child.getFeature().isSupportsQuantitativeData())){ |
|
68 | 69 |
|
69 |
if(!alreadyExist && (child.getFeature().isSupportsCategoricalData() || child.getFeature().isSupportsQuantitativeData())){ |
|
70 |
|
|
71 |
Utils.currentBase.addVariable(variable); |
|
72 |
|
|
73 |
if(child.getFeature().isSupportsCategoricalData()){ |
|
74 |
// Add states to the character |
|
75 |
Set<TermVocabulary<State>> termVocabularySet = child.getFeature().getSupportedCategoricalEnumerations(); |
|
76 |
for(TermVocabulary<State> termVocabulary : termVocabularySet){ |
|
77 |
for(State sate : termVocabulary.getTerms()){ |
|
78 |
Mode mode = new Mode(sate.getLabel()); |
|
79 |
mode.setUuid(sate.getUuid()); |
|
80 |
variable.addMode(mode); |
|
81 |
} |
|
70 |
Utils.currentBase.addVariable(variable); |
|
71 |
|
|
72 |
if(child.getFeature().isSupportsCategoricalData()){ |
|
73 |
// Add states to the character |
|
74 |
Set<TermVocabulary<State>> termVocabularySet = child.getFeature().getSupportedCategoricalEnumerations(); |
|
75 |
for(TermVocabulary<State> termVocabulary : termVocabularySet){ |
|
76 |
for(State sate : termVocabulary.getTerms()){ |
|
77 |
Mode mode = new Mode(sate.getLabel()); |
|
78 |
mode.setUuid(sate.getUuid()); |
|
79 |
variable.addMode(mode); |
|
82 | 80 |
} |
83 |
}else if (child.getFeature().isSupportsQuantitativeData()) { |
|
84 |
// Specify the character type (numerical) |
|
85 |
variable.setType(Utils.numType); |
|
86 |
} |
|
87 |
|
|
88 |
if(indiceParent != -1 && Utils.currentBase.getVariableAt(indiceParent) != null){ |
|
89 |
variable.addMother(((Variable)Utils.currentBase.getVariableAt(indiceParent -1))); |
|
90 | 81 |
} |
91 |
|
|
92 |
loadFeatureNode(child, variable.getIndexInt()); |
|
93 |
}else{ |
|
94 |
loadFeatureNode(child, indiceParent); |
|
82 |
}else if (child.getFeature().isSupportsQuantitativeData()) { |
|
83 |
// Specify the character type (numerical) |
|
84 |
variable.setType(Utils.numType); |
|
95 | 85 |
} |
86 |
|
|
87 |
if(indiceParent != -1 && Utils.currentBase.getVariableAt(indiceParent) != null){ |
|
88 |
variable.addMother(((Variable)Utils.currentBase.getVariableAt(indiceParent -1))); |
|
89 |
} |
|
90 |
|
|
91 |
loadFeatureNode(child, variable.getIndexInt()); |
|
92 |
}else{ |
|
93 |
loadFeatureNode(child, indiceParent); |
|
96 | 94 |
} |
97 | 95 |
} |
98 | 96 |
} |
Also available in: Unified diff
move SDD test classes and data to src/test (for Xper adapter)