/// <summary> /// Changes the XSem stereotype of this PSM Class to either XSem.PSMClass /// if the RepresentedPSMClass property is null or to XSem.PSMStructuralRepresentative /// if the RepresentedPSMClass references another PSM class. /// </summary> protected void ChangeStereotype() { Profile xsem = Schema.Profiles.Get("XSem"); Stereotype newStereotype = null; if (xsem == null) { throw new Exception("Fatal error! Could not find the XSem profile!"); } if (representedPSMClass != null) { newStereotype = xsem.Stereotypes.Get("PSMStructuralRepresentative"); } else { newStereotype = xsem.Stereotypes.Get("PSMClass"); } if (newStereotype == null) { throw new Exception("Fatal error! Could not find the XSem stereotype!"); } StereotypeInstance instance = new _StereotypeInstance(newStereotype as _Stereotype, Schema); instance.Attributes.Get("RepresentedClass").Value = xsemStereotype.Attributes.Get("RepresentedClass").Value; instance.Attributes.Get("ElementName").Value = xsemStereotype.Attributes.Get("ElementName").Value; if (representedPSMClass != null) { instance.Attributes.Get("RepresentedPSMClass").Value = new ValueSpecification(representedPSMClass); } xsemStereotype = instance; }
public QueryParameter(string parameterName) : this() { Name = parameterName; type = Stereotype.String; }
public bool Equals(DirectedModelRelationshipType other) { return(Stereotype.Equals(other.Stereotype) && Direction == other.Direction); }
/// <summary> /// Creates a PSM attribute representing the given PIM attribute. /// </summary> /// <param name="representedAttribute"> /// Reference to the represented PIM attribute /// </param> /// <param name="_schema"> /// Reference to the Schema instance that is the top /// of this model hierarchy. /// </param> /// <exception cref="ArgumentException"> /// If the given property reference is not a PIM attribute. /// </exception> public _PSMAttribute(Property representedAttribute, Schema _schema) : base(_schema) { if (representedAttribute != null && ((representedAttribute is AssociationEnd) || (representedAttribute is PSMAttribute)) ) { throw new ArgumentException("The PSM attribute can only represent a PIM attribute"); } this.representedAttribute = representedAttribute; if (representedAttribute != null) { representedAttribute.PropertyChanged += OnRepresentedAttributeChanged; } // Get the XSem.PSMAttribute stereotype and apply it try { Stereotype xsemSt = Schema.Profiles.Get("XSem").Stereotypes.Get("PSMAttribute"); xsemStereotype = xsemSt.ApplyTo(this); AppliedStereotypes.Remove(xsemStereotype); } catch (NullReferenceException) { throw new Exception("Fatal error! Cannot find the XSem profile or the XSem.PSMAttribute stereotype!"); } // Initialize the stereotype instance Property ra; string elname; if (representedAttribute != null) { elname = representedAttribute.Name; ra = representedAttribute; // Initialize the attribute properties Name = representedAttribute.Name; Aggregation = representedAttribute.Aggregation; Default = representedAttribute.Default; DefaultValue = representedAttribute.DefaultValue; IsComposite = representedAttribute.IsComposite; IsDerived = representedAttribute.IsDerived; IsOrdered = representedAttribute.IsOrdered; IsReadOnly = representedAttribute.IsReadOnly; IsUnique = representedAttribute.IsUnique; Lower = representedAttribute.Lower; Type = representedAttribute.Type; Upper = representedAttribute.Upper; Visibility = representedAttribute.Visibility; } else { elname = Name; ra = null; } xsemStereotype.Attributes.Get("RepresentedAttribute").Value = new ValueSpecification(ra); xsemStereotype.Attributes.Get("Alias").Value = new ValueSpecification(elname); referencedGeneralizations = new ObservableCollection <Generalization>(); }
public void Dispose() { _stereotype = null; base.Dispose(); }
public bool Is(ConnectorStereotype connectorStereotype) { return(Stereotype.Equals(connectorStereotype.Name) && Type.Equals(connectorStereotype.Type.Name)); }
public bool Is(Stereotype stype) { return(Stereotype.Equals(stype.Name) && Type.Equals(stype.Type.Name)); }