Пример #1
0
        private Issue Convert(Atlassian.Jira.Issue issue)
        {
            Issue obj = new Issue();

            obj.Key                = issue.Key.Value;
            obj.Summary            = issue.Summary;
            obj.Description        = issue.Description;
            obj.ResolutionDateTime = issue.ResolutionDate;

            return(obj);
        }
Пример #2
0
        async void GetWorklogs(Atlassian.Jira.Issue issue)
        {
            //var issue = await myJira.Issues.GetIssueAsync("VC50-316");
            //// add a worklog
            //await issue.AddWorklogAsync("1h");

            //// add worklog with new remaining estimate
            //await issue.AddWorklogAsync("1m", WorklogStrategy.NewRemainingEstimate, "4h");

            // retrieve worklogs
            var worklogs = await issue.GetWorklogsAsync();

            WorkLogListView.ItemsSource = worklogs;
        }
Пример #3
0
        /// <summary>
        ///     Converts a Jira Issue into a JTR JiraIssue
        /// </summary>
        /// <param name="issue">An <see cref="Atlassian.Jira.Issue"/> to convert into <see cref="JiraIssue"/></param>
        /// <returns>A converted <see cref="JiraIssue"/></returns>
        public static JiraIssue Convert(this Atlassian.Jira.Issue issue)
        {
            {
                var jtrJiraIssue = new JiraIssue
                {
                    IssueId        = System.Convert.ToInt32(issue.JiraIdentifier),
                    Description    = issue.Description,
                    Summary        = issue.Summary,
                    ParentIssueKey = issue.ParentIssueKey,
                    SecurityLevel  = issue.SecurityLevel?.Name,
                    Environment    = issue.Environment,
                    Assignee       = issue.Assignee,
                    Key            = issue.Key?.Value,
                    Priority       = issue.Priority?.Name,
                    ProjectName    = issue.Project,
                    Reporter       = issue.Reporter,
                    Resolution     = issue.Resolution?.Name,

                    Labels          = string.Join(CoreConstants.CommaSeparator, issue.Labels),
                    FixVersion      = string.Join(CoreConstants.CommaSeparator, issue.FixVersions),
                    AffectedVersion = string.Join(CoreConstants.CommaSeparator, issue.AffectsVersions),
                    Components      = string.Join(CoreConstants.CommaSeparator, issue.Components),

                    Status         = issue.Status?.Name,
                    Type           = issue.Type?.Name,
                    Created        = issue.Created,
                    DueDate        = issue.DueDate,
                    Updated        = issue.Updated,
                    ResolutionDate = issue.ResolutionDate,
                };

                jtrJiraIssue.EpicLink = issue[CoreConstants.JiraEpicLink]?.Value;
                jtrJiraIssue.EpicName = issue[CoreConstants.JiraEpicName]?.Value;

                jtrJiraIssue.HKIBU = issue.CustomFields.Get(CoreConstants.JiraHkiBusinessUnit);
                jtrJiraIssue.SCBU  = issue.CustomFields.Get(CoreConstants.JiraScBusinessUnit);
                jtrJiraIssue.SNBU  = issue.CustomFields.Get(CoreConstants.JiraSnBusinessUnit);
                jtrJiraIssue.CFBU  = issue.CustomFields.Get(CoreConstants.JiraCfBusinessUnit);

                jtrJiraIssue.Sprint        = issue[CoreConstants.JiraSprint]?.Value;
                jtrJiraIssue.TargetVersion = issue[CoreConstants.JiraTargetVersion]?.Value;

                // Extract business unit
                ProcessBusinessUnitCustomField(jtrJiraIssue);

                return(jtrJiraIssue);
            }
        }
