public SortedDictionary <int, JiraNamedEntity> getIssueTypes(JiraServer server)
 {
     lock (issueTypeCache) {
         if (issueTypeCache.ContainsKey(server.GUID))
         {
             return(issueTypeCache[server.GUID]);
         }
     }
     return(new SortedDictionary <int, JiraNamedEntity>());
 }
 public SortedDictionary <int, RapidBoard> getGhBoards(JiraServer server)
 {
     lock (ghBoardsCache) {
         if (ghBoardsCache.ContainsKey(server.GUID))
         {
             return(ghBoardsCache[server.GUID]);
         }
     }
     return(new SortedDictionary <int, RapidBoard>());
 }
 public void addProject(JiraServer server, JiraProject project)
 {
     lock (projectCache) {
         if (!projectCache.ContainsKey(server.GUID))
         {
             projectCache[server.GUID] = new SortedDictionary <string, JiraProject>();
         }
         projectCache[server.GUID][project.Key] = project;
     }
 }
 public SortedDictionary <string, JiraProject> getProjects(JiraServer server)
 {
     lock (projectCache) {
         if (projectCache.ContainsKey(server.GUID))
         {
             return(projectCache[server.GUID]);
         }
     }
     return(new SortedDictionary <string, JiraProject>());
 }
 public void addRapidBoard(JiraServer server, RapidBoard rapidBoard)
 {
     lock (ghBoardsCache) {
         if (!ghBoardsCache.ContainsKey(server.GUID))
         {
             ghBoardsCache[server.GUID] = new SortedDictionary <int, RapidBoard>();
         }
         ghBoardsCache[server.GUID][rapidBoard.Id] = rapidBoard;
     }
 }
 public void addStatus(JiraServer server, JiraNamedEntity status)
 {
     lock (statusCache) {
         if (!statusCache.ContainsKey(server.GUID))
         {
             statusCache[server.GUID] = new SortedDictionary <int, JiraNamedEntity>();
         }
         statusCache[server.GUID][status.Id] = status;
     }
 }
 public JiraUserCache getUsers(JiraServer server)
 {
     lock (userCaches) {
         if (!userCaches.ContainsKey(server.GUID))
         {
             userCaches[server.GUID] = new JiraUserCache();
         }
         return(userCaches[server.GUID]);
     }
 }
 public SortedDictionary <int, JiraNamedEntity> getResolutions(JiraServer server)
 {
     lock (resolutionCache) {
         if (resolutionCache.ContainsKey(server.GUID))
         {
             return(resolutionCache[server.GUID]);
         }
     }
     return(new SortedDictionary <int, JiraNamedEntity>());
 }
 public void addPriority(JiraServer server, JiraNamedEntity priority)
 {
     lock (priorityCache) {
         if (!priorityCache.ContainsKey(server.GUID))
         {
             priorityCache[server.GUID] = new List <JiraNamedEntity>();
         }
         priorityCache[server.GUID].Add(priority);
     }
 }
Beispiel #10
0
 public SortedDictionary <int, JiraNamedEntity> getStatues(JiraServer server)
 {
     lock (statusCache) {
         if (statusCache.ContainsKey(server.GUID))
         {
             return(statusCache[server.GUID]);
         }
     }
     return(new SortedDictionary <int, JiraNamedEntity>());
 }
Beispiel #11
0
 public List <JiraNamedEntity> getPriorities(JiraServer server)
 {
     lock (priorityCache) {
         if (priorityCache.ContainsKey(server.GUID))
         {
             return(priorityCache[server.GUID]);
         }
     }
     return(new List <JiraNamedEntity>());
 }
Beispiel #12
0
 public void addIssueType(JiraServer server, JiraNamedEntity issueType)
 {
     lock (issueTypeCache) {
         if (!issueTypeCache.ContainsKey(server.GUID))
         {
             issueTypeCache[server.GUID] = new SortedDictionary <int, JiraNamedEntity>();
         }
         issueTypeCache[server.GUID][issueType.Id] = issueType;
     }
 }
