コード例 #1
0
        public JiraIssue[] getIssuesForFilter(string filterId)
        {
            List <JiraIssue> issuesToReturn = new List <JiraIssue>();

            checkCredentials();
            try {
                RemoteIssue[] issues = jira.getIssuesFromFilter(credentials, filterId);
                foreach (RemoteIssue issue in issues)
                {
                    try {
                        JiraIssue jiraIssue = new JiraIssue(issue.key, issue.created, getUserFullName(issue.reporter), getUserFullName(issue.assignee), issue.project, issue.summary, issue.description, "", issue.attachmentNames);
                        issuesToReturn.Add(jiraIssue);
                    } catch (Exception e) {
                        LOG.Error("Problem retrieving Jira: " + issue.key, e);
                        JiraIssue jiraIssue = createDummyErrorIssue(e);
                        jiraIssue.Key = issue.key;
                        issuesToReturn.Add(jiraIssue);
                    }
                }
            } catch (Exception e) {
                LOG.Error("Problem retrieving Jiras for Filter: " + filterId, e);
                issuesToReturn.Add(createDummyErrorIssue(e));
            }
            return(issuesToReturn.ToArray());;
        }
コード例 #2
0
ファイル: JiraAdapter.cs プロジェクト: n00shie/Jira-Adapter
        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);
        }
コード例 #3
0
        public JiraIssue[] getIssuesForFilter(string filterId)
        {
            List <JiraIssue> issuesToReturn = new List <JiraIssue>();

            checkCredentials();
            try {
                RemoteIssue[] issues = jira.getIssuesFromFilter(credentials, filterId);

                #region Username cache update
                List <string> users = new List <string>();
                foreach (RemoteIssue issue in issues)
                {
                    if (issue.reporter != null && !hasUser(issue.reporter) && !users.Contains(issue.reporter))
                    {
                        users.Add(issue.reporter);
                    }
                    if (issue.assignee != null && !hasUser(issue.assignee) && !users.Contains(issue.assignee))
                    {
                        users.Add(issue.assignee);
                    }
                }
                int taskCount = users.Count;
                if (taskCount > 0)
                {
                    ManualResetEvent doneEvent = new ManualResetEvent(false);
                    for (int i = 0; i < users.Count; i++)
                    {
                        ThreadPool.QueueUserWorkItem(delegate(object name) {
                            LOG.InfoFormat("Retrieving {0}", name);
                            getUserFullName((string)name);
                            if (Interlocked.Decrement(ref taskCount) == 0)
                            {
                                doneEvent.Set();
                            }
                        }, users[i]);
                    }
                    doneEvent.WaitOne();
                }
                #endregion

                foreach (RemoteIssue issue in issues)
                {
                    try {
                        JiraIssue jiraIssue = new JiraIssue(issue.key, issue.created, getUserFullName(issue.reporter), getUserFullName(issue.assignee), issue.project, issue.summary, issue.description, "", issue.attachmentNames);
                        issuesToReturn.Add(jiraIssue);
                    } catch (Exception e) {
                        LOG.Error("Problem retrieving Jira: " + issue.key, e);
                        JiraIssue jiraIssue = createDummyErrorIssue(e);
                        jiraIssue.Key = issue.key;
                        issuesToReturn.Add(jiraIssue);
                    }
                }
            } catch (Exception e) {
                LOG.Error("Problem retrieving Jiras for Filter: " + filterId, e);
                issuesToReturn.Add(createDummyErrorIssue(e));
            }
            return(issuesToReturn.ToArray());;
        }
コード例 #4
0
ファイル: JiraAdapter.cs プロジェクト: n00shie/Jira-Adapter
        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;
        }
コード例 #5
0
ファイル: JiraForm.cs プロジェクト: logtcn/greenshot
		private void updateForm() {
			if (jiraConnector.isLoggedIn) {
				JiraFilter[] filters = jiraConnector.getFilters();
				if (filters.Length > 0) {
					foreach (JiraFilter filter in filters) {
						jiraFilterBox.Items.Add(filter);
					}
					jiraFilterBox.SelectedIndex = 0;
				}
				changeModus(true);
				if (config.LastUsedJira != null) {
					selectedIssue = jiraConnector.getIssue(config.LastUsedJira);
					if (selectedIssue != null) {
						jiraKey.Text = config.LastUsedJira;
						uploadButton.Enabled = true;
					}
				}
			}
		}
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: Jira.cs プロジェクト: logtcn/greenshot
		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;
		}
コード例 #8
0
ファイル: JiraForm.cs プロジェクト: logtcn/greenshot
		private void jiraListView_SelectedIndexChanged(object sender, EventArgs e) {
			if (jiraListView.SelectedItems != null && jiraListView.SelectedItems.Count > 0) {
				selectedIssue = (JiraIssue)jiraListView.SelectedItems[0].Tag;
				jiraKey.Text = selectedIssue.Key;
				uploadButton.Enabled = true;
			} else {
				uploadButton.Enabled = false;
			}
		}
コード例 #9
0
ファイル: JiraForm.cs プロジェクト: logtcn/greenshot
		void JiraKeyTextChanged(object sender, EventArgs e) {
			string jiranumber = jiraKey.Text;
			uploadButton.Enabled = false;
			int dashIndex = jiranumber.IndexOf('-');
			if (dashIndex > 0 && jiranumber.Length > dashIndex+1) {
				selectedIssue = jiraConnector.getIssue(jiraKey.Text);
				if (selectedIssue != null) {
					uploadButton.Enabled = true;
				}
			}
		}
コード例 #10
0
ファイル: JiraDestination.cs プロジェクト: logtcn/greenshot
		private string FormatUpload(JiraIssue jira) {
			return Designation + " - " + jira.Key + ": " + jira.Summary.Substring(0, Math.Min(20, jira.Summary.Length));
		}
