Esempio n. 1
0
        internal static KBObjectCollection ModuleObjects(Module module)
        {
            {
                KBObjectCollection objectsModule = new KBObjectCollection();
                foreach (KBObject obj in module.GetAllMembers())
                {
                    if (KBObjectHelper.IsSpecifiable(obj))
                    {
                        if (!objectsModule.Contains(obj))
                        {
                            objectsModule.Add(obj);
                        }
                    }
                }


                foreach (Table tbl in Table.GetAll(module.Model))

                {
                    if (TablesHelper.TableModule(module.Model, tbl) == module)
                    {
                        objectsModule.Add(tbl);
                    }
                }
                return(objectsModule);
            }
        }
Esempio n. 2
0
        private static KBObjectCollection CreateListObjectsModuleAndReferences(KBModel kbModel, Module mdl, KBDoctorXMLWriter writer)
        {
            KBObjectCollection objToBuild = new KBObjectCollection();

            foreach (KBObject obj in mdl.GetAllMembers())
            {
                if (KBObjectHelper.IsSpecifiable(obj) && KBDoctorCore.Sources.Utility.isGenerated(obj))
                {
                    if (!objToBuild.Contains(obj))
                    {
                        objToBuild.Add(obj);
                        writer.AddTableData(new string[] { obj.QualifiedName.ToString(), obj.Description, obj.QualifiedName.ToString() + " (" + obj.TypeDescriptor.Name + ")" });
                    }
                }
                AddObjectsReferenceTo(obj, objToBuild, writer);
            }

            foreach (Table tbl in Table.GetAll(kbModel))
            {
                if (TablesHelper.TableModule(kbModel, tbl) == mdl)
                {
                    AddObjectsReferenceTo(tbl, objToBuild, writer);
                }
            }
            return(objToBuild);
        }
Esempio n. 3
0
        private static void GenerateKBConexComponentGraph(string name)
        {
            IKBService         kbserv   = UIServices.KB;
            KBModel            model    = kbserv.CurrentModel;
            int                i        = 0;
            string             fileName = name + i + ".gexf";
            KBObjectCollection visited  = new KBObjectCollection();

            IEnumerable <KBObject> listObjNode = (from r in model.Objects.GetAll() where isNode(r) select model.Objects.Get(r.Key));

            foreach (KBObject obj in listObjNode)
            {
                if (!visited.Contains(obj))
                {
                    i += 1;
                    visited.Add(obj);
                    IOutputService output = CommonServices.Output;
                    output.AddLine("");
                    output.AddWarningLine("START Componente conexo " + i.ToString());

                    ComponenteConexo(obj, visited);

                    output.AddWarningLine("FIN Componente conexo " + i.ToString());
                }
            }
        }
Esempio n. 4
0
        private static void AddReferencedObj(KBObjectCollection objColl, KBObject obj, string tabs)
        {
            IKBService     kbserv = UIServices.KB;
            IOutputService output = CommonServices.Output;

            objColl.Add(obj);
            string RefTabs = tabs + "    ";

            if (ObjectsHelper.IsCallalable(obj))
            {
                foreach (EntityReference reference in obj.GetReferences())
                {
                    KBObject objRef = KBObject.Get(obj.Model, reference.To);

                    if ((objRef != null) && !(objColl.Contains(objRef)) && (reference.ReferenceType == ReferenceType.Hard) && (ObjectsHelper.IsCallalable(objRef)))
                    {
                        if (!(objRef is Procedure))
                        {
                            output.AddLine(tabs + "XCOPY " + objRef.Name + ".DLL %DESTINO% "); //+ " (" + obj.TypeDescriptor.Name + ")" );
                        }
                        AddReferencedObj(objColl, objRef, RefTabs);
                    }
                }
            }
        }
Esempio n. 5
0
 public static void AddObjectsReferenceTo(KBObject obj, KBObjectCollection objToBuild, KBDoctorXMLWriter writer)
 {
     foreach (EntityReference refe in obj.GetReferencesTo())
     {
         KBObject objRef = KBObject.Get(obj.Model, refe.From);
         if (objRef != null && KBObjectHelper.IsSpecifiable(objRef) && !objToBuild.Contains(objRef) && KBDoctorCore.Sources.Utility.isGenerated(objRef))
         {
             objToBuild.Add(objRef);
             writer.AddTableData(new string[] { objRef.QualifiedName.ToString(), objRef.Description, obj.QualifiedName.ToString() + " (" + obj.TypeDescriptor.Name + ")" });
         }
     }
 }
Esempio n. 6
0
        private static void MarkReachables(IOutputService output, KBObject obj, KBObjectCollection reachablesObjects)
        {
            reachablesObjects.Add(obj);

            foreach (EntityReference reference in obj.GetReferences(LinkType.UsedObject))
            {
                KBObject objRef = KBObject.Get(obj.Model, reference.To);

                if ((objRef != null) && !reachablesObjects.Contains(objRef))
                {
                    MarkReachables(output, objRef, reachablesObjects);
                }
            }
        }
Esempio n. 7
0
        private static void VisitNode(KBObjectCollection visited, KBObject obj, KBObject objRef)
        {
            IOutputService output = CommonServices.Output;

            if (isNode(objRef))
            {
                output.AddLine(NombreNodo(obj) + ";" + NombreNodo(objRef));

                if (!visited.Contains(objRef))
                {
                    visited.Add(objRef);
                    ComponenteConexo(objRef, visited);
                }
            }
        }
