+ /**
+ * API to update the attribute values from given
+ * {@link SimulatorResourceModel}.
+ */
+ public void update(SimulatorResourceModel resourceModel) {
+ if (null == resourceModel || 0 == resourceModel.size())
+ return;
+
+ for (Map.Entry<String, SimulatorResourceAttribute> entry : resourceModel
+ .getAttributes().entrySet()) {
+ SimulatorResourceAttribute newAttribute = entry.getValue();
+ SimulatorResourceAttribute attribute = getAttribute(entry.getKey());
+ if (null != newAttribute && null != attribute) {
+ if (null != attribute.property()) {
+ AttributeValueValidation validation = new AttributeValueValidation(
+ attribute.property());
+ if (!validation.validate(newAttribute.value())) {
+ mValues.put(entry.getKey(), newAttribute.value());
+ }
+ } else {
+ mValues.put(entry.getKey(), newAttribute.value());
+ }
+ }
+ }
+ }