コード例 #11
0
ファイル: JiraForm.cs プロジェクト: logtcn/greenshot
		private void selectJiraToolStripMenuItem_Click(object sender, EventArgs e) {
			ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
			selectedIssue = (JiraIssue)clickedItem.Tag;
			jiraKey.Text = selectedIssue.Key;
		}
コード例 #12
0
 private static JiraIssue InitializeIssue(List<string> issue)
 {
     JiraIssue newIssue = new JiraIssue(issue[0], issue[1], issue[2], issue[3], issue[4], issue[5], issue[6], issue[7], issue[8]);
     return newIssue;
 }
コード例 #13
0
ファイル: JiraDestination.cs プロジェクト: logtcn/greenshot
		public JiraDestination(JiraPlugin jiraPlugin, JiraIssue jira) {
			this.jiraPlugin = jiraPlugin;
			this.jira = jira;
		}
コード例 #14
0
ファイル: JiraAdapter.cs プロジェクト: n00shie/Jira-Adapter
        private static RemoteCustomFieldValue[] InitCustomFields(RemoteIssue issue, JiraIssue jiraIssue)
        {
            string SprintIdFieldId = "customfield_10160";
            string SprintDateFieldId = "customfield_10563";
            string EnvironmentFieldId = "customfield_10062";
            string LabelId = "labels";

            string[] sprintIdNumber = { jiraIssue.SprintIssueId };
            string[] sprintDate = { jiraIssue.DateCreated };
            string[] environment = {jiraIssue.EnvironmentFoundIn};
            string[] labels = {ConfigurationManager.AppSettings["JiraIteration"]};

            RemoteCustomFieldValue sprintId = new RemoteCustomFieldValue();
            RemoteCustomFieldValue sprintIssueDate = new RemoteCustomFieldValue();
            RemoteCustomFieldValue environmentFoundIn = new RemoteCustomFieldValue();
            RemoteCustomFieldValue label = new RemoteCustomFieldValue();

            sprintId.customfieldId = SprintIdFieldId;
            sprintId.values = sprintIdNumber;

            sprintIssueDate.customfieldId = SprintDateFieldId;
            sprintIssueDate.values = sprintDate;

            environmentFoundIn.customfieldId = EnvironmentFieldId;
            environmentFoundIn.values = environment;

            label.customfieldId = LabelId;
            label.values = labels;

            RemoteCustomFieldValue[] listOfCustomFields = {sprintId, sprintIssueDate, environmentFoundIn};

            issue.customFieldValues = listOfCustomFields;
            return listOfCustomFields;
        }
コード例 #15
0
ファイル: Jira.cs プロジェクト: logtcn/greenshot
		public JiraIssue[] getIssuesForFilter(string filterId) {
			List<JiraIssue> issuesToReturn = new List<JiraIssue>();
			checkCredentials();
			try {
				RemoteIssue[] issues = jira.getIssuesFromFilter(credentials, filterId);

				#region Username cache update
				List<string> users = new List<string>();
				foreach (RemoteIssue issue in issues) {
					if (issue.reporter != null && !hasUser(issue.reporter) && !users.Contains(issue.reporter)) {
						users.Add(issue.reporter);
					}
					if (issue.assignee != null && !hasUser(issue.assignee) && !users.Contains(issue.assignee)) {
						users.Add(issue.assignee);
					}
				}
				int taskCount = users.Count;
				if (taskCount > 0) {
					ManualResetEvent doneEvent = new ManualResetEvent(false);
					for (int i = 0; i < users.Count; i++) {
						ThreadPool.QueueUserWorkItem(delegate(object name) {
							LOG.InfoFormat("Retrieving {0}", name);
							getUserFullName((string)name);
							if (Interlocked.Decrement(ref taskCount) == 0) {
								doneEvent.Set();
							}
						}, users[i]);
					}
					doneEvent.WaitOne();
				}
				#endregion

				foreach (RemoteIssue issue in issues) {
					try {
						JiraIssue jiraIssue = new JiraIssue(issue.key, issue.created, getUserFullName(issue.reporter), getUserFullName(issue.assignee), issue.project, issue.summary, issue.description, "", issue.attachmentNames);
						issuesToReturn.Add(jiraIssue);
					} catch (Exception e) {
						LOG.Error("Problem retrieving Jira: " + issue.key, e);
						JiraIssue jiraIssue = createDummyErrorIssue(e);
						jiraIssue.Key = issue.key;
						issuesToReturn.Add(jiraIssue);
					}
				}
			} catch (Exception e) {
				LOG.Error("Problem retrieving Jiras for Filter: " + filterId, e);
				issuesToReturn.Add(createDummyErrorIssue(e));
			}
			return issuesToReturn.ToArray(); ;
		}
コード例 #16
0
ファイル: JiraAdapter.cs プロジェクト: n00shie/Jira-Adapter
 private static void InitIssue(RemoteIssue issue, JiraIssue jiraIssue, RemoteCustomFieldValue[] listOfCustomFields, RemoteUser user)
 {
     issue.reporter = user.name;
     issue.summary = jiraIssue.Summary;
     issue.description = jiraIssue.Description;
     issue.environment = jiraIssue.EnvironmentFoundIn;
     issue.customFieldValues = listOfCustomFields;
 }
コード例 #17
0
ファイル: JiraAdapter.cs プロジェクト: n00shie/Jira-Adapter
 private static RemoteComment CreateCommentLog(JiraIssue jiraIssue)
 {
     RemoteComment comment = new RemoteComment();
     comment.body = jiraIssue.Log;
     return comment;
 }
コード例 #18
0
ファイル: JiraAdapter.cs プロジェクト: n00shie/Jira-Adapter
        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);
        }