PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/Atlassian.Jira/CustomField.cs

https://bitbucket.org/yyo/atlassian.net-sdk-v2.0
C# | 66 lines | 46 code | 8 blank | 12 comment | 2 complexity | 83316c4a1739a647fa5251b62c3b5625 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Atlassian.Jira.Remote;
  6. namespace Atlassian.Jira
  7. {
  8. /// <summary>
  9. /// A custom field associated with an issue
  10. /// </summary>
  11. public class CustomField
  12. {
  13. private readonly Jira _jira;
  14. private readonly string _id;
  15. private readonly string _projectKey;
  16. private string _name;
  17. internal CustomField(string id, string projectKey, Jira jira)
  18. {
  19. _id = id;
  20. _jira = jira;
  21. _projectKey = projectKey;
  22. }
  23. internal CustomField(string id, string name, string projectKey, Jira jira)
  24. : this(id, projectKey, jira)
  25. {
  26. _name = name;
  27. }
  28. /// <summary>
  29. /// The values of the custom field
  30. /// </summary>
  31. public string[] Values
  32. {
  33. get;
  34. set;
  35. }
  36. /// <summary>
  37. /// Id of the custom field as defined in JIRA
  38. /// </summary>
  39. public string Id
  40. {
  41. get { return _id; }
  42. }
  43. /// <summary>
  44. /// Name of the custom field as defined in JIRA
  45. /// </summary>
  46. public string Name
  47. {
  48. get
  49. {
  50. if (String.IsNullOrEmpty(_name))
  51. {
  52. _name = _jira.GetFieldsForEdit(_projectKey).First(f => f.Id == _id).Name;
  53. }
  54. return _name;
  55. }
  56. }
  57. }
  58. }