public RelationshipDefinition GetRelationshipDefinition(ModelRepository models) { var queryDef = new ResolveQuery() { Kind = Galileo.ElementEnum.RelationshipDefinition, TypeName = this.Name }; var itemDef = (RelationshipDefinition)queryDef.GetReferentials(models).FirstOrDefault(); return(itemDef); }
internal EntityDefinition GetDefinition(ModelRepository rep) { if (!string.IsNullOrEmpty(this.ReferenceSource)) { var item = new ResolveQuery(this.ReferenceSource); item.Kind = Galileo.ElementEnum.EntityDefinition; var items = item.GetReferentials(rep); return(items.OfType <EntityDefinition>().FirstOrDefault()); } return(null); }
internal ReferentialEntity GetEntity(ModelRepository rep) { if (!string.IsNullOrEmpty(this.ReferenceSource)) { var item = new ResolveQuery(this.ReferenceSource); var items = item.GetReferentials(rep); return(items.OfType <ReferentialEntity>().FirstOrDefault()); } return(null); }
private void SetReferenceSourceValue(string newValue) { _referenceSource = newValue; if (!string.IsNullOrEmpty(newValue)) { var referential = ReferentialResolver.Instance.GetReferential(Store); if (referential != null) { var query = new ResolveQuery(newValue); var item = query.GetReferentials(referential) .OfType <ReferentialEntity>() .FirstOrDefault(); if (item != null) { this.Name = item.Name; this.Type = item.TypeEntity; } } } }
protected override List <ProjectionItem> List() { var configViewpoint = Referential.GetCooperationViewpoint(this.Diagram.ViewpointType); if (configViewpoint != null) { var item1 = this.ModelElement; var result = new List <ProjectionItem>(300); if (item1 is Bb.ApplicationCooperationViewPoint.ModelElement me) { foreach (var e in configViewpoint.Elements) { var query = new ResolveQuery() { Kind = Galileo.ElementEnum.Entity, TypeName = e.Name }; var items = query.GetReferentials(this.Referential); result.AddRange(GetReferentials(items)); } } else if (item1 is Concept co) { foreach (var e in configViewpoint.Concepts) { var query = new ResolveQuery() { Kind = Galileo.ElementEnum.Entity, TypeName = e.Name }; var items = query.GetReferentials(this.Referential); result.AddRange(GetReferentials(items)); } } else if (item1 is SubElement se) { if (!string.IsNullOrEmpty(se.Parent.Type)) { foreach (var element in configViewpoint.Elements.Where(c => c.Name == se.Parent.Type)) { foreach (CooperationRelationship sElement in element.Children) { RelationshipDefinition itemDef = sElement.GetRelationshipDefinition(this.Referential); ResolveQuery parentQuery = se.Parent.ReferenceSource.AsQuery(); var p = parentQuery.GetReferentials(this.Referential).OfType <ReferentialEntity>().FirstOrDefault(); var children = p.GetTargetEntities(itemDef).ToList(); result.AddRange(GetReferentials(children)); } } } } else if (item1 is ConceptElement ce) { if (!string.IsNullOrEmpty(ce.Parent.Type)) { foreach (var element in configViewpoint.Elements.Where(c => c.Name == ce.Parent.Type)) { foreach (CooperationRelationship sElement in element.Children) { RelationshipDefinition itemDef = sElement.GetRelationshipDefinition(this.Referential); var parentQuery = ce.Parent.ReferenceSource.AsQuery(); var p = parentQuery.GetReferentials(this.Referential).OfType <ReferentialEntity>().FirstOrDefault(); var children = p.GetTargetEntities(itemDef).ToList(); result.AddRange(GetReferentials(children)); } } } } else if (item1 is ConceptSubElement cs) { } else if (item1 is Relationship re) { } return(result.OrderBy(c => c.Name).Cast <ProjectionItem>().ToList()); } throw new System.NotImplementedException(); }