use of org.openforis.idm.metamodel.VersionableSurveyObject in project collect by openforis.
the class VersioningVM method getReferencesInSchema.
protected List<VersionableSurveyObject> getReferencesInSchema(ModelVersion version) {
List<VersionableSurveyObject> references = new ArrayList<VersionableSurveyObject>();
Schema schema = survey.getSchema();
List<EntityDefinition> rootEntities = schema.getRootEntityDefinitions();
Stack<NodeDefinition> stack = new Stack<NodeDefinition>();
stack.addAll(rootEntities);
while (!stack.isEmpty()) {
NodeDefinition defn = stack.pop();
if (isVersionInUse(version, defn)) {
references.add(defn);
}
if (defn instanceof EntityDefinition) {
stack.addAll(((EntityDefinition) defn).getChildDefinitions());
}
}
return references;
}
use of org.openforis.idm.metamodel.VersionableSurveyObject in project collect by openforis.
the class VersioningVM method getReferencesInCodeLists.
protected List<VersionableSurveyObject> getReferencesInCodeLists(ModelVersion version) {
List<VersionableSurveyObject> references = new ArrayList<VersionableSurveyObject>();
List<CodeList> codeLists = survey.getCodeLists();
for (CodeList codeList : codeLists) {
if (isVersionInUse(version, codeList)) {
references.add(codeList);
}
if (!codeList.isExternal()) {
List<CodeListItem> items = codeList.getItems();
Stack<CodeListItem> itemsStack = new Stack<CodeListItem>();
itemsStack.addAll(items);
while (!itemsStack.isEmpty()) {
CodeListItem item = itemsStack.pop();
if (isVersionInUse(version, item)) {
references.add(item);
}
itemsStack.addAll(item.getChildItems());
}
}
}
return references;
}
Aggregations