Set<String> notFoundProperties = new HashSet<String>(condition.getDeviceProperties().keySet());
for (RedirectDevicePropertyConditionData propertyConditionData : redirectConditionData
.getDevicePropertyConditionData()) {
DeviceProperty deviceProperty = condition.getDeviceProperties().get(propertyConditionData.getPropertyName());
// if not found, then create it
if (deviceProperty == null) {
deviceProperty = condition.createDeviceProperty();
condition.getDeviceProperties().put(propertyConditionData.getPropertyName(), deviceProperty);
} else {
// if found, remove from the nonFound list
notFoundProperties.remove(propertyConditionData.getPropertyName());
}
deviceProperty.setName(propertyConditionData.getPropertyName());
if (propertyConditionData.getGreaterThan() != null) {
deviceProperty.setGreaterThan(propertyConditionData.getGreaterThan());
}
if (propertyConditionData.getLessThan() != null) {
deviceProperty.setLessThan(propertyConditionData.getLessThan());
}
if (propertyConditionData.getEquals() != null) {
deviceProperty.setEquals(propertyConditionData.getEquals());
}
if (propertyConditionData.getMatches() != null) {
deviceProperty.setPattern(propertyConditionData.getMatches().toString());
}
}
// remove all the device conditions which were not in the RedirectConditionData list
for (String devicePropertyName : notFoundProperties) {