Esempio n. 1
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. 2
0
        private static void ListCategories(KBObject obj, StreamWriter file)
        {
            //CATEGORIES
            IEnumerable <Artech.Udm.Framework.References.EntityReference> refe = obj.GetReferences();

            string        GUIDCatString = "00000000-0000-0000-0000-000000000006";
            List <string> categories    = new List <string>();

            foreach (Artech.Udm.Framework.References.EntityReference reference in refe)
            {
                Guid   GUIDRefTo       = reference.To.Type;
                string GUIDRefToString = GUIDRefTo.ToString();

                if (GUIDRefToString == GUIDCatString)
                {
                    KBCategory cat = KBCategory.Get(UIServices.KB.CurrentModel, reference.To.Id);
                    categories.Add(cat.Name);
                }
            }

            if (categories.Count > 0)
            {
                PrintSectionHeader("CATEGORIES", file);
                foreach (string name in categories)
                {
                    file.WriteLine(name);
                }
            }
        }
Esempio n. 3
0
        private static void ComponenteConexo(KBObject obj, KBObjectCollection visited)
        {
            foreach (EntityReference r in obj.GetReferencesTo())
            {
                KBObject objRef = KBObject.Get(obj.Model, r.From);
                VisitNode(visited, obj, objRef);
            }

            foreach (EntityReference r in obj.GetReferences())
            {
                KBObject objRef = KBObject.Get(obj.Model, r.To);
                VisitNode(visited, obj, objRef);
            }
        }
Esempio n. 4
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. 5
0
        private static List <Module> ListModulesOfReferencedTables(KBObject obj)
        {
            List <Module> moduleList = new List <Module>();

            foreach (EntityReference refe in obj.GetReferences())
            {
                KBObject objref = KBObject.Get(obj.Model, refe.To);
                if (objref != null && objref is Table)
                {
                    Module objrefModule = TablesHelper.TableModule(objref.Model, (Table)objref);
                    if (!moduleList.Contains(objrefModule))
                    {
                        moduleList.Add(objrefModule);
                    }
                }
            }

            return(moduleList);
        }
