Exemplo n.º 1
0
        internal IIssue[] GetAllIssues(string text)
        {
            List <JiraIssue> issues = new List <JiraIssue>();

            //RemoteProject[] projects = _service.getProjectsNoSchemes(_token);
            //RemoteIssue[] allissues = _service.getIssuesFromTextSearchWithProject(_token, new string[] { projects[0].key }, " ", 100);
            RemoteIssue[] allissues = _service.getIssuesFromTextSearch(_token, text);
            foreach (RemoteIssue issue in allissues)
            {
                issues.Add(new JiraIssue(this, issue));
            }
            return(issues.ToArray());
        }
Exemplo n.º 2
0
        public XDoc TableSearch(
            [DekiExtParam("search query")] string query
            )
        {
            InitializeService();
            InitializeStatuses();
            InitializeFilters();
            InitializePriorities();

            RemoteIssue[] issues = _jira.getIssuesFromTextSearch(_jiraToken, query);

            XDoc bugList = BuildBugListHTMLTable(issues);
            XDoc ret     = new XDoc("html");

            ret.Start("head")
            .Start("script").Attr("type", "text/javascript").Attr("src", Files.At("sorttable.js")).End()
            .Start("link").Attr("type", "text/css").Attr("rel", "stylesheet").Attr("href", Files.At("Jira.css")).End()
            .Start("style").Attr("type", "text/css").Value(@".feedtable {
    border:1px solid #999;
    line-height:1.5em;
    overflow:hidden;
    width:100%;
}
.feedtable th {
    background-color:#ddd;
    border-bottom:1px solid #999;
    font-size:14px;
}
.feedtable tr {
    background-color:#FFFFFF;
}
.feedtable tr.feedroweven td {
    background-color:#ededed;
}").End()
            .End();
            ret.Start("body").Add(bugList).End();
            return(ret);
        }
Exemplo n.º 3
0
        public string createIssue(JiraIssue issue)
        {
#if PLVS_133_WORKAROUND
            object[] issuesTable = service.getIssuesFromTextSearch(Token, "<<<<<<<<<<<<<IHOPETHEREISNOSUCHTEXT>>>>>>>>>>>>>>");

            Type   issueObjectType = issuesTable.GetType().GetElementType();
            object ri = issueObjectType.GetConstructor(new Type[] {}).Invoke(new object[] {});
            setObjectProperty(ri, "project", issue.ProjectKey);
            setObjectProperty(ri, "type", issue.IssueTypeId.ToString());
            setObjectProperty(ri, "priority", issue.PriorityId.ToString());
            setObjectProperty(ri, "summary", issue.Summary);
            setObjectProperty(ri, "description", issue.Description);

            if (issue.Assignee != null)
            {
                setObjectProperty(ri, "assignee", issue.Assignee);
            }

            if (issue.Components != null && issue.Components.Count > 0)
            {
                object[] components = service.getComponents(Token, issue.ProjectKey);
                setObjectTablePropertyFromObjectList(ri, "components", issue.Components, components);
            }

            object[] versions = service.getVersions(Token, issue.ProjectKey);

            if (issue.Versions != null && issue.Versions.Count > 0)
            {
                setObjectTablePropertyFromObjectList(ri, "affectsVersions", issue.Versions, versions);
            }

            if (issue.FixVersions != null && issue.FixVersions.Count > 0)
            {
                setObjectTablePropertyFromObjectList(ri, "fixVersions", issue.FixVersions, versions);
            }

            object createdIssue = service.createIssue(Token, ri);
            return((string)createdIssue.GetType().GetProperty("key").GetValue(createdIssue, null));
#else
            RemoteIssue ri = new RemoteIssue
            {
                project     = issue.ProjectKey,
                type        = issue.IssueTypeId.ToString(),
                priority    = issue.PriorityId.ToString(),
                summary     = issue.Summary,
                description = issue.Description,
            };
            if (issue.Assignee != null)
            {
                ri.assignee = issue.Assignee;
            }

            if (issue.Components != null && issue.Components.Count > 0)
            {
                IEnumerable <JiraNamedEntity> components = getComponents(issue.ProjectKey);
//                RemoteComponent[] objects = service.getComponents(Token, issue.ProjectKey);
                List <RemoteComponent> comps = new List <RemoteComponent>();
                foreach (string t in issue.Components)
                {
                    // fixme: a bit problematic part. What if two objects have the same name?
                    // I suppose JiraIssue class has to be fixed, but that would require more problematic
                    // construction of it during server query
                    string tCopy = t;
                    foreach (JiraNamedEntity component in components.Where(component => component.Name.Equals(tCopy)))
                    {
                        comps.Add(new RemoteComponent {
                            id = component.Id.ToString(), name = component.Name
                        });
                        break;
                    }
                }
                ri.components = comps.ToArray();
            }

            List <JiraNamedEntity> versions = getVersions(issue.ProjectKey);
//            RemoteVersion[] versions = service.getVersions(Token, issue.ProjectKey);

            if (issue.Versions != null && issue.Versions.Count > 0)
            {
                List <RemoteVersion> vers = new List <RemoteVersion>();
                foreach (string t in issue.Versions)
                {
                    // fixme: a bit problematic part. same as for objects
                    string tCopy = t;
                    foreach (JiraNamedEntity version in versions.Where(version => version.Name.Equals(tCopy)))
                    {
                        vers.Add(new RemoteVersion {
                            id = version.Id.ToString(), name = version.Name
                        });
                        break;
                    }
                }
                ri.affectsVersions = vers.ToArray();
            }

            if (issue.FixVersions != null && issue.FixVersions.Count > 0)
            {
                List <RemoteVersion> vers = new List <RemoteVersion>();
                foreach (string t in issue.FixVersions)
                {
                    // fixme: a bit problematic part. same as for objects
                    string tCopy = t;
                    foreach (JiraNamedEntity version in versions.Where(version => version.Name.Equals(tCopy)))
                    {
                        vers.Add(new RemoteVersion {
                            id = version.Id.ToString(), name = version.Name
                        });
                        break;
                    }
                }
                ri.fixVersions = vers.ToArray();
            }

            RemoteIssue createdIssue = service.createIssue(Token, ri);
            return(createdIssue.key);
#endif
        }