public bool Equals(IssueLinkType other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.Id == Id && Equals(other.Name, Name) && Equals(other.OutwardLinksName, OutwardLinksName) && Equals(other.InwardLinksName, InwardLinksName) && PlvsUtils.compareLists(other.OutwardLinks, OutwardLinks) && PlvsUtils.compareLists(other.InwardLinks, InwardLinks)); }
private void getIssueLinks(JToken links) { if (links == null) { return; } var d = new Dictionary <int, IssueLinkType>(); foreach (var link in links) { var type = link["type"]; var id = link["id"].Value <int>(); var ilt = new IssueLinkType(id, type["name"].Value <string>(), type["outward"].Value <string>(), type["inward"].Value <string>()); d[id] = ilt; } foreach (var link in links) { var id = link["id"].Value <int>(); if (link["inwardIssue"] != null && link["inwardIssue"].HasValues) { d[id].InwardLinks.Add(link["inwardIssue"]["key"].Value <string>()); } if (link["outwardIssue"] != null && link["outwardIssue"].HasValues) { d[id].OutwardLinks.Add(link["outwardIssue"]["key"].Value <string>()); } } foreach (var link in d.Values) { if (link.InwardLinks.Count == 0) { link.InwardLinksName = null; } if (link.OutwardLinks.Count == 0) { link.OutwardLinksName = null; } } issueLinks.AddRange(d.Values); }
private void getIssueLinks(XPathNavigator nav) { XPathExpression expr = nav.Compile("issuelinktype"); XPathNodeIterator it = nav.Select(expr); if (!nav.MoveToFirstChild()) { return; } while (it.MoveNext()) { int id = XPathUtils.getAttributeSafely(it.Current, "id", 0); string linkTypeName = null; string outwardLinksName = null; string inwardLinksName = null; List <JiraNamedEntity> outwardIdsAndKeys = null; List <JiraNamedEntity> inwardIdsAndKeys = null; if (it.Current.MoveToFirstChild()) { do { switch (it.Current.Name) { case "name": linkTypeName = it.Current.Value; break; case "outwardlinks": outwardLinksName = XPathUtils.getAttributeSafely(it.Current, "description", null); outwardIdsAndKeys = getLinks(it.Current); break; case "inwardlinks": inwardLinksName = XPathUtils.getAttributeSafely(it.Current, "description", null); inwardIdsAndKeys = getLinks(it.Current); break; } } while (it.Current.MoveToNext()); if (id == 0 || linkTypeName == null) { continue; } IssueLinkType ilt = new IssueLinkType(id, linkTypeName, outwardLinksName, inwardLinksName); if (outwardIdsAndKeys != null) { foreach (JiraNamedEntity entity in outwardIdsAndKeys) { ilt.OutwardLinks.Add(entity.Name); } } if (inwardIdsAndKeys != null) { foreach (JiraNamedEntity entity in inwardIdsAndKeys) { ilt.InwardLinks.Add(entity.Name); } } issueLinks.Add(ilt); } it.Current.MoveToParent(); } nav.MoveToParent(); }