/// <summary> /// Gets previus element associated to this element, by association type "dependency" /// </summary> /// <param name="element">Element</param> /// <param name="stereoTypeDependency">Stereotype</param> /// <returns>Previus element</returns> public static T GetPrev <T>(IUMLElement element, string stereoTypeDependency) where T : ActiveRecord <T>, new() { T item = new T(); TUPUX.Access.DataAccess dataAccess = new TUPUX.Access.DataAccess(); string key = element.Guid; StarUML.IUMLModelElement model = dataAccess.FindModel(key); try { if (model is StarUML.IUMLClassifier && model.GetSupplierDependencyCount() > 0) { for (int i = 0; i < model.GetSupplierDependencyCount(); i++) { StarUML.IUMLDependency depencency = model.GetSupplierDependencyAt(i); StarUML.IUMLClassifier prevModel = (StarUML.IUMLClassifier)depencency.Client; if (stereoTypeDependency.Equals(depencency.StereotypeName) && item.IsKindOf(prevModel.GetClassName(), prevModel.StereotypeName)) { item.Load(prevModel); return(item); } } } } catch (Exception ex) { log.Error("", ex); } return(null); }
public List <StarUML.IUMLModelElement> GetModelElements(StarUML.IUMLClassifier root) { List <StarUML.IUMLModelElement> list = new List <StarUML.IUMLModelElement>(); for (int i = 0; i < root.GetOwnedElementCount(); i++) { StarUML.IUMLModelElement model = root.GetOwnedElementAt(i); list.Add(model); } return(list); }
public StarUML.IUMLUseCase InsertUseCase(StarUML.IUMLClassifier owner, String useCaseName) { { StarUML.IUMLUseCase model = app.UMLFactory.CreateUseCase(owner); if (!String.IsNullOrEmpty(useCaseName)) { model.Name = useCaseName; } return(model); } }
public List <StarUML.IUMLModelElement> GetModelElements(StarUML.IUMLClassifier root, String stereotype, Type type) { List <StarUML.IUMLModelElement> list = new List <StarUML.IUMLModelElement>(); for (int i = 0; i < root.GetOwnedElementCount(); i++) { StarUML.IUMLModelElement model = root.GetOwnedElementAt(i); if ((model.GetType() == type) && (model.StereotypeName.Equals(stereotype))) { list.Add(model); } } return(list); }
/// <summary> /// Create the association between two elements /// </summary> /// <typeparam name="T">Type for the first element</typeparam> /// <typeparam name="T2">Type for second element</typeparam> /// <param name="element1">First element</param> /// <param name="element2">Second element</param> /// <param name="ownerElement">Owner of the association</param> public static void CreateAssociation <T, T2>(T element1, T2 element2, IUMLElement ownerElement) where T : ActiveRecord <T>, new() where T2 : ActiveRecord <T2>, new() { try { StarUML.IUMLNamespace owner = dataAccess.FindModel(ownerElement.Guid) as StarUML.IUMLNamespace; StarUML.IUMLClassifier elementStarUML1 = dataAccess.FindModel(element1.Guid) as StarUML.IUMLClassifier; StarUML.IUMLClassifier elementStarUML2 = dataAccess.FindModel(element2.Guid) as StarUML.IUMLClassifier; dataAccess.Factory.CreateAssociation(owner, elementStarUML1, elementStarUML2); } catch (Exception ex) { log.Error("CreateAssociation", ex); } }
public List <StarUML.IUMLModelElement> GetModelElements(StarUML.IUMLClassifier root, params Type[] types) { List <StarUML.IUMLModelElement> list = new List <StarUML.IUMLModelElement>(); for (int i = 0; i < root.GetOwnedElementCount(); i++) { StarUML.IUMLModelElement model = root.GetOwnedElementAt(i); foreach (Type type in types) { if (model.GetType() == type) { list.Add(model); } } } return(list); }
public static ItemType GetDependencySupplier <ItemType>(string key) where ItemType : ActiveRecord <ItemType>, new() { TUPUX.Access.DataAccess dataAccess = new TUPUX.Access.DataAccess(); StarUML.IUMLModelElement model = dataAccess.FindModel(key); if (model is StarUML.IUMLDependency || model is StarUML.IUMLRealization) { StarUML.IUMLClassifier classifier = (StarUML.IUMLClassifier)((StarUML.IUMLDependency)model).Supplier; ItemType item = new ItemType(); if (classifier != null && item.IsKindOf(classifier.GetClassName(), classifier.StereotypeName)) { item.Load(classifier); return(item); } } return(null); }
public static ItemType GetAssociationEndParticipant <ItemType>(string key) where ItemType : ActiveRecord <ItemType>, new() { TUPUX.Access.DataAccess dataAccess = new TUPUX.Access.DataAccess(); StarUML.IUMLModelElement model = dataAccess.FindModel(key); if (model is StarUML.IUMLAssociationEnd) { StarUML.IUMLClassifier classifier = ((StarUML.IUMLAssociationEnd)model).Participant; ItemType item = new ItemType(); if (classifier != null && item.IsKindOf(classifier.GetClassName(), classifier.StereotypeName)) { item.Load(classifier); return(item); } } return(null); }