use of org.activityinfo.legacy.shared.model.AttributeGroupDTO in project activityinfo by bedatadriven.
the class DimensionModel method attributeGroupModels.
public static List<DimensionModel> attributeGroupModels(List<AttributeGroupDTO> groups) {
/*
* Attribute Groups retain their own identity and ids
* by Activity, but once we get to this stage, we treat
* attribute groups with the same name as the same thing.
*
* This allows user to define attributes across databases
* and activities through "offline" coordination.
*/
List<DimensionModel> models = Lists.newArrayList();
Set<String> groupsAdded = Sets.newHashSet();
for (AttributeGroupDTO attributeGroup : groups) {
if (!groupsAdded.contains(attributeGroup.getName())) {
DimensionModel dimModel = new DimensionModel(attributeGroup);
models.add(dimModel);
groupsAdded.add(attributeGroup.getName());
}
}
return models;
}
Aggregations