public override Dictionary <string, string> GetStatesForDefects(List <string> defectIds) { Dictionary <string, string> result = new Dictionary <string, string>(); List <string> failedIds = new List <string>(); Connect(); RemoteStatus[] remoteStatuses = jira.getStatuses(jiraToken); Dictionary <string, string> statusNames = remoteStatuses.ToDictionary(remoteStatus => remoteStatus.id, remoteStatus => remoteStatus.name); foreach (string defectId in defectIds) { try { RemoteIssue issue = jira.getIssue(jiraToken, defectId); if (statusNames.ContainsKey(issue.status)) { result.Add(defectId, statusNames[issue.status]); } } catch { failedIds.Add(defectId); } } Disconnect(); if (failedIds.Count > 0) { MessageBox.Show( "The status of the following Defects could not be retrieved:" + Environment.NewLine + string.Join(",", failedIds.ToArray()), "Synchronize Defect States"); } return(result); }
public XDoc Link( [DekiExtParam("bug id")] string id ) { InitializeService(); InitializeStatuses(); RemoteIssue issue = _jira.getIssue(_jiraToken, id); XDoc result = new XDoc("html"); result.Start("body"); BuildBugLink(issue, result); result.End(); return(result); }
private RemoteIssue GetIssue(JiraSoapServiceService jss, string token, string jiraId) { if (loadedJiraItems.ContainsKey(jiraId)) { return((RemoteIssue)(loadedJiraItems[jiraId])); } else { try { RemoteIssue issue = jss.getIssue(token, jiraId); loadedJiraItems[jiraId] = issue; return(issue); } catch (Exception exp) { rp("Loading Jira issue failed..." + exp.Message); return(null); } } }
public JiraIssue getIssue(string key) { JiraIssue jiraIssue = null; if (jiraCache.Contains(key)) { jiraIssue = jiraCache[key]; } if (jiraIssue == null) { checkCredentials(); try { RemoteIssue issue = jira.getIssue(credentials, key); jiraIssue = new JiraIssue(issue.key, issue.created, getUserFullName(issue.reporter), getUserFullName(issue.assignee), issue.project, issue.summary, issue.description, issue.environment, issue.attachmentNames); jiraCache.Add(key, jiraIssue); } catch (Exception e) { LOG.Error("Problem retrieving Jira: " + key, e); } } return(jiraIssue); }
public object getIssueSoapObject(string key) { return(service.getIssue(Token, key)); }
private void jiraUploadByPost() { try { JiraSoapServiceService service = new JiraSoapServiceService { Url = serverUrl + "/rpc/soap/jirasoapservice-v2" }; string tok = null; if (issueId == null) { tok = service.login(userLogin, userPassword); RemoteIssue issue = service.getIssue(tok, issueKey); issueId = issue.id; } FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); Dictionary <string, object> postParameters = new Dictionary <string, object> { { "filename.1", new FormUpload.FileParameter(data, name, getMimeType(name)) }, }; const string userAgent = "Mazio"; string postUrl = serverUrl + "/secure/AttachFile.jspa?id=" + issueId + (jSessionId == null ? ("&os_username="******"&os_password="******""); HttpWebResponse webResponse; if (jSessionId != null) { Cookie cookie = new Cookie("JSESSIONID", jSessionId, "/jira", serverUrl.Substring(0, serverUrl.LastIndexOf("/"))); webResponse = FormUpload.MultipartFormDataPost(postUrl, userAgent, postParameters, cookie); } else { webResponse = FormUpload.MultipartFormDataPost(postUrl, userAgent, postParameters); } StreamReader responseReader = new StreamReader(webResponse.GetResponseStream()); #pragma warning disable 168 string result = responseReader.ReadToEnd(); #pragma warning restore 168 webResponse.Close(); if (token != null && !string.IsNullOrEmpty(comment)) { service.addComment(tok, issueKey, new RemoteComment { body = comment }); } Invoke(new MethodInvoker(delegate { uploadLog.Text += "Done. See " + serverUrl + "/browse/" + issueKey + "\r\n"; })); } catch (Exception e) { Debug.Write(e.StackTrace); Invoke(new MethodInvoker(delegate { uploadLog.Text += "Failed: " + e.Message + "\r\n"; })); } done = true; Invoke(new MethodInvoker(delegate { saveLastUsed(); buttonCancel.Enabled = true; buttonCancel.Text = "Close"; })); }