Esempio n. 6
0
        public static void List2(KBObject obj, string objLocation, Dictionary <string, KBObjectCollection> dic, KBDoctorXMLWriter writer)
        {
            string objMasterPage = obj.GetPropertyValueString("MasterPage");

            writer.AddTableData(new string[] { obj.TypeDescriptor.Name, Functions.linkObject(obj), objLocation, objMasterPage });
            if (ObjectsHelper.IsCallalable(obj))
            {
                foreach (EntityReference reference in obj.GetReferences())
                {
                    KBObject      objRef         = KBObject.Get(obj.Model, reference.To);
                    string        typeDescriptor = obj.TypeDescriptor.Name;
                    List <string> list           = new List <string> {
                        "WebPanel", "Transaction", "WorkPanel"
                    };

                    if ((objRef != null) && list.Contains(typeDescriptor) && (reference.ReferenceType == ReferenceType.Hard))
                    {
                        int                count     = 0;
                        string             locations = "";
                        KBObjectCollection objColl   = new KBObjectCollection();
                        foreach (string loc in dic.Keys)
                        {
                            if ((loc != objLocation) && (list.Contains(objRef.TypeDescriptor.Name)))
                            {
                                dic.TryGetValue(loc, out objColl);
                                if (objColl.Contains(obj))
                                {
                                    locations += " " + loc;
                                    count     += 1;
                                }
                            }
                        }
                        if (count > 0)
                        {
                            string objRefMasterPage = objRef.GetPropertyValueString("MasterPage");
                            writer.AddTableData(new string[] { "+-----Called >>" + objRef.TypeDescriptor.Name, Functions.linkObject(objRef), count.ToString() + "-" + locations, objRefMasterPage });
                        }
                    }
                }
            }
        }
        private static void WriteObjectContent(KBObject obj, StreamWriter file)
        {
            RulesPart rp = obj.Parts.Get <RulesPart>();

            if (rp != null)
            {
                file.WriteLine(Environment.NewLine + "=== RULES ===");
                file.WriteLine(rp.Source);
            }

            EventsPart ep = obj.Parts.Get <EventsPart>();

            if (ep != null)
            {
                file.WriteLine(Environment.NewLine + "=== EVENTS SOURCE ===");
                file.WriteLine(ep.Source);
            }

            switch (obj.TypeDescriptor.Name)
            {
            case "Attribute":

                Artech.Genexus.Common.Objects.Attribute att = (Artech.Genexus.Common.Objects.Attribute)obj;

                file.WriteLine(Functions.ReturnPicture(att));
                if (att.Formula == null)
                {
                    file.WriteLine("");
                }
                else
                {
                    file.WriteLine(att.Formula.ToString());
                }
                break;

            case "Procedure":
                ProcedurePart pp = obj.Parts.Get <ProcedurePart>();
                if (pp != null)
                {
                    file.WriteLine(Environment.NewLine + "=== PROCEDURE SOURCE ===");
                    file.WriteLine(pp.Source);
                }
                break;

            case "Transaction":
                StructurePart sp = obj.Parts.Get <StructurePart>();
                if (sp != null)
                {
                    file.WriteLine(Environment.NewLine + "=== STRUCTURE ===");
                    file.WriteLine(sp.ToString());
                }
                break;

            case "WorkPanel":
                break;

            case "WebPanel":
                break;

            case "WebComponent":
                break;

            case "Table":
                Table tbl = (Table)obj;

                foreach (TableAttribute attr in tbl.TableStructure.Attributes)
                {
                    String line = "";
                    if (attr.IsKey)
                    {
                        line = "*";
                    }
                    else
                    {
                        line = " ";
                    }

                    line += attr.Name + "  " + attr.GetPropertiesObject().GetPropertyValueString("DataTypeString") + "-" + attr.GetPropertiesObject().GetPropertyValueString("Formula");

                    if (attr.IsExternalRedundant)
                    {
                        line += " External_Redundant";
                    }

                    line += " Null=" + attr.IsNullable;
                    if (attr.IsRedundant)
                    {
                        line += " Redundant";
                    }

                    file.WriteLine(line);
                }
                break;


            case "SDT":
                SDT sdtToList = (SDT)obj;
                if (sdtToList != null)
                {
                    file.WriteLine(Environment.NewLine + "=== STRUCTURE ===");
                    ListStructure(sdtToList.SDTStructure.Root, 0, file);
                }
                break;

            default:

                //Unknown object. Use export format.
                file.Write(SerializeObject(obj).ToString());
                break;
            }

            file.WriteLine(Environment.NewLine + "====== PROPERTIES =======");
            foreach (Property prop in obj.Properties)
            {
                if (!prop.IsDefault)
                {
                    file.WriteLine(prop.Name + " -> " + prop.Value.ToString());
                }
                else
                {
                    if ((prop.Name == "CommitOnExit") || (prop.Name == "TRNCMT") || (prop.Name == "GenerateObject"))
                    {
                        file.WriteLine(prop.Name + " -> " + prop.Value.ToString());
                    }
                }
            }

            //CATEGORIES
            IEnumerable <Artech.Udm.Framework.References.EntityReference> refe = obj.GetReferences();

            string        GUIDCatString = "00000000-0000-0000-0000-000000000006";
            List <string> categories    = new List <string>();

            foreach (Artech.Udm.Framework.References.EntityReference reference in refe)
            {
                Guid   GUIDRefTo       = reference.To.Type;
                string GUIDRefToString = GUIDRefTo.ToString();

                if (GUIDRefToString == GUIDCatString)
                {
                    KBCategory cat = KBCategory.Get(UIServices.KB.CurrentModel, reference.To.Id);
                    categories.Add(cat.Name);
                }
            }

            if (categories.Count > 0)
            {
                file.WriteLine(Environment.NewLine + "====== CATEGORIES =======");
                foreach (string name in categories)
                {
                    file.WriteLine(name);
                }
            }
        }