Beispiel #13
0
 public void addResolution(JiraServer server, JiraNamedEntity resolution)
 {
     lock (resolutionCache) {
         if (!resolutionCache.ContainsKey(server.GUID))
         {
             resolutionCache[server.GUID] = new SortedDictionary <int, JiraNamedEntity>();
         }
         resolutionCache[server.GUID][resolution.Id] = resolution;
     }
 }
Beispiel #14
0
 public RestClient(JiraServer server)
     : base(server.Url, server.UserName, server.Password, server.NoProxy)
 {
     this.server = server;
 }
Beispiel #15
0
 public FiveOhThreeJiraException(JiraServer server)
 {
     Server = server;
 }
        public JiraIssue(JiraServer server, string serverLanguage, XPathNavigator nav)
        {
            Server         = server;
            ServerLanguage = serverLanguage;

            nav.MoveToFirstChild();
            do
            {
                switch (nav.Name)
                {
                case "key":
                    Key        = nav.Value;
                    Id         = XPathUtils.getAttributeSafely(nav, "id", UNKNOWN);
                    ProjectKey = Key.Substring(0, Key.LastIndexOf('-'));
                    break;

                case "parent":
                    ParentKey = nav.Value;
                    break;

                case "subtasks":
                    getSubtasks(nav);
                    break;

                case "summary":
                    Summary = nav.Value;
                    break;

                case "attachments":
                    getAttachments(nav);
                    break;

                case "status":
                    Status        = nav.Value;
                    StatusIconUrl = XPathUtils.getAttributeSafely(nav, "iconUrl", null);
                    StatusId      = XPathUtils.getAttributeSafely(nav, "id", UNKNOWN);
                    break;

                case "priority":
                    Priority        = nav.Value;
                    PriorityIconUrl = XPathUtils.getAttributeSafely(nav, "iconUrl", null);
                    PriorityId      = XPathUtils.getAttributeSafely(nav, "id", UNKNOWN);
                    break;

                case "description":
                    Description = nav.Value;
                    break;

                case "type":
                    IssueType        = nav.Value;
                    IssueTypeIconUrl = XPathUtils.getAttributeSafely(nav, "iconUrl", null);
                    IssueTypeId      = XPathUtils.getAttributeSafely(nav, "id", UNKNOWN);
                    break;

                case "assignee":
                    Assignee = XPathUtils.getAttributeSafely(nav, "username", "Unknown");
                    string assigneName = nav.Value;
                    JiraServerCache.Instance.getUsers(server).putUser(new JiraUser(Assignee, assigneName));
                    break;

                case "reporter":
                    Reporter = XPathUtils.getAttributeSafely(nav, "username", "Unknown");
                    string reporterName = nav.Value;
                    JiraServerCache.Instance.getUsers(server).putUser(new JiraUser(Reporter, reporterName));
                    break;

                case "created":
                    CreationDate = JiraIssueUtils.getDateTimeFromJiraTimeString(serverLanguage, nav.Value);
                    break;

                case "updated":
                    UpdateDate = JiraIssueUtils.getDateTimeFromJiraTimeString(serverLanguage, nav.Value);
                    break;

                case "resolution":
                    Resolution   = nav.Value;
                    ResolutionId = XPathUtils.getAttributeSafely(nav, "id", UNKNOWN);
                    break;

                case "timeestimate":
                    RemainingEstimate          = nav.Value;
                    RemainingEstimateInSeconds = XPathUtils.getAttributeSafely(nav, "seconds", UNKNOWN);
                    break;

                case "timeoriginalestimate":
                    OriginalEstimate          = nav.Value;
                    OriginalEstimateInSeconds = XPathUtils.getAttributeSafely(nav, "seconds", UNKNOWN);
                    break;

                case "timespent":
                    TimeSpent          = nav.Value;
                    TimeSpentInSeconds = XPathUtils.getAttributeSafely(nav, "seconds", UNKNOWN);
                    break;

                case "version":
                    versions.Add(nav.Value);
                    break;

                case "fixVersion":
                    fixVersions.Add(nav.Value);
                    break;

                case "component":
                    components.Add(nav.Value);
                    break;

                case "comments":
                    getComments(nav);
                    break;

                case "environment":
                    Environment = nav.Value;
                    break;

                case "issuelinks":
                    getIssueLinks(nav);
                    break;

                default:
                    break;
                }
            } while (nav.MoveToNext());
            if (Key == null || Summary == null)
            {
                throw new InvalidDataException();
            }
        }
        public JiraIssue(JiraServer server, JToken issue)
        {
            try {
                Server = server;

                Key        = issue["key"].Value <string>();
                Id         = issue["id"].Value <int>();
                ProjectKey = Key.Substring(0, Key.LastIndexOf('-'));

                var fields = issue["fields"];

                ParentKey = fields["parent"] != null && fields["parent"].HasValues ? fields["parent"]["key"].Value <string>() : null;
                getSubtasks(fields["subtasks"]);
                Summary = fields["summary"].Value <string>();
                getAttachments(fields["attachment"]);
                Status        = fields["status"]["name"].Value <string>();
                StatusIconUrl = fields["status"]["iconUrl"].Value <string>();
                StatusId      = fields["status"]["id"].Value <int>();
                var prio = fields["priority"];
                if (prio != null && prio.HasValues)
                {
                    Priority        = prio["name"].Value <string>();
                    PriorityIconUrl = fields["priority"]["iconUrl"].Value <string>();
                    PriorityId      = fields["priority"]["id"].Value <int>();
                }

                var renderedDescription = issue["renderedFields"]["description"];
                Description = renderedDescription != null?renderedDescription.Value <string>() : fields["description"].Value <string>();

                IssueType        = fields["issuetype"]["name"].Value <string>();
                IssueTypeIconUrl = fields["issuetype"]["iconUrl"].Value <string>();
                IssueTypeId      = fields["issuetype"]["id"].Value <int>();
                if (fields["assignee"] != null && fields["assignee"].HasValues)
                {
                    Assignee = fields["assignee"]["name"].Value <string>();
                    JiraServerCache.Instance.getUsers(server).putUser(new JiraUser(Assignee, fields["assignee"]["displayName"].Value <string>()));
                }
                else
                {
                    Assignee = "Unknown";
                }
                if (fields["reporter"] != null && fields["reporter"].HasValues)
                {
                    Reporter = fields["reporter"]["name"].Value <string>();
                    JiraServerCache.Instance.getUsers(server).putUser(new JiraUser(Reporter, fields["reporter"]["displayName"].Value <string>()));
                }
                else
                {
                    Reporter = "Unknown";
                }
                CreationDate = DateTime.Parse(fields["created"].Value <string>(), CultureInfo.InvariantCulture);
                UpdateDate   = DateTime.Parse(fields["updated"].Value <string>(), CultureInfo.InvariantCulture);
                Resolution   = fields["resolution"] != null && fields["resolution"].HasValues ? fields["resolution"]["name"].Value <string>() : null;
                ResolutionId = Resolution != null ? fields["resolution"]["id"].Value <int>() : UNKNOWN;

                getTimeFieldsFromJson(issue);

                if (fields["versions"] != null)
                {
                    foreach (var v in fields["versions"])
                    {
                        Versions.Add(v["name"].Value <string>());
                    }
                }
                if (fields["fixVersions"] != null)
                {
                    foreach (var v in fields["fixVersions"])
                    {
                        FixVersions.Add(v["name"].Value <string>());
                    }
                }
                if (fields["components"] != null)
                {
                    foreach (var v in fields["components"])
                    {
                        Components.Add(v["name"].Value <string>());
                    }
                }
                var env = fields["environment"];
                Environment = env != null?env.Value <string>() : null;

                getComments(fields["comment"], issue["renderedFields"]["comment"]);
                getIssueLinks(fields["issuelinks"]);

//                RestIssue = issue;
            } catch (Exception e) {
                throw new InvalidOperationException("Unable to parse issue JSON object: " + issue, e);
            }
        }
Beispiel #18
0
 public JiraServer(JiraServer other) : base(other)
 {
     OldSkoolAuth = other != null && other.OldSkoolAuth;
 }