public AttributeWrapper(Model model, global::EA.Attribute wrappedAttribute) : base(model) { this.wrappedAttribute = wrappedAttribute; var dummy = this.type; //make sure we get the type here to avoid multithreading errors this.isDirty = false; }
/// creates a new EAAttribute based on the given EA.Attribute internal AttributeWrapper createEAAttributeWrapper(global::EA.Attribute attributeToWrap) { if (EnumerationLiteral.isLiteralValue(this.model as Model, attributeToWrap)) { return(new EnumerationLiteral(this.model as Model, attributeToWrap)); } else { return(new Attribute(this.model as Model, attributeToWrap)); } }
public EnumerationLiteral(Model model, global::EA.Attribute wrappedAttribute) : base(model, wrappedAttribute) { if (!this.wrappedAttribute.StyleEx.Contains("IsLiteral=")) { this.wrappedAttribute.StyleEx = "IsLiteral=1;" + this.wrappedAttribute.StyleEx; } else { this.wrappedAttribute.StyleEx = this.wrappedAttribute.StyleEx.Replace("IsLiteral=0;", "IsLiteral=1;"); } }
private void addAttributes(XElement f, global::EA.Attribute att, object verdi) { if (geoUtil.IsMultippel(att.LowerBound + ".." + att.UpperBound)) { for (int i = 0; i < 3; i++) { XElement a = new XElement(_app + att.Name, verdi); f.Add(a); } } else { XElement a = new XElement(_app + att.Name, verdi); f.Add(a); } }
/// creates a new EAAttribute based on the given EA.Attribute internal Attribute createEAAttribute(global::EA.Attribute attributeToWrap) { return(new Attribute(this.model as Model, attributeToWrap)); }
public static bool isLiteralValue(Model model, global::EA.Attribute wrappedAttribute) { //if the field StyleEx contains "IsLiteral=1" then it is a literal value return(wrappedAttribute.StyleEx.Contains("IsLiteral=1")); }
private void ConvertAttributes(Element el, XElement f, Repository repository, string unikId) { //arv først alle arvede attributter foreach (Connector connector in el.Connectors) { // if (connector.MetaType == "Generalization") { Element elm = repository.GetElementByID(connector.SupplierID); if (el.Name != elm.Name) //Kan ikke arve seg selv { LogDebug("Arver: " + elm.Name + " på " + el.Name); ConvertAttributes(elm, f, repository, unikId); } } } foreach (global::EA.Attribute att in el.Attributes) { try { LogDebug("Attributt: " + att.Name + " på " + el.Name); // Boolean kjentType = false; foreach (KjentType kt in KjenteTyper) { if (kt.Navn == att.Type) { kjentType = true; // string verdi = "kjenttype TODO"; if (kt.Datatype == "CharacterString") { verdi = "Lorem ipsum"; } if (kt.Datatype == "Real") { Random rnd = new Random(); double dbl = rnd.NextDouble(); verdi = dbl.ToString(); } if (kt.Navn == "Link") { verdi = "http://kartverket.no/Standarder/SOSI/"; } if (kt.Navn == "Organisasjonsnummer") { verdi = "87654321"; } addAttributes(f, att, verdi); } } if (kjentType) { //Alt utført } // Typene i xsd-"format": http://www.arkitektum.no/files/sosi/StandardMapEntries_sosi.xml else if (att.Type.ToLower() == "integer") { Random rnd = new Random(); int integer = rnd.Next(1, 13); addAttributes(f, att, integer); } else if (att.Type.ToLower() == "characterstring") { string verdi = "Lorem ipsum"; if (att.Name.ToLower() == "lokalid") { verdi = unikId; } addAttributes(f, att, verdi); } else if (att.Type.ToLower() == "real") // double { Random rnd = new Random(); double dbl = rnd.NextDouble(); addAttributes(f, att, dbl); } else if (att.Type.ToLower() == "date") { addAttributes(f, att, DateTime.Now.ToString("yyyy-MM-dd")); } else if (att.Type.ToLower() == "datetime") { addAttributes(f, att, DateTime.Now.ToLocalTime()); } else if (att.Type.ToLower() == "boolean") { addAttributes(f, att, "true"); } else if (att.Type.ToLower() == "flate") // gml:SurfacePropertyType { addSurface(f, att); } else if (att.Type.ToLower() == "punkt") // gml:PointPropertyType { addPoint(f, att); } else if (att.Type.ToLower() == "sverm") // gml:MultiPointPropertyType { addPointCloud(f, att); } else if (att.Type.ToLower() == "kurve") // gml:CurvePropertyType { addCurve(f, att); } else if (att.Type.ToLower() == "gm_solid") { addSolid(f, att); } else if (att.ClassifierID != 0) { Element attel = repository.GetElementByID(att.ClassifierID); if (attel.Stereotype.ToLower() == "codelist" || attel.Stereotype.ToLower() == "enumeration" || attel.Type.ToLower() == "enumeration") { if (attel.Attributes.Count > 0) { Random rnd = new Random(); int pos = rnd.Next(0, attel.Attributes.Count - 1); global::EA.Attribute tmp = attel.Attributes.GetAt((short)pos); string verdi = tmp.Default; if (String.IsNullOrEmpty(verdi)) { verdi = tmp.Name; } XElement a = new XElement(_app + att.Name, verdi); //hvis asDictionary=true legge inn codespace if (GetTaggedValueFromElement(attel, "asDictionary") == "true") { string kodeliste = GetTaggedValueFromAttribute(att, "defaultCodespace"); if (String.IsNullOrEmpty(kodeliste)) { kodeliste = GetTaggedValueFromElement(attel, "codelist"); } if (String.IsNullOrEmpty(kodeliste)) { kodeliste = "ingen url angitt"; } a.Add(new XAttribute("codeSpace", kodeliste)); } if (geoUtil.IsMultippel(att.LowerBound + ".." + att.UpperBound)) { for (int i = 0; i < 3; i++) { f.Add(a); } } else { f.Add(a); } } else { XElement a = new XElement(_app + att.Name, "ingen koder i kodeliste"); f.Add(a); } } else { if (geoUtil.IsMultippel(att.LowerBound + ".." + att.UpperBound)) { for (int i = 0; i < 3; i++) { XElement a = new XElement(_app + att.Name); XElement b = new XElement(_app + attel.Name); a.Add(b); f.Add(a); ConvertAttributes(attel, b, repository, unikId); } } else { XElement a = new XElement(_app + att.Name); XElement b = new XElement(_app + attel.Name); a.Add(b); f.Add(a); ConvertAttributes(attel, b, repository, unikId); } } } } catch (Exception ex) { Log("FEIL: I objekt " + el.Name + " " + ex.Message); } } foreach (Connector connector in el.Connectors) { try { //BUG kommer ut feil rekkefølge ifht shapechange på noen få tilfeller, har direction noe å si her? // if ((connector.MetaType == "Association" || connector.MetaType == "Aggregation") && connector.Stereotype.ToLower() != "topo") { Element source = repository.GetElementByID(connector.SupplierID); Element destination = repository.GetElementByID(connector.ClientID); if (connector.SupplierID == connector.ClientID) //Selvassosiasjon { addClientEnd(f, repository, unikId, connector, destination); addSupplierEnd(f, repository, unikId, connector, source); } else if (el.Name == source.Name) //Er Supplier siden { addClientEnd(f, repository, unikId, connector, destination); } else //Er destination/Client siden { addSupplierEnd(f, repository, unikId, connector, source); } } } catch (Exception ex) { Log("FEIL: I objekt " + el.Name + " og en av relasjonene " + ex.Message); } } }
public Attribute(Model model, global::EA.Attribute wrappedAttribute) : base(model, wrappedAttribute) { }
public Attribute(Model model, global::EA.Attribute wrappedAttribute) : base(model) { this.wrappedAttribute = wrappedAttribute; }