Extras del Elemento |
Superior Previo Próximo |
Objeto público ' ' ejemplos de cómo acceder y usar extras de elementos - tales como ' ' escenarios, restricciones y requisitos
Sub ElementExtras
Dim element as object Dim o as object Dim idx as Integer Dim bDel as boolean bDel = true
try element = m_Repository.GetElementByID(129)
'administra las restricciones para un elemento 'muestra addnew y borra o = element.Constraints.AddNew("Appended","Type") If not o.Update Then Console.WriteLine("Constraint error:" + o.GetLastError()) End if element.Constraints.Refresh For idx = 0 to element.Constraints.Count -1 o = element.Constraints.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Appended") Then If bDel Then element.Constraints.Delete (idx) End if Next
'esfuerzos o = element.Efforts.AddNew("Appended","Type") If not o.Update Then Console.WriteLine("Efforts error:" + o.GetLastError()) End if element.Efforts.Refresh For idx = 0 to element.Efforts.Count -1 o = element.Efforts.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Appended") Then If bDel Then element.Efforts.Delete (idx) End if Next
'riesgos o = element.Risks.AddNew("Appended","Type") If not o.Update Then Console.WriteLine("Risks error:" + o.GetLastError()) End if element.Risks.Refresh For idx = 0 to element.Risks.Count -1 o = element.Risks.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Appended") Then If bDel Then element.Risks.Delete (idx) End if Next
'Métricas o = element.Metrics.AddNew("Appended","Change") If not o.Update Then Console.WriteLine("Metrics error:" + o.GetLastError()) End if element.Metrics.Refresh For idx = 0 to element.Metrics.Count -1 o = element.Metrics.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Appended") Then If bDel Then element.Metrics.Delete (idx) End if Next
'Valores Etiquetados o = element.TaggedValues.AddNew("Appended","Change") If not o.Update Then Console.WriteLine("TaggedValues error:" + o.GetLastError()) End if element.TaggedValues.Refresh For idx = 0 to element.TaggedValues.Count -1 o = element.TaggedValues.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Appended") Then If bDel Then element.TaggedValues.Delete (idx) End if Next
'Escenarios o = element.Scenarios.AddNew("Appended","Change") If not o.Update Then Console.WriteLine("Scenarios error:" + o.GetLastError()) End if element.Scenarios.Refresh For idx = 0 to element.Scenarios.Count -1 o = element.Scenarios.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Appended") Then If bDel Then element.Scenarios.Delete (idx) End if Next
'Archivos o = element.Files.AddNew("MyFile","doc") If not o.Update Then Console.WriteLine("Files error:" + o.GetLastError()) End if element.Files.Refresh For idx = 0 to element.Files.Count -1 o = element.Files.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="MyFile") Then If bDel Then element.Files.Delete (idx) End if Next
'Pruebas o = element.Tests.AddNew("TestPlan","Load") If not o.Update Then Console.WriteLine("Tests error:" + o.GetLastError()) End if element.Tests.Refresh For idx = 0 to element.Tests.Count -1 o = element.Tests.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="TestPlan") Then If bDel Then element.Tests.Delete (idx) End if Next
'Defectos o = element.Issues.AddNew("Broken","Defect") If not o.Update Then Console.WriteLine("Issues error:" + o.GetLastError()) End if element.Issues.Refresh For idx = 0 to element.Issues.Count -1 o = element.Issues.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Broken") Then If bDel Then element.Issues.Delete (idx) End if Next
'Cambios o = element.Issues.AddNew("Change","Change") If not o.Update Then Console.WriteLine("Issues error:" + o.GetLastError()) End if element.Issues.Refresh For idx = 0 to element.Issues.Count -1 o = element.Issues.GetAt(idx) Console.WriteLine(o.Name) If(o.Name="Change") Then If bDel Then element.Issues.Delete (idx) End if Next
catch e as exception Console.WriteLine(element.Methods.GetLastError()) Console.WriteLine(e) End try
End Sub |