Пример #4
0
 public JiraIssue(Atlassian.Jira.Issue issue)
 {
     this.Assignee         = issue.Assignee;
     this.Created          = issue.Created;
     this.CustomFields     = issue.CustomFields;
     this.DueDate          = issue.DueDate;
     this.Labels           = issue.Labels;
     this.Priority         = issue.Priority;
     this.Project          = issue.Project;
     this.Reporter         = issue.Reporter;
     this.Resolution       = issue.Resolution;
     this.ResolutionDate   = issue.ResolutionDate;
     this.SecurityLevel    = issue.SecurityLevel;
     this.Status           = issue.Status;
     this.Summary          = issue.Summary;
     this.TimeTrackingData = issue.TimeTrackingData;
     this.Type             = issue.Type;
     this.Updated          = issue.Updated;
     this.Votes            = issue.Votes;
     this.Components       = issue.Components;
 }
Пример #5
0
        private static void EnsureIssueAssociation(Atlassian.Jira.Issue issue, PullRequest pr)
        {
            var link = $"github.com/{repoOwner}/{repo}/pull/{pr.Number}";

            if (!SearchDescription || false == issue.Description?.Contains(link, StringComparison.OrdinalIgnoreCase))
            {
                var comments = issue.GetCommentsAsync().Result;
                if (!SearchComments || !comments.Any(c => c.Body.Contains(link, StringComparison.OrdinalIgnoreCase)))
                {
                    var links = issue.GetRemoteLinksAsync().Result;
                    if (!links.Any(l => l.RemoteUrl.Contains(link)))
                    {
                        log($"Adding links to issue {issue.Key}");
                        if (!additionalLink.IsEmpty())
                        {
                            issue.AddRemoteLinkAsync(additionalLink.Tokenize(pr), additionalLinkText.Tokenize(pr)).Wait();
                        }
                        issue.AddRemoteLinkAsync($"https://{link}", pullRequestText.Tokenize(pr)).Wait();
                    }
                }
            }
        }
Пример #6
0
 internal CustomFieldValue(string id, string name, Issue issue)
     : this(id, issue)
 {
     _name = name;
 }
Пример #7
0
 internal CustomFieldValue(string id, Issue issue)
 {
     _id    = id;
     _issue = issue;
 }
Пример #8
0
 internal CustomFieldValueCollection(Issue issue, IList <CustomFieldValue> list)
     : base(list)
 {
     _issue = issue;
 }
Пример #9
0
 internal CustomFieldValueCollection(Issue issue)
     : this(issue, new List <CustomFieldValue>())
 {
 }
Пример #10
0
        /// <summary>
        /// Метод для подсчёта изменений статуса
        /// </summary>
        static int paramChangeCountWork(Atlassian.Jira.Issue c, Dictionary <string, List <string> > filt)
        {
            var changeLog = jiraLog.Issues.GetChangeLogsAsync(c.Key.ToString()).Result;
            int count     = 0;
            var list      = changeLog.ToList();

            list.Reverse();
            List <string> ListFromValue  = new List <string>(); //лист начальных значений Jira
            List <string> ListToValue    = new List <string>(); //лист конечных значений Jira
            List <string> ListParam      = new List <string>(); //лист со списком параметров из фильтра
            List <string> ListParamBuf   = new List <string>(); //лист со списком значений не разделенных параметров из фильтра
            List <string> ListParamValue = new List <string>(); //лист со списком значений разделенных параметров из фильтра

            if (filt.ContainsKey("paramchangecount") || filt.ContainsKey("paramchangefilter"))
            {
                if (filt.ContainsKey("paramchangecount"))
                {
                    filt["paramchangecount"].ForEach(s =>
                    {
                        ListParam.AddRange(s.Split(';'));//дробим список на значение(четные) и тип(нечетные)
                        for (int i = 0; i < ListParam.Count; i++)
                        {
                            if (i % 2 == 0)
                            {
                                ListParamBuf.Add(ListParam[i]);//Формируем список значений
                            }
                        }
                    });
                }

                if (filt.ContainsKey("paramchangefilter"))
                {
                    filt["paramchangefilter"].ForEach(s =>
                    {
                        ListParam.AddRange(s.Split(';'));//дробим список на значение(четные) и тип(нечетные)
                        for (int i = 0; i < ListParam.Count; i++)
                        {
                            if (i % 2 == 0)
                            {
                                ListParamBuf.Add(ListParam[i]);//Формируем список значений
                            }
                        }
                    });
                }

                ListParam.RemoveAll(c => ListParamBuf.Contains(c)); //удаляем из списка параметров из фильтра все значения данных параметров
                ListParam = ListParam.Distinct().ToList();          //удаляем все повторяющиеся значения, т.е. оставляем только одно значение - тип параметра
                foreach (var e in list)
                {
                    e.Items.ToList().ForEach(s =>
                    {
                        if (s.FieldName.Contains(ListParam[0]))
                        {
                            ListFromValue.Add(s.FromValue.ToLower().Replace(" ", "")); //Заполнение списка изначальными значениями
                            ListToValue.Add(s.ToValue.ToLower().Replace(" ", ""));     //Заполнение списка конечными значениями
                        }
                    });
                }
                ListParamBuf.ForEach(t =>
                {
                    ListParamValue.AddRange(t.Split('-'));//записываем изначальное и конечное значения в список
                    for (int i = 0; i < ListFromValue.Count(); i++)
                    {
                        if (ListFromValue[i].Contains(ListParamValue[0].ToLower().Trim()) && ListToValue[i].Contains(ListParamValue[1].ToLower().Trim()))//проверка на то, что происходил переход статуса из изначального пользовательского значения в конечное
                        {
                            count++;
                        }
                    }
                    ListParamValue.Clear();
                });

                return(count);
            }
            else
            {
                return(0);
            }
        }
