Querying Configurations and Localizations
Overview
In addition to working with Digital.ai Agility assets, the .NET SDK provides read-only access to a subset of system configurations and localizations to allow for client-side data validation.
For system configurations, settings for Effort Tracking, Story Tracking Level, Defect Tracking Level are available so that entry of Effort, Detail Estimate, and To Do can be done consistently with the way VersionOne is configured.
For system localizations, you can look up the value used within the VersionOne user interface based on the asset's or attribute's system name.
Prior to querying configurations and localizations in Agility, you must firstinstantiatea V1Connector object:
V1Connector connector = V1Connector
.WithInstanceUrl("<Server Base URI>")
.WithUserAgentHeader("AppName", "1.0")
.WithAccessToken("1.rWM8lKLk+PnyFxkEWVX5Kl2u6Jk=")
.Build();
Querying System Configurations
While working with Agility assets requires the use of the Services object, accessing the system configurations requires using the V1Configuration object. This example shows how toget the available system settings using the V1Configuration object:
var configuration = new V1Configuration(connector);
Console.WriteLine("Effort tracking level: {0}", configuration.EffortTracking);
Console.WriteLine("Story tracking level: {0}", configuration.StoryTrackingLevel);
Console.WriteLine("Defect tracking level: {0}", configuration.DefectTrackingLevel);
Console.WriteLine("Capacity planning: {0}", configuration.CapacityPlanning);
Console.WriteLine("Maximum attachment size: {0}", configuration.MaxAttachmentSize);
/***** OUTPUT *****
Effort tracking level: True
Story tracking level: Mix
Defect tracking level: Mix
Capacity planning: ByMemberByTeam
Maximum attachment size: 4194304
******************/
Detail Estimate, ToDo and Effort can be entered for Stories and Defects, or for their child Tasks and Tests, depending on how the system is configured. The StoryTrackingLevel and DefectTrackingLevel properties indicate where input of Detail Estimate, To Do and Effort are taken.
A value of "True" indicates that Detail Estimate, ToDo, and Effort input is accepted at the Primary Workitem level only. A value of "False" indicates that Detail Estimate, ToDo, and Effort input is accepted at the Task/Test level only. A value of "Mix" indicates that Detail Estimate, ToDo, and Effort input is accepted at both the Primary Workitem and Task/Test level.
Querying System Localizations
Accessing system localizations is accomplished via the Services object using itsLoc method, and there are three approaches that it supports.
The first approach is used for getting the localized name of an asset and involves passing its system name:
var services = new Services(connector);
Console.WriteLine("Epic name: {0}", services.Loc("Epic"));
/***** OUTPUT *****
Epic name: Portfolio Item
******************/
The second approach is used for getting the localized value of a single attribute and involves passing its attribute definition:
var services = new Services(connector);
var epicType = services.Meta.GetAssetType("Epic");
var nameAttribute = epicType.GetAttributeDefinition("Name");
Console.WriteLine("Epic name: {0}", services.Loc(nameAttribute));
/***** OUTPUT *****
Epic name: Title
******************/
The third approach is used for getting the localized values of multiple attributes and involves passing their attribute definitions:
var services = new Services(connector);
var storyType = services.Meta.GetAssetType("Story");
var nameAttribute = storyType.GetAttributeDefinition("Name");
var estimateAttribute = storyType.GetAttributeDefinition("Estimate");
var localizations = services.Loc(nameAttribute, estimateAttribute);
Console.WriteLine("Story name: {0}", localizations[nameAttribute.Token]);
Console.WriteLine("Story estimate: {0}", localizations[estimateAttribute.Token]);
/***** OUTPUT *****
Story name: Title
Story estimate: Estimate Pts.
******************/