Example #1
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);
                }
            }
        }
Example #2
0
        private void LoadRelations(IEAElement element)
        {
            RelatedDecisions.Clear();
            IEnumerable <IDecisionRelation> relations = element.FindConnectors(EAConstants.RelationMetaType,
                                                                               EAConstants.RelationDependsOn,
                                                                               EAConstants.RelationExcludedBy,
                                                                               EAConstants.RelationCausedBy,
                                                                               EAConstants.RelationReplaces)
                                                        .Select(
                a => (IDecisionRelation) new DecisionRelation(this, a));

            foreach (IDecisionRelation relation in relations)
            {
                RelatedDecisions.Add(relation);
            }
        }