Beispiel #1
0
        private void SaveStakeholders(IEAElement element)
        {
            IEARepository        repository = EAMain.Repository;
            IEnumerable <string> deleted    =
                element.GetConnectors().Where(connector => connector.IsAction() && connector.ClientId != element.ID)
                .Select(c => c.GUID)
                .Except(Stakeholders.Select(a => a.ConnectorGUID));

            foreach (string connector in deleted)
            {
                element.RemoveConnector(repository.GetConnectorByGUID(connector));
            }

            foreach (IStakeholderAction connector in Stakeholders)
            {
                if ("".Equals(connector.ConnectorGUID) || null == connector.ConnectorGUID && !connector.DoDelete)
                {
                    var client   = repository.GetElementByGUID(GUID);
                    var supplier = repository.GetElementByGUID(connector.Stakeholder.GUID);
                    supplier.ConnectTo(client, EAConstants.ActionMetaType, connector.Action);
                }
                else if (connector.ConnectorGUID != null && connector.DoDelete)
                {
                    var supplier = repository.GetElementByGUID(connector.Stakeholder.GUID);
                    var temp     = EAMain.Repository.GetConnectorByGUID(connector.ConnectorGUID);
                    supplier.RemoveConnector(temp);
                }
            }
        }
Beispiel #2
0
        private void SaveRelations(IEAElement element)
        {
            IEARepository        repository = EAMain.Repository;
            IEnumerable <string> deleted    =
                element.FindConnectors(EAConstants.RelationMetaType, EAConstants.RelationDependsOn,
                                       EAConstants.RelationExcludedBy, EAConstants.RelationCausedBy,
                                       EAConstants.RelationReplaces)
                .Select(c => c.GUID)
                .Except(RelatedDecisions.Select(a => a.RelationGUID));

            foreach (string connector in deleted)
            {
                element.RemoveConnector(repository.GetConnectorByGUID(connector));
            }

            foreach (IDecisionRelation connector in RelatedDecisions)
            {
                if ("".Equals(connector.RelationGUID) || null == connector.RelationGUID)
                {
                    IEAElement client   = repository.GetElementByGUID(connector.Decision.GUID);
                    IEAElement supplier = repository.GetElementByGUID(connector.RelatedDecision.GUID);
                    client.ConnectTo(supplier, EAConstants.RelationMetaType, connector.Type);
                }
            }
        }