Search in sources :

Example 6 with AttributeGroupDTO

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;
}
Also used : AttributeGroupDTO(org.activityinfo.legacy.shared.model.AttributeGroupDTO)

Aggregations

AttributeGroupDTO (org.activityinfo.legacy.shared.model.AttributeGroupDTO)6 ActivityFormDTO (org.activityinfo.legacy.shared.model.ActivityFormDTO)5 Test (org.junit.Test)4 GetActivityForm (org.activityinfo.legacy.shared.command.GetActivityForm)3 HashMap (java.util.HashMap)2 UserDatabaseDTO (org.activityinfo.legacy.shared.model.UserDatabaseDTO)2 CreateEntity (org.activityinfo.legacy.shared.command.CreateEntity)1 Filter (org.activityinfo.legacy.shared.command.Filter)1 GetActivityForms (org.activityinfo.legacy.shared.command.GetActivityForms)1 UpdateEntity (org.activityinfo.legacy.shared.command.UpdateEntity)1 ActivityFormResults (org.activityinfo.legacy.shared.command.result.ActivityFormResults)1 CreateResult (org.activityinfo.legacy.shared.command.result.CreateResult)1 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)1 OnDataSet (org.activityinfo.server.database.OnDataSet)1 SchemaCsvWriter (org.activityinfo.server.endpoint.rest.SchemaCsvWriter)1