Exemplo n.º 1
0
 /// <summary>
 /// method handles item creations during synchronization
 /// </summary>
 /// <param name="itemCreation">instance of item creation carrying information about item creation</param>
 /// <param name="repository">EA repository</param>
 /// <returns>GUID of new item</returns>
 public string handleSynchronizationAdditions(ItemCreation itemCreation, EA.Repository repository)
 {
     string GUID = "";
     if (itemCreation.elementType == 3)
     {
         GUID = synchronizationAdditions.addPackage(repository, itemCreation.packageGUID, itemCreation.name, itemCreation.author);
     }
     else if (itemCreation.elementType >= 50 && itemCreation.elementType < 70)
     {
         GUID = synchronizationAdditions.addDiagram(repository, itemCreation.parentGUID, itemCreation.packageGUID,
             itemCreation.elementType, itemCreation.name, itemCreation.author);
     }
     else if (itemCreation.elementType < 50)
     {
         GUID = synchronizationAdditions.addElement(repository, itemCreation.parentGUID, itemCreation.packageGUID,
             itemCreation.coordinates, itemCreation.elementType, itemCreation.name, itemCreation.author);
     }
     else if (itemCreation.elementType >= 70 && itemCreation.elementType <= 79)
     {
         GUID = synchronizationAdditions.addConnector(repository, itemCreation.srcGUID, itemCreation.targetGUID, itemCreation.name, itemCreation.elementType);
     }
     else if (itemCreation.elementType == 90)
     {
         GUID = synchronizationAdditions.addAttribute(repository, itemCreation.parentGUID, itemCreation.name, itemCreation.coordinates);
     }
     else if (itemCreation.elementType == 700)
     {
         synchronizationAdditions.addDiagramObject(repository, itemCreation.itemGUID, itemCreation.diagramGUID, itemCreation.coordinates);
         GUID = "";
     }
     return GUID;
 }
Exemplo n.º 2
0
        public void handleElementCreation(Repository repository, int elementID)
        {
            try {
                changed = false;
                EA.Element el = repository.GetElementByID(elementID);
                currentItem = el;

                ItemCreation itemCreation = new ItemCreation();
                itemCreation.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                itemCreation.itemGUID = el.ElementGUID;
                itemCreation.elementType = itemTypes.getElementType(el.ElementGUID);
                itemCreation.author = el.Author;
                itemCreation.name = el.Name;
                itemCreation.parentGUID = "0";

                if (itemTypes.getElementType(el.ElementGUID) != 6 &&
                    (itemTypes.getElementType(el.ElementGUID) < 30 || itemTypes.getElementType(el.ElementGUID) > 44))
                {
                    if (el.ParentID != 0)
                    {
                        EA.Element parent = repository.GetElementByID(el.ParentID);
                        if (parent != null)
                        {
                            itemCreation.parentGUID = parent.ElementGUID;
                        }
                    }
                }

                EA.Package package = repository.GetPackageByID(el.PackageID);
                if (package != null)
                {
                    itemCreation.packageGUID = package.PackageGUID;
                }

                changeService.saveChange(itemCreation);

                if (el.Type == "UseCase")
                {
                    currentExtensionPoints.Add(el.ElementGUID, el.ExtensionPoints);
                }
            }
            catch (Exception ex) { }
        }
Exemplo n.º 3
0
        public void handleDiagramObjectCreation(Repository repository, int elementID, int diagramID, string DUID)
        {
            try
            {
                changed = false;

                EA.Element el = repository.GetElementByID(elementID);
                EA.Diagram diag = repository.GetDiagramByID(diagramID);

                Wrapper.Diagram diagram = new Wrapper.Diagram(model, diag);
                Wrapper.ElementWrapper elWrapper = new Wrapper.ElementWrapper(model, el);

                DiagramObject cur = diagram.getdiagramObjectForElement(elWrapper);
                string coordinates = "";
                coordinates += "l=" + cur.left + ";";
                coordinates += "r=" + cur.right + ";";
                coordinates += "t=" + cur.top + ";";
                coordinates += "b=" + cur.bottom + ";";
                currentDiagramObjectPositions.Add(cur.ElementID, coordinates);

                ItemCreation itemCreation = new ItemCreation();
                itemCreation.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                itemCreation.itemGUID = el.ElementGUID;
                itemCreation.diagramGUID = diag.DiagramGUID;
                itemCreation.elementType = 700;
                itemCreation.coordinates = "";

                for (short i = 0; i < diag.DiagramObjects.Count; i++)
                {
                    EA.DiagramObject diagramObject = (EA.DiagramObject)diag.DiagramObjects.GetAt(i);
                    if (diagramObject.ElementID == el.ElementID)
                    {
                        coordinates = "";
                        coordinates += "l=" + diagramObject.left + ";";
                        coordinates += "r=" + diagramObject.right + ";";
                        coordinates += "t=" + diagramObject.top + ";";
                        coordinates += "b=" + diagramObject.bottom + ";";
                        itemCreation.coordinates = coordinates;
                        break;
                    }
                }

                changeService.saveChange(itemCreation);
            }
            catch (Exception ex) { }
        }
