Exemple #1
0
        internal void CreateMapper()
        {
            if (string.IsNullOrEmpty(this.ViewpointType))
            {
                throw new Exception("Please select a viewpoint type in the propertygrid");
            }

            var referential = ReferentialResolver.Instance.GetReferential(this.Store);

            if (referential == null)
            {
                throw new Exception("referential can't be loded");
            }

            var viewpointConfig = referential.GetCooperationViewpoint(this.ViewpointType);

            if (viewpointConfig == null)
            {
                throw new Exception($"the viewpoint type '{this.ViewpointType}' can't be found. please select a valid viewpoint type");
            }



            using (var form = new Bb.Galileo.Viewpoints.Cooperations.SelectReferential(referential))
            {
                form.SetViewpoint(viewpointConfig);
                //form.SetSelectedKeys(keys);

                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ViewpointProjectionEntities k2 = form.GetSelectedKeys();
                    CreateItem(k2);
                }
            }
        }
Exemple #2
0
 private void GenerateRelationships(ViewpointProjectionEntities k2)
 {
     foreach (ViewpointProjectionEntity item in k2.Entities)
     {
         GenerateRelationships(item);
     }
 }
Exemple #3
0
        private void CreateItem(ViewpointProjectionEntities k2)
        {
            using (Transaction t = this.Store.TransactionManager.BeginTransaction("automated model"))
            {
                foreach (var item in k2.Entities)
                {
                    if (item.Kind == Galileo.Files.Viewpoints.ViewpointItem.Concept)
                    {
                        Concept concept = GetConcept(item);
                        foreach (var parent in item.Children)
                        {
                            ConceptElement s = GetConceptElement(concept, parent);
                            foreach (var subParent in parent.Children)
                            {
                                GetConceptSubElement(s, subParent);
                            }
                        }
                    }
                    else
                    {
                        ModelElement parent = GetModelElement(item);
                        foreach (var subParent in item.Children)
                        {
                            GetSubElement(parent, subParent);
                        }
                    }
                }

                //    t.Commit();
                //}
                //using (Transaction t = this.Store.TransactionManager.BeginTransaction("automated model"))
                //{

                GenerateRelationships(k2);

                t.Commit();
            }
        }