@@ -0,0 +1,2458 @@
+/*%0A * Copyright 2014 Open mHealth%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.openmhealth.data.generator.service;%0A%0Aimport org.joda.time.DateTime;%0Aimport org.openmhealth.data.generator.domain.MeasureGroup;%0Aimport org.openmhealth.schema.pojos.Activity;%0Aimport org.openmhealth.schema.pojos.DataPoint;%0Aimport org.openmhealth.schema.pojos.HeartRate;%0Aimport org.openmhealth.schema.pojos.Metadata;%0Aimport org.openmhealth.schema.pojos.builder.ActivityBuilder;%0Aimport org.openmhealth.schema.pojos.builder.HeartRateBuilder;%0Aimport org.openmhealth.schema.pojos.generic.DurationUnitValue;%0Aimport org.openmhealth.schema.pojos.generic.LengthUnitValue;%0Aimport org.springframework.stereotype.Service;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.openmhealth.schema.pojos.generic.DurationUnitValue.DurationUnit.min;%0Aimport static org.openmhealth.schema.pojos.generic.LengthUnitValue.LengthUnit.m;%0A%0A%0A/**%0A * @author Emerson Farrugia%0A */%0A@Service%0Apublic class PhysicalActivityDataPointGenerationServiceImpl extends AbstractDataPointGenerationServiceImpl%0A        implements DataPointGenerationService %7B%0A%0A    @Override%0A    public Iterable%3CDataPoint%3E generateDataPoints(Iterable%3CMeasureGroup%3E measureGroups) %7B%0A%0A        List%3CDataPoint%3E dataPoints = new ArrayList%3C%3E();%0A%0A        for (MeasureGroup measureGroup : measureGroups) %7B%0A%0A            ActivityBuilder builder = new ActivityBuilder();%0A%0A            double duration = measureGroup.getMeasureValue(%22duration%22);%0A            builder.withStartAndDuration(convert(measureGroup.getEffectiveDateTime()), duration, min);%0A            builder.setDistance(measureGroup.getMeasureValue(%22distance%22), m);%0A%0A            Metadata metadata = new Metadata();%0A            metadata.setTimestamp(DateTime.now());%0A%0A            Activity dataPoint = builder.build();%0A            dataPoint.setMetadata(metadata);%0A%0A            dataPoints.add(dataPoint);%0A        %7D%0A%0A        return dataPoints;%0A    %7D%0A%7D%0A

Add physical activity data generation service.