Пример #11
0
        /// <summary>
        /// Метод для проверки на Null значений из Jira
        /// </summary>
        static string[] FillingOutputArray(Atlassian.Jira.Issue c, Dictionary <string, List <string> > filt)
        {
            string[] parMas = new string[12];//создание массива, в котором будут храниться значения параметров из Jira
            if (c.Summary != null)
            {
                parMas[0] = c.Summary;
            }
            else
            {
                parMas[0] = "Аннотация не задана";
            }

            if (c.Key != null)
            {
                parMas[1] = c.Key.ToString();
            }
            else
            {
                parMas[1] = "Ключ не задан";
            }

            if (c.Priority != null)
            {
                parMas[2] = c.Priority.ToString();
            }
            else
            {
                parMas[2] = "Приоритет не задан";
            }

            if (c.Status != null)
            {
                parMas[3] = c.Status.ToString();
            }
            else
            {
                parMas[3] = "Статус не задан";
            }

            if (c.Type != null)
            {
                parMas[4] = c.Type.ToString();
            }
            else
            {
                parMas[4] = "Тип не задан";
            }

            if (c.Created != null)
            {
                parMas[5] = c.Created.ToString();
            }
            else
            {
                parMas[5] = "Время создания не задано";
            }

            if (c.Environment != null)
            {
                parMas[6] = c.Environment;
            }
            else
            {
                parMas[6] = "Окружение не задано";
            }

            if (c.Project != null)
            {
                parMas[7] = c.Project;
            }
            else
            {
                parMas[7] = "Принадлежность к проекту не задана";
            }

            if (c.AssigneeUser != null)
            {
                parMas[8] = c.AssigneeUser.DisplayName;
            }
            else
            {
                parMas[8] = "Исполнитель не задан";
            }

            if (c.ReporterUser != null)
            {
                parMas[9] = c.ReporterUser.DisplayName;
            }
            else
            {
                parMas[9] = "Создатель не задан";
            }

            if (c.Description != null)
            {
                parMas[10] = c.Description;
            }
            else
            {
                parMas[10] = "Описание не задано";
            }
            if (filt.ContainsKey("paramchangefilter") || filt.ContainsKey("paramchangecount"))
            {
                parMas[11] = paramChangeCountWork(c, filt).ToString();
            }
            else
            {
                parMas[11] = "Фильтр или счётчик переходов не задан";
            }

            return(parMas);
        }