private Composition convertFromList(list l) { Composition result = new Composition(); if (l.property != null) { foreach (property p in l.property) { result.put(p.name, p.Value); } } if (l.list1 != null) { foreach (list l1 in l.list1) { result.properties.Add(l1.name, convertFromList(l1)); } } return result; }
public ValidationResult(lmbox source) { validations = new Dictionary<String, Composition>(); foreach (item i in source.items) { if (!Constants.ValidationResult.VALIDATION_RESULT_TYPE.Equals(i.type)) { throw new LmBoxException(String.Format("Wrong object type '{0}', expected '{1}'", (i.type != null) ? i.type : "<null>", Constants.ValidationResult.VALIDATION_RESULT_TYPE)); } Composition pmValidateProperties = new Composition(); String productModuleNumber = null; if (i.property != null) { foreach (property p in i.property) { switch (p.name) { case Constants.ProductModule.PRODUCT_MODULE_NUMBER: productModuleNumber = p.Value; break; default: pmValidateProperties.put(p.name, p.Value); break; } } } if (i.list != null) { foreach (list l in i.list) { pmValidateProperties.properties.Add(l.name, convertFromList(l)); } } if (productModuleNumber == null) { throw new LmBoxException(String.Format("Validation item does not contain property '{0}'", Constants.ProductModule.PRODUCT_MODULE_NUMBER)); } setProductModuleValidation(productModuleNumber, pmValidateProperties); } }