Esempio n. 8
0
        public static void BuildModule()
        {
            IKBService     kbserv  = UIServices.KB;
            KBModel        kbModel = UIServices.KB.CurrentModel;
            IOutputService output  = CommonServices.Output;

            bool   success = true;
            string title   = "KBDoctor - Build Module";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Object", "Description", "Visibility" });

            KBObjectCollection objToBuild = new KBObjectCollection();

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;

            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>());
            foreach (Module mdl in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                foreach (KBObject o in CreateListObjectsModuleAndReferences(kbModel, mdl, writer))
                {
                    objToBuild.Add(o);
                }
            }

            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);

            GenexusUIServices.Build.BuildWithTheseOnly(objToBuild.Keys);

            do
            {
                Application.DoEvents();
            } while (GenexusUIServices.Build.IsBuilding);

            output.EndSection("KBDoctor", true);
        }
Esempio n. 9
0
        private static KBObjectCollection ObjectsReferencesFromOutside(KBObject obj)
        {
            KBObjectCollection objCol = new KBObjectCollection();

            string mdlName = ObjectModuleName(obj);

            foreach (EntityReference refer in obj.GetReferencesTo())
            {
                KBObject objRef = KBObject.Get(obj.Model, refer.From);
                if (objRef != null && Functions.isRunable(objRef))
                {
                    string mdlNameRef = ObjectModuleName(objRef);
                    if (mdlNameRef != mdlName)
                    {
                        if (obj is Table)
                        {
                            objCol.Add(obj);
                        }
                    }
                }
            }
            return(objCol);
        }
Esempio n. 10
0
        public static string MainsOf(KBObject obj, KBObjectCollection objColl, string callTree)
        {
            string mains = "";

            if (!objColl.Contains(obj))
            {
                objColl.Add(obj);

                if (obj.GetPropertyValue <bool>("IsMain"))
                {
                    string objAppGenerator = obj.GetPropertyValueString("AppGenerator");
                    if (objAppGenerator.Contains("Java Win") && callTree.Contains("HMaster"))
                    {
                        mains = "";
                    }
                    else
                    {
                        mains = callTree + "/" + Functions.linkObject(obj) + "(" + objAppGenerator + ")<BR> ";
                    }
                }
                else
                {
                    callTree += obj.Name + "/";
                    foreach (EntityReference reference in obj.GetReferencesTo())
                    {
                        KBObject objRef = KBObject.Get(obj.Model, reference.From);

                        if ((objRef != null) && (obj.Name != objRef.Name) && (reference.ReferenceType == ReferenceType.Hard) && reference.LinkType == LinkType.UsedObject /*&& (obj.TypeDescriptor.Name != "MasterPage")*/ && !objColl.Contains(objRef))
                        {
                            mains += MainsOf(objRef, objColl, callTree);
                        }
                    }
                }
            }
            return(mains);
        }
Esempio n. 11
0
        internal static void ObjectsToDivide()

        {
            IKBService     kbserv     = UIServices.KB;
            KBModel        kbModel    = UIServices.KB.CurrentModel;
            IOutputService output     = CommonServices.Output;
            bool           success    = true;
            int            objInRoot  = 0;
            int            objSinRoot = 0;
            string         title      = "KBDoctor - Objects to divide";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Object", "Module", "Type", "Is referenced by" });

            KBObjectCollection objRefCollection = new KBObjectCollection();

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = false;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>());
            Module module2 = new Module(kbModel);

            foreach (Module module in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                module2 = module;

                output.AddLine("Procesing " + module.Name + "....");

                foreach (KBObject obj in ModuleObjects(module))
                {
                    foreach (EntityReference reference in obj.GetReferences())
                    {
                        KBObject objref = KBObject.Get(obj.Model, reference.To);
                        if (objref != null && objref.TypeDescriptor.Name != "Attribute" && objref.TypeDescriptor.Name != "MasterPage")
                        {
                            Module objrefModule = ((objref is Table) ? TablesHelper.TableModule(objref.Model, (Table)objref) : objref.Module);

                            if (objrefModule != module)
                            {
                                if (!(objref is Domain) && !(objref is Image) && !(objref is Theme) && !(objref is ThemeClass) &&
                                    !(objref is GeneratorCategory) && !(objref is KBCategory) && !(objref is SDT))
                                {
                                    bool contain = objRefCollection.Any(p => p.Guid == objref.Guid);
                                    if (!contain)
                                    {
                                        objRefCollection.Add(objref);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            string listObj = "";

            //Listo todos los objetos externos referenciados desde el modulo
            foreach (KBObject o in objRefCollection)
            {
                listObj = "";
                //Armo lista de objetos de mi modulo que referencian al objeto externo
                foreach (EntityReference refe in o.GetReferencesTo())
                {
                    KBObject objref = KBObject.Get(o.Model, refe.From);
                    if (objref != null)
                    {
                        Module objrefModule = ((objref is Table) ? TablesHelper.TableModule(objref.Model, (Table)objref) : objref.Module);
                        if (objrefModule == module2)
                        {
                            listObj += " " + Functions.linkObject(objref);
                        }
                    }
                }
                Module oModule = ((o is Table) ? TablesHelper.TableModule(o.Model, (Table)o) : o.Module);
                writer.AddTableData(new string[] { Functions.linkObject(o), oModule.Name, o.TypeDescriptor.Name, listObj });
            }
            output.AddLine("");
            output.EndSection(title, success);

            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }