public VariablePreviewStruct fill(Variable variable, bool getConstraints) { variable.Unit = variable.Unit ?? new Unit(); variable.Unit.Dimension = variable.Unit.Dimension ?? new Dimension(); variable.DataAttribute = variable.DataAttribute ?? new DataAttribute(); variable.DataAttribute.DataType = variable.DataAttribute.DataType ?? new DataType(); this.Id = variable.Id; this.Name = variable.Label; this.Description = variable.Description; this.isOptional = variable.IsValueOptional; this.Unit.Id = variable.Unit.Id; this.Unit.Name = variable.Unit.Name; this.convertibleUnits = getUnitListByDimenstionAndDataType(variable.Unit.Dimension.Id, variable.DataAttribute.DataType.Id); this.DataType = variable.DataAttribute.DataType.Name; if (getConstraints) { if (variable.DataAttribute.Constraints != null) { foreach (Constraint c in variable.DataAttribute.Constraints) { c.Materialize(); this.Constraints.Add(c.Id, c.FormalDescription); } } } this.Attribute = Attribute.fill(variable.DataAttribute, false); return(this); }
public VariablePreviewStruct() { this.Id = 0; this.Name = ""; this.Description = ""; this.isOptional = true; this.Unit = new ItemStruct(); this.convertibleUnits = new List <ItemStruct>(); this.DataType = ""; this.Constraints = new Dictionary <long, string>(); this.Attribute = new AttributePreviewStruct(); this.inUse = false; }