if (uri == null){
log.error("found invalid property definition");
} else {
// We check if we have that property already. If not, we put
// the property into the map.
MeasurableProperty existingP = properties.get(propertyId);
if (existingP == null) {
// this property could not be measured so far - add it to the map
properties.put(propertyId, p);
// and add the scale of this property too
measurementScales.put(uri, p.getScale());
}
// We look at all metrics and look
// a. is the property+metric already mapped to a scale?
// b. is the metric already listed in the property?
for(Metric m : p.getPossibleMetrics()) {
helperInfo.setMetric(m);
uri = helperInfo.getUri();
// a. if property+metric isnt yet mapped, we put down the scale.
if (!measurementScales.containsKey(uri)) {
measurementScales.put(uri, m.getScale());
}
// If we have an existing property, we have to check if it contains this metric.
// If it does not, we add the metric to ist list.
if (existingP != null && (!containsMetric(m.getMetricId(), existingP.getPossibleMetrics()))) {
existingP.getPossibleMetrics().add(m);
}
}
}
}