private void UpperValue(IEntity entity, XmlNode element) { if (entity is IEntityAttribute) { IEntityAttribute field = entity as IEntityAttribute; XmlAttribute upperValue = element.Attributes["value"]; if (null != upperValue) { if (upperValue.Value == "*") { field.Mult = Multiplicity.OneToMany; } else { field.Mult = Multiplicity.OneToOne; } ResolveReference(field); } } else { throw new UnknownContextException("UpperValue is being parse in a unknown context. UpperValue show be child of UML:Property"); } }
private void ResolveReferenceMultiplicity(IEntityAttribute field) { if (field is EntityField) { ResolveReferenceMultiplicity((EntityField)field); } }
public void ResolveReference(IEntityAttribute field) { if (field is EntityField && field.Type is EntityClass) { EntityField e = (EntityField)field; if (e.ReferenceType == null && e.Type != null && e.Mult != Multiplicity.OneToOne) { EntityField reference = new EntityField(); reference.Name = e.Parent.Name; reference.Type = e.Parent; reference.InfoOnly = true; reference.ReferenceType = e; EntityClass entity = ((EntityClass)field.Type); if (entity.HasField(reference.Name)) { e.ReferenceType = entity.GetField(reference.Name); } else { e.ReferenceType = reference; entity.AddField(reference); } ResolveReferenceMultiplicity(e); } } }
public void AddAttribute(IEntityAttribute newAttribute) { AgentAttribute newAgentAttribute = gameObject.AddComponent <AgentAttribute> (); //if (newAgentAttribute != null) //{ // m_Attributes.Add(newAgentAttribute); //} }
public bool Equals(IEntityAttribute other) { var isEqual = (this.Id.Equals(other.Id) && this.IdEntity.Equals(other.IdEntity)) || (this.Name.Equals(other.Name) && this.IdEntity.Equals(other.IdEntity)); return(isEqual); }
private void ResolveIntrinsicType(XmlNode element, IEntityAttribute field) { if (element != null && element.HasChildNodes && element.FirstChild.HasChildNodes) { XmlAttribute type = element.FirstChild.FirstChild.Attributes["referentPath"]; if (type != null) { if (!dataTypes.ContainsKey(type.Value)) { string key = Translator.Translate(type.Value.ToLower()); if (null == key) { throw new UnknownIntrinsicTypeException(type.Value); } dataTypes.Add(type.Value, Loki.DataRepresentation.Loaders.IntrinsicTypes.Create(key)); } field.Type = dataTypes[type.Value]; } } }
public void ResolveType(XmlNode element, IEntityAttribute field, bool addifnotfound) { XmlAttribute type = element.Attributes["type"]; if (null != type) { if (dataTypes.ContainsKey(type.Value)) { field.Type = dataTypes[type.Value]; ResolveReference(field); } else { if (addifnotfound) { field.Resolved = false; unresolved.Add(new UnresolvedInfo(element, new EntityAttributeResolver(field))); } } } }
/// <summary> /// Build an oracle type with any precision, length, etc. qualifiers included. /// </summary> /// <param name="attr"></param> /// <returns></returns> internal static string BuildAggregateOracleType(IEntityAttribute attr) { if (String.IsNullOrEmpty(attr.AttrType)) { return(attr.AttrType); } string oracleType = attr.AttrType.Trim(); // handle Oracle aliaes if (oracleType.Equals(Orcl.DECIMAL) || oracleType.Equals(Orcl.NUMERIC)) { oracleType = Orcl.NUMBER; } if (oracleType == Orcl.NUMBER) // add precisions and scale, if any, to NUMBER to create complete data type { if (attr.Precision != null || attr.Scale == 0) { oracleType += "(" + (attr.Precision ?? 38).ToString(); } if (attr.Precision != null || attr.Scale == 0) { oracleType += "," + (attr.Scale ?? 0).ToString(); } if (attr.Precision != null || attr.Scale == 0) { oracleType += ")"; } } else if (oracleType.Contains(Orcl.VARCHAR)) { if (attr.Length >= 1) { oracleType = oracleType + "(" + attr.Length + ")"; } } return(oracleType); }
private void ParsePrimitiveType(IEntity entity, XmlNode element) { try { if (entity is IEntityAttribute) { IEntityAttribute field = entity as IEntityAttribute; ResolveIntrinsicType(element, field); IterateInnerChilds(element, field); } else { throw new UnknownContextException("uml:PrimitiveType is being parse in a unknown context. uml:PrimitiveType show be child of UML:Property or UML:Parameter"); } } catch (UnknownIntrinsicTypeException ex) { if (entity is EntityField) { EntityField field = (EntityField)entity; throw new Exception("Error loading field '" + field.PropertyName + "'", ex); } throw; } }
public bool Equals(IEntityAttribute other) { return(this.Id.Equals(other.Id)); }
public EntityAttributeResolver(IEntityAttribute entity) : base(entity) { }
public EntityAttributeResolver( IEntityAttribute entity ) : base(entity) { }
public void ResolveReference( IEntityAttribute field ) { if( field is EntityField && field.Type is EntityClass ) { EntityField e = (EntityField)field; if( e.ReferenceType == null && e.Type != null && e.Mult != Multiplicity.OneToOne ) { EntityField reference = new EntityField(); reference.Name = e.Parent.Name; reference.Type = e.Parent; reference.InfoOnly = true; reference.ReferenceType = e; EntityClass entity = ((EntityClass)field.Type); if( entity.HasField( reference.Name ) ) { e.ReferenceType = entity.GetField( reference.Name ); }else{ e.ReferenceType = reference; entity.AddField( reference ); } ResolveReferenceMultiplicity( e ); } } }
public void ResolveType(XmlNode element, IEntityAttribute field, bool addifnotfound) { XmlAttribute type = element.Attributes["type"]; if( null != type ) { if( dataTypes.ContainsKey( type.Value ) ) { field.Type = dataTypes[type.Value]; ResolveReference( field ); } else { if( addifnotfound ) { field.Resolved = false; unresolved.Add( new UnresolvedInfo( element, new EntityAttributeResolver( field ) ) ); } } } }
private void ResolveIntrinsicType( XmlNode element, IEntityAttribute field ) { if( element != null && element.HasChildNodes && element.FirstChild.HasChildNodes ) { XmlAttribute type = element.FirstChild.FirstChild.Attributes["referentPath"]; if( type != null ) { if( !dataTypes.ContainsKey( type.Value ) ) { string key = Translator.Translate( type.Value.ToLower() ); if( null == key ) { throw new UnknownIntrinsicTypeException( type.Value ); } dataTypes.Add( type.Value, Loki.DataRepresentation.Loaders.IntrinsicTypes.Create( key ) ); } field.Type = dataTypes[type.Value]; } } }
private void ResolveReferenceMultiplicity( IEntityAttribute field ) { if( field is EntityField ) { ResolveReferenceMultiplicity( (EntityField)field ); } }
internal static String GetDataTypeProperName(IEntityAttribute entityAttribute) { return(IsExistsType(entityAttribute.DataType) ? String.Empty : entityAttribute.DataType); }