public IList <Workitem> GetIssues <T>(string filterId) where T : Workitem, new()
        {
            connector.Login();
            var remoteIssues = connector.GetIssuesFromFilter(filterId);
            var items        = new List <Workitem>();

            foreach (var issue in remoteIssues)
            {
                var projectMapping  = ResolveVersionOneProjectMapping(issue.Project);
                var priorityMapping = ResolveVersionOnePriorityMapping(issue.Priority);
                var description     = string.IsNullOrEmpty(issue.Description)
                                      ? issue.Description
                                      : issue.Description.Replace("\n", "<br/>");

                var item = new T {
                    Title       = issue.Summary,
                    Project     = projectMapping.Name,
                    ExternalId  = issue.Key,
                    ProjectId   = projectMapping.Id,
                    Description = description,
                    Owners      = issue.Assignee,
                };

                if (!string.IsNullOrEmpty(configuration.UrlTemplateToIssue) &&
                    !string.IsNullOrEmpty(configuration.UrlTitleToIssue))
                {
                    item.ExternalLink = new UrlToExternalSystem(configuration.UrlTemplateToIssue.Replace("#key#", issue.Key), configuration.UrlTitleToIssue);
                }

                if (priorityMapping != null)
                {
                    item.Priority = priorityMapping.Id;
                }

                items.Add(item);
            }

            connector.Logout();
            return(items);
        }
Example #2
0
 public void Login()
 {
     connector.Login();
 }