public void CollectAttribute(EAPModel model, EA.Attribute l_Attr, EAPClass l_Class, bool group, EAPClass l_ClassGroup = null) { EAPAttribute l_MyAttr = new EAPAttribute(); l_MyAttr.Description = l_Attr.Notes; l_MyAttr.Settable = !l_Attr.IsConst; l_MyAttr.Max = l_Attr.UpperBound; l_MyAttr.Min = l_Attr.LowerBound; l_MyAttr.Index = l_Attr.Pos; l_MyAttr.Default = ReturnValue(l_MyAttr, l_Attr); l_MyAttr.Visible = !l_Attr.IsStatic; if (model.Enums.ContainsKey(l_Attr.Type)) { l_MyAttr.TypeCode = "Enum"; } if (model.Classes.ContainsKey(l_Attr.Type)) { l_MyAttr.TypeCode = "Class"; } if (group) { if (l_ClassGroup == null) { l_MyAttr.Group = l_Class.Code; } else { l_MyAttr.Group = l_ClassGroup.Code; } } if (l_MyAttr.Description.Split(':').Length > 1) { l_MyAttr.Title = l_MyAttr.Description.Split(':')[0]; l_MyAttr.Description = l_MyAttr.Description.Remove(0, l_MyAttr.Title.Length + 1); } else { l_MyAttr.Title = ""; l_MyAttr.Description = l_MyAttr.Description.Trim(); } l_MyAttr.Title = l_MyAttr.Title.Replace("<b>", "").Replace("</b>", "").Replace("<i>", "").Replace("</i>", "").Trim(); l_MyAttr.Description = l_MyAttr.Description.Replace("<b>", "").Replace("</b>", "").Replace("<i>", "").Replace("</i>", "").Trim(); l_MyAttr.Code = l_Attr.Style; l_MyAttr.Name = l_Attr.Name; FindType(l_Class, l_MyAttr, l_Attr); l_MyAttr.Aggregated = GetAggregated(l_Attr, l_MyAttr); l_MyAttr.Searchable = GetSearchable(l_Attr, l_MyAttr); l_MyAttr.Cardinality = GetCardinality(l_Attr, l_MyAttr) == 0 ? null : GetCardinality(l_Attr, l_MyAttr).ToString(); if (!(l_Class.AddAttribute(l_MyAttr))) { if (Validate) { tw.WriteLine("Attribute Model Code:" + l_Attr.Style + ", already exists in Class name: " + l_Class.Name + ". (Look at EAP)"); tw.WriteLine("*************************************************************************"); tw.WriteLine("\n\n"); } } }
private void CollenctConectors(EAPModel model, Connector l_Attr, EAPClass l_Class, bool group, EA.Element l_class) { EAPAttribute l_MyAttr = new EAPAttribute(); l_MyAttr.Description = l_Attr.Notes; if (l_MyAttr.Description.Split(':').Length > 1) { l_MyAttr.Title = l_MyAttr.Description.Split(':')[0]; l_MyAttr.Description = l_MyAttr.Description.Remove(0, l_MyAttr.Title.Length + 1); } else { l_MyAttr.Title = ""; l_MyAttr.Description = l_MyAttr.Description.Trim(); } l_MyAttr.Title = l_MyAttr.Title.Replace("<b>", "").Replace("</b>", "").Replace("<i>", "").Replace("</i>", "").Trim(); l_MyAttr.Description = l_MyAttr.Description.Replace("<b>", "").Replace("</b>", "").Replace("<i>", "").Replace("</i>", "").Trim(); l_MyAttr.Code = l_Attr.Alias; bool pom = false; if (l_class.ElementID == l_Attr.ClientID) { l_MyAttr.Name = l_Attr.SupplierEnd.Role; l_MyAttr.Code = l_Attr.SupplierEnd.Alias; if (StringManipulationManager.GetMaxCardinality(l_Attr.SupplierEnd.Cardinality).Equals("*")) { l_MyAttr.Max = "*"; string min = l_Attr.SupplierEnd.Cardinality.Substring(0, 1); l_MyAttr.Min = min; // pair of attributes on same connector for Add and Remove Ref l_MyAttr.onSameConnectorPairAtt = new EAPAttribute(l_Attr.ClientEnd.Role, l_Attr.ClientEnd.Alias); } else if (StringManipulationManager.GetMaxCardinality(l_Attr.SupplierEnd.Cardinality).Equals("1")) { l_MyAttr.Max = "1"; l_MyAttr.Min = "1"; // pair of attributes on same connector for Add and Remove Ref l_MyAttr.onSameConnectorPairAtt = new EAPAttribute(l_Attr.ClientEnd.Role, l_Attr.ClientEnd.Alias); } else if (StringManipulationManager.GetMaxCardinality(l_Attr.ClientEnd.Cardinality).Equals("2")) { l_MyAttr.Max = "2"; l_MyAttr.Min = "0"; // pair of attributes on same connector for Add and Remove Ref l_MyAttr.onSameConnectorPairAtt = new EAPAttribute(l_Attr.ClientEnd.Role, l_Attr.ClientEnd.Alias); } pom = true; } else { l_MyAttr.Name = l_Attr.ClientEnd.Role; l_MyAttr.Code = l_Attr.ClientEnd.Alias; if (StringManipulationManager.GetMaxCardinality(l_Attr.ClientEnd.Cardinality).Equals("*")) { l_MyAttr.Max = "*"; string min = l_Attr.ClientEnd.Cardinality.Substring(0, 1); l_MyAttr.Min = min; // pair of attributes on same connector for Add and Remove Ref l_MyAttr.onSameConnectorPairAtt = new EAPAttribute(l_Attr.SupplierEnd.Role, l_Attr.SupplierEnd.Alias); } else if (StringManipulationManager.GetMaxCardinality(l_Attr.ClientEnd.Cardinality).Equals("1")) { l_MyAttr.Max = "1"; l_MyAttr.Min = "1"; // pair of attributes on same connector for Add and Remove Ref l_MyAttr.onSameConnectorPairAtt = new EAPAttribute(l_Attr.SupplierEnd.Role, l_Attr.SupplierEnd.Alias); } else if (StringManipulationManager.GetMaxCardinality(l_Attr.ClientEnd.Cardinality).Equals("2")) { l_MyAttr.Max = "2"; l_MyAttr.Min = "0"; // pair of attributes on same connector for Add and Remove Ref l_MyAttr.onSameConnectorPairAtt = new EAPAttribute(l_Attr.SupplierEnd.Role, l_Attr.SupplierEnd.Alias); } } if (l_MyAttr.Max == "*") { if (pom) { l_MyAttr.MeasurementType = "List<" + FindClassById(l_Attr.SupplierID, MyModelCopy) + ">"; } else { l_MyAttr.MeasurementType = "List<" + FindClassById(l_Attr.ClientID, MyModelCopy) + ">"; } l_MyAttr.IsListOfReferences = true; } else if (l_MyAttr.Max == "1") { l_MyAttr.MeasurementType = "long"; l_MyAttr.IsReference = true; } // FindType(l_Class, l_MyAttr, l_Attr); //l_MyAttr.Aggregated = GetAggregated(l_Attr, l_MyAttr); // l_MyAttr.Searchable = GetSearchable(l_Attr, l_MyAttr); // l_MyAttr.Cardinality = GetCardinality(l_Attr, l_MyAttr) == 0 ? null : GetCardinality(l_Attr, l_MyAttr).ToString(); if (!(l_Class.AddAttribute(l_MyAttr))) { if (Validate) { tw.WriteLine("Attribute Model Code:" + l_Attr.Alias + ", already exists in Class name: " + l_Class.Name + ". (Look at EAP)"); tw.WriteLine("*************************************************************************"); tw.WriteLine("\n\n"); } } }