private static string NombreNodoMinimized(KBObject obj) { string objName = ""; if (obj != null) { objName = obj.Name + ":" + obj.TypeDescriptor.Name; if (obj.GetPropertyValue <bool>(KBObjectProperties.IsGeneratedObject)) { if (InstanceManager.IsInstanceObject(obj, out PatternDefinition pattern)) { if (obj.Parent.Parent != null) { objName = NombreNodo(obj.Parent.Parent); } else { KBDoctorOutput.Error("Don't exist Parent.Parent of " + objName); } } } else { if (obj is Table t) { //objName = NombreNodo(t.BestAssociatedTransaction); } } } return(objName); }
private static bool isGenerated(KBObject obj) { if (obj is DataSelector) //Los Dataselector no tienen la propiedad de generarlos o no , por lo que siempre devuelven falso y sin son referenciados se generan. { return(true); } object aux = obj.GetPropertyValue(Artech.Genexus.Common.Properties.TRN.GenerateObject); return((aux != null) && (aux.ToString() == "True")); }
private static ObjectVisibility RecoverObjectVisibility(KBObject obj) { if (obj is Table) { return(TableVisibility((Table)obj)); } else { return(obj.GetPropertyValue <ObjectVisibility>("ObjectVisibility")); } }
private static bool isGeneratedbyPattern(KBObject obj) { if (!(obj == null)) { return(obj.GetPropertyValue <bool>(KBObjectProperties.IsGeneratedObject)); } else { return(true); } }
bool IsObjectSelected(CommandData data, bool mustBeMain, out KBObject obj) { obj = null; if (data.Context == null) { return(false); } obj = KBObjectSelectionHelper.TryGetOnlyOneKBObjectFrom(data.Context); if (obj != null && mustBeMain) { return(obj.GetPropertyValue <bool>("IsMain")); } return(true); }
private static string NombreNodo(KBObject obj) { string objName = ""; if (obj != null) { objName = obj.Name + ":" + obj.TypeDescriptor.Name; if (obj.GetPropertyValue <bool>(KBObjectProperties.IsGeneratedObject)) { PatternDefinition pattern; if (InstanceManager.IsInstanceObject(obj, out pattern)) { // objName = obj.Parent.Name +":" + obj.Parent.TypeDescriptor.Name; objName = obj.Parent.Name.Replace("WorkWithPlus", ""); objName = objName.Replace("WorkWith", ""); objName = objName + ":Transaction"; } } } return(objName); }
public static int ReferenceWeight(KBObject obj, KBObject objRef) { int weight = 2; //2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, and 97 if (objRef is WebPanel) { weight = 1; } if ((objRef is Transaction) & (objRef.GetPropertyValue <bool>("idISBUSINESSCOMPONENT"))) { weight = 1; } if (objRef is Table) { if (obj is Transaction) { Table t = (Table)objRef; foreach (Transaction trn in t.AssociatedTransactions) { if (obj == trn) { weight = 89; //Esta tabla es generada por esa transaccion } } } else { weight = 13; } } return(weight); }
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); }
public static void AttUpdated() { IKBService kbserv = UIServices.KB; string title = "KBDoctor - Where update this attribute? :"; string outputFile = Functions.CreateOutputFile(kbserv, title); IOutputService output = CommonServices.Output; output.StartSection(title); AskAttributeandTable at = new AskAttributeandTable(); DialogResult dr = new DialogResult(); dr = at.ShowDialog(); if (dr == DialogResult.OK) { string tblName = at.tblName; string attName = at.attName; List <string> Objlist = new List <string>(); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title + attName + " in table " + tblName); writer.AddTableHeader(new string[] { "Object", "Description", "Type", "Navigation File" }); int IndFiles = 0; // IKBService kbserv = UIServices.KB; string directoryArg = KBDoctorHelper.SpcDirectory(kbserv); string fileWildcard = @"*.xml"; var searchSubDirsArg = System.IO.SearchOption.AllDirectories; string[] xFiles = System.IO.Directory.GetFiles(directoryArg, fileWildcard, searchSubDirsArg); foreach (string x in xFiles) { // output.AddLine(x); IndFiles += 1; if (IndFiles % 100 == 0) { output.AddLine(" Procesing " + IndFiles.ToString() + " navigation files."); } string filename = Path.GetFileNameWithoutExtension(x); if (!Objlist.Contains(filename)) { Objlist.Add(filename); if (!Path.GetFileNameWithoutExtension(x).StartsWith("Gx0")) { string xmlstring = AddXMLHeader(x); if (ObjectUpdateTable(xmlstring, tblName, attName)) { KBObject obj = ExtractObject(xmlstring); if (obj == null) { writer.AddTableData(new string[] { "Can't find object", "", "", x }); } else if (KBDoctorCore.Sources.Utility.isGenerated(obj) || obj.GetPropertyValue <bool>("idISBUSINESSCOMPONENT")) { writer.AddTableData(new string[] { Functions.linkObject(obj), obj.Description, obj.TypeDescriptor.Name, x }); } } } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); } }
public static bool isGenerated(KBObject obj) { object aux = obj.GetPropertyValue(Artech.Genexus.Common.Properties.TRN.GenerateObject); return((aux != null) && (aux.ToString() == "True")); }
public static bool isMain(KBObject obj) { object aux = obj.GetPropertyValue("isMain"); return((aux != null) && (aux.ToString() == "True")); }
bool IsObjectSelected(CommandData data, bool mustBeMain, out KBObject obj) { obj = null; if (data.Context == null) return false; obj = KBObjectSelectionHelper.TryGetOnlyOneKBObjectFrom(data.Context); if (obj != null && mustBeMain) return obj.GetPropertyValue<bool>("IsMain"); return true; }