public static void CreateIssueFromCsv(JiraIssue jiraIssue, string token, RemoteUser user, RemoteProject project, JiraSoapServiceService jiraSoapService) { if (AreDuplicateIssues(jiraSoapService, token, project, jiraIssue) != null) { Console.WriteLine("Duplicate issue detected."); UpdateIssue(jiraSoapService, token, project, jiraIssue); } else { RemoteIssue issue = CreateIssue(project, jiraSoapService, token); //CreateComponents(project, jiraSoapService, token, issue); RemoteCustomFieldValue[] listOfCustomFields = InitCustomFields(issue, jiraIssue); InitIssue(issue, jiraIssue, listOfCustomFields, user); RemoteComment comment = CreateCommentLog(jiraIssue); PushToJira(jiraSoapService, token, issue, comment); } //DeleteAllIssues(jiraSoapService, token); }
private static void CreateComponents(RemoteProject project, JiraSoapServiceService jiraSoapService, string token, RemoteIssue issue) { List<RemoteComponent> components = new List<RemoteComponent>(jiraSoapService.getComponents(token, project.key)); foreach (RemoteComponent component in components) { if (component.name.Equals("MM - Strategies")) { issue.components = new RemoteComponent[] {component}; } } }
static string AreDuplicateIssues(JiraSoapServiceService jiraSoapService, string token, RemoteProject project, JiraIssue uninitializedIssue) { List<string> listOfSprintIDs = GetListOfSprintIDs(project, jiraSoapService, token, "submitted"); foreach (var SprintID in listOfSprintIDs) { if (uninitializedIssue.SprintIssueId == SprintID) { return SprintID; } } return null; }
/// <remarks/> public System.IAsyncResult BeginremoveActorsFromProjectRole(string in0, string[] in1, RemoteProjectRole in2, RemoteProject in3, string in4, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("removeActorsFromProjectRole", new object[] { in0, in1, in2, in3, in4}, callback, asyncState); }
public void removeActorsFromProjectRole(string in0, string[] in1, RemoteProjectRole in2, RemoteProject in3, string in4) { this.Invoke("removeActorsFromProjectRole", new object[] { in0, in1, in2, in3, in4}); }
public void addActorsToProjectRole(string in0, string[] in1, RemoteProjectRole in2, RemoteProject in3, string in4) { this.Invoke("addActorsToProjectRole", new object[] { in0, in1, in2, in3, in4}); }
/// <remarks/> public System.IAsyncResult BegingetProjectRoleActors(string in0, RemoteProjectRole in1, RemoteProject in2, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("getProjectRoleActors", new object[] { in0, in1, in2}, callback, asyncState); }
public RemoteProjectRoleActors getProjectRoleActors(string in0, RemoteProjectRole in1, RemoteProject in2) { object[] results = this.Invoke("getProjectRoleActors", new object[] { in0, in1, in2}); return ((RemoteProjectRoleActors)(results[0])); }
/// <remarks/> public System.IAsyncResult BeginremoveAllRoleActorsByProject(string in0, RemoteProject in1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("removeAllRoleActorsByProject", new object[] { in0, in1}, callback, asyncState); }
public void removeAllRoleActorsByProject(string in0, RemoteProject in1) { this.Invoke("removeAllRoleActorsByProject", new object[] { in0, in1}); }
public RemoteProject updateProject(string in0, RemoteProject in1) { object[] results = this.Invoke("updateProject", new object[] { in0, in1}); return ((RemoteProject)(results[0])); }
/// <remarks/> public System.IAsyncResult BegincreateProjectFromObject(string in0, RemoteProject in1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("createProjectFromObject", new object[] { in0, in1}, callback, asyncState); }
private static RemoteIssue CreateIssue(RemoteProject project, JiraSoapServiceService jiraSoapService, string token) { System.Diagnostics.Debug.WriteLine("Creating a new issue on http://jira/jira ..."); Console.WriteLine("Creating a new issue on http://jira/jira ..."); RemoteIssue issue = new RemoteIssue(); issue.project = project.key; RemoteVersion Iteration = new RemoteVersion(); Iteration.id = ConfigurationManager.AppSettings["JiraIteration"]; RemoteVersion[] arrayOfVersions = {Iteration}; issue.affectsVersions = arrayOfVersions; List<RemoteIssueType> issueTypes = new List<RemoteIssueType>(jiraSoapService.getIssueTypesForProject(token, project.id)); foreach (RemoteIssueType issueType in issueTypes) { if (issueType.name.Equals("Bug")) { issue.type = issueType.id; } } return issue; }
private static void UpdateIssue(JiraSoapServiceService jiraSoapService, string token, RemoteProject project, JiraIssue jiraIssue) { string updateMessage = "--- This is an automated message --- " + Environment.NewLine + "This issue and the following fields have been updated: " + Environment.NewLine; string searchTerms = AreDuplicateIssues(jiraSoapService, token, project, jiraIssue); string[] keys = {project.key}; RemoteComment updateComment = new RemoteComment(); var existingDuplicateIssue = jiraSoapService.getIssuesFromTextSearchWithProject(token, keys, searchTerms, 1); if (jiraIssue.Summary.Replace("\r", string.Empty) != existingDuplicateIssue[0].summary) { updateMessage += ("-----------------------------------" + Environment.NewLine +"Summary: " + Environment.NewLine + jiraIssue.Summary + Environment.NewLine); } if (jiraIssue.Description.Replace("\r", string.Empty) != existingDuplicateIssue[0].description.Trim()) { int length = jiraIssue.Description.Length; for (int i = 0; i < length; i++) { if (jiraIssue.Description[i] != existingDuplicateIssue[0].description[i]) break; } int len = existingDuplicateIssue[0].description.Length; updateMessage += ("-----------------------------------" + Environment.NewLine +"Description: " + Environment.NewLine + jiraIssue.Description + Environment.NewLine); } else { updateMessage = "--- This is an automated message --- " + Environment.NewLine + "Identical issue with no updated fields was attempted to be imported"; } updateComment.body = updateMessage; jiraSoapService.addComment(token, existingDuplicateIssue[0].key, updateComment); System.Diagnostics.Debug.WriteLine("Successfully updated issue http://pm.iqmetrix.com/browse/" + existingDuplicateIssue[0].key); Console.WriteLine("Successfully updated issue http://pm.iqmetrix.com/browse/" + existingDuplicateIssue[0].key + Environment.NewLine); }
private static List<string> GetListOfSprintIDs(RemoteProject project, JiraSoapServiceService jiraSoapService, string token, string searchTerms) { string[] keys = {project.key}; string[] s = keys; var listOfIssues = jiraSoapService.getIssuesFromTextSearchWithProject(token, keys, searchTerms, 500); var n = listOfIssues.Length; var listOfSprintIDs = new List<string>(); foreach (var oneissue in listOfIssues) { RemoteCustomFieldValue[] customfields = oneissue.customFieldValues; for (int i = customfields.Length - 1; i >= 0; i--) { var temp = 0; string[] fieldvalues = customfields[i].values; for (int j = 0; j < fieldvalues.Length; j++) { if (int.TryParse(fieldvalues[j], out temp) && fieldvalues[j].ToString().Length == 6) { listOfSprintIDs.Add(fieldvalues[j]); } } } } return listOfSprintIDs; }