private AstJoin generateTerm(ModelReference sourceModel, List<Source> group, boolean from) {
Map<String, ModelProperty> resolver = Maps.create();
List<AstPropertyMapping> mappings = Lists.create();
for (ModelProperty property : model.getProperties()) {
Source source = from ? property.getFrom() : property.getJoined();
if (source == null) {
continue;
}
resolver.put(source.getName(), property);
mappings.add(new AstPropertyMapping(
null,
AstBuilder.getDesciption("{0}.{1}",
sourceModel.getSimpleName(),
source.getName()),
Arrays.asList(new AstAttribute[] {
AstBuilder.getOriginalName(property.getName()),
}),
AstBuilder.toName(source),
AstBuilder.toName(property)));
}
List<AstSimpleName> grouping = Lists.create();
for (Source source : group) {
ModelProperty property = resolver.get(source.getName());
assert property != null : source;
grouping.add(AstBuilder.toName(property));
}
return new AstJoin(