if (measuresMap.get(FAT_RATIO)!=null)
facet.fatRatio = measuresMap.get(FAT_RATIO);
return facet;
}
};
final AbstractFacet createdOrModifiedFacet = apiDataService.createOrReadModifyWrite(WithingsBodyScaleMeasureFacet.class, facetQuery, facetModifier, updateInfo.apiKey.getId());
bodyTrackStorageService.storeApiData(updateInfo.apiKey.getGuestId(), Arrays.asList(createdOrModifiedFacet));
}
if (measuresMap.containsKey(DIASTOLIC_BLOOD_PRESSURE) &&
measuresMap.containsKey(SYSTOLIC_BLOOD_PRESSURE) &&
measuresMap.get(DIASTOLIC_BLOOD_PRESSURE)>0f &&
measuresMap.get(SYSTOLIC_BLOOD_PRESSURE)>0f) {
final ApiDataService.FacetModifier<WithingsBPMMeasureFacet> facetModifier = new ApiDataService.FacetModifier<WithingsBPMMeasureFacet>() {
@Override
public WithingsBPMMeasureFacet createOrModify(WithingsBPMMeasureFacet facet, final Long apiKeyId) {
if (facet==null)
facet = new WithingsBPMMeasureFacet(updateInfo.apiKey.getId());
extractCommonFacetData(facet, updateInfo);
facet.objectType = ObjectType.getObjectType(connector, "blood_pressure").value();
facet.measureTime = date;
facet.start = date;
facet.end = date;
facet.systolic = measuresMap.get(SYSTOLIC_BLOOD_PRESSURE);
facet.diastolic = measuresMap.get(DIASTOLIC_BLOOD_PRESSURE);
if (measuresMap.get(HEART_PULSE)!=null)
facet.heartPulse = measuresMap.get(HEART_PULSE);
return facet;
}
};
final AbstractFacet createdOrModifiedFacet = apiDataService.createOrReadModifyWrite(WithingsBPMMeasureFacet.class, facetQuery, facetModifier, updateInfo.apiKey.getId());
bodyTrackStorageService.storeApiData(updateInfo.apiKey.getGuestId(), Arrays.asList(createdOrModifiedFacet));
}
if (measuresMap.containsKey(HEART_PULSE)) {
final ApiDataService.FacetModifier<WithingsHeartPulseMeasureFacet> facetModifier = new ApiDataService.FacetModifier<WithingsHeartPulseMeasureFacet>() {
@Override
public WithingsHeartPulseMeasureFacet createOrModify(WithingsHeartPulseMeasureFacet facet, final Long apiKeyId) {
if (facet==null)
facet = new WithingsHeartPulseMeasureFacet(updateInfo.apiKey.getId());
extractCommonFacetData(facet, updateInfo);
facet.objectType = ObjectType.getObjectType(connector, "heart_pulse").value();
facet.start = date;
facet.end = date;
facet.heartPulse = measuresMap.get(HEART_PULSE);
return facet;
}
};
final AbstractFacet createdOrModifiedFacet = apiDataService.createOrReadModifyWrite(WithingsHeartPulseMeasureFacet.class, facetQuery, facetModifier, updateInfo.apiKey.getId());
bodyTrackStorageService.storeApiData(updateInfo.apiKey.getGuestId(), Arrays.asList(createdOrModifiedFacet));
}
}