use of io.crnk.meta.model.MetaAttributePath in project crnk-framework by crnk-project.
the class JoinRegistry method getOrCreateJoin.
public F getOrCreateJoin(MetaAttributePath path) {
if (path.length() == 0)
return backend.getRoot();
MetaAttributePath subPath = new MetaAttributePath();
F from = backend.getRoot();
for (int i = 0; i < path.length(); i++) {
MetaAttribute pathElement = path.getElement(i);
from = getOrCreateJoin(subPath, pathElement);
subPath = subPath.concat(pathElement);
}
return from;
}
use of io.crnk.meta.model.MetaAttributePath in project crnk-framework by crnk-project.
the class QueryBuilder method applySelectionSpec.
public Map<String, Integer> applySelectionSpec() {
MetaDataObject meta = query.getMeta();
Map<String, Integer> selectionBindings = new HashMap<>();
int index = 1;
List<IncludeFieldSpec> includedFields = query.getIncludedFields();
for (IncludeFieldSpec includedField : includedFields) {
MetaAttributePath path = meta.resolvePath(includedField.getAttributePath(), attributeFinder);
E attr = backend.getAttribute(path);
backend.addSelection(attr, path.toString());
selectionBindings.put(path.toString(), index++);
}
return selectionBindings;
}
Aggregations