Exemplo n.º 4
0
        public void handleDiagramCreation(Repository repository, int diagramID)
        {
            try
            {
                changed = false;
                EA.Diagram diagram = repository.GetDiagramByID(diagramID);

                ItemCreation itemCreation = new ItemCreation();
                itemCreation.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                itemCreation.itemGUID = diagram.DiagramGUID;
                itemCreation.elementType = itemTypes.getDiagramType(diagram.DiagramGUID);
                itemCreation.author = diagram.Author;
                itemCreation.name = diagram.Name;
                itemCreation.parentGUID = "0";

                if (diagram.ParentID != 0)
                {
                    EA.Element parent = repository.GetElementByID(diagram.ParentID);
                    if (parent != null)
                    {
                        itemCreation.parentGUID = parent.ElementGUID;
                    }
                }

                EA.Package package = repository.GetPackageByID(diagram.PackageID);
                if (package != null)
                {
                    itemCreation.packageGUID = package.PackageGUID;
                }

                changeService.saveChange(itemCreation);
            }
            catch (Exception ex) { }
        }
Exemplo n.º 5
0
        public void handleConnectorCreation(Repository repository, int connectorID)
        {
            try
            {
                currentItem = null;
                currentDiagram = null;
                changed = false;
                EA.Connector connector = repository.GetConnectorByID(connectorID);
                currentConnector = connector;

                ItemCreation itemCreation = new ItemCreation();
                itemCreation.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                itemCreation.itemGUID = connector.ConnectorGUID;
                itemCreation.elementType = itemTypes.getConnectorType(connector.ConnectorGUID);
                itemCreation.name = connector.Name;
                itemCreation.srcGUID = repository.GetElementByID(connector.ClientID).ElementGUID;
                itemCreation.targetGUID = repository.GetElementByID(connector.SupplierID).ElementGUID;

                changeService.saveChange(itemCreation);
            }
            catch (Exception ex) { }
        }
Exemplo n.º 6
0
        public void handleAttributeCreation(Repository repository, int attributeID)
        {
            try
            {
                changed = false;
                EA.Attribute attribute = repository.GetAttributeByID(attributeID);
                EA.Element element = repository.GetElementByID(attribute.ParentID);

                ItemCreation itemCreation = new ItemCreation();
                itemCreation.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                itemCreation.itemGUID = attribute.AttributeGUID;
                itemCreation.parentGUID = element.ElementGUID;
                itemCreation.elementType = 90;
                itemCreation.name = attribute.Name;
                itemCreation.coordinates = attribute.Visibility;

                changeService.saveChange(itemCreation);

                currentAttributes.Add(attribute.AttributeGUID, attribute);
            }
            catch (Exception ex) { }
        }
Exemplo n.º 7
0
        public void handlePackageCreation(Repository repository, int packageID)
        {
            try
            {
                changed = false;
                EA.Package package = repository.GetPackageByID(packageID);
                currentPackage = package;

                ItemCreation itemCreation = new ItemCreation();
                itemCreation.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                itemCreation.itemGUID = package.PackageGUID;
                itemCreation.elementType = 3;
                itemCreation.author = package.Element.Author;
                itemCreation.name = package.Name;
                itemCreation.parentGUID = "0";

                EA.Package parentPackage = repository.GetPackageByID(package.ParentID);
                if (parentPackage != null)
                {
                    itemCreation.packageGUID = parentPackage.PackageGUID;
                }

                changeService.saveChange(itemCreation);
            }
            catch (Exception ex) { }
        }