Non-System Custom Link Types [source patch provided]

XMLWordPrintable

      One use for linking is to use the link style to label link types as meaningful for CalculatedCustomFields. We have written a plug-in to aggregate time estimates based on a link type "optimi_aggregatetask" (we did not find the subtask type to be particularly useful in our case). In order to have a link type with a non-empty style be useful, it must not be declared a "system" link type. This requires a source patch on IssueLinkType.isSystemLinkType() as well as IssueLinkTypeManager.getIssueLinkTypes().

      I have changed isSystemLinkType to return true on styles beginning with "jira_", but this obviously isn't the only way. Having these incorporated into the source tree will make upgrading easier for me.

      Index: C:/Development/jira-devel/atlassian-jira-enterprise-3.2.3-source/jira/src/java/com/atlassian/jira/issue/link/IssueLinkType.java
      ===================================================================
      --- C:/Development/jira-devel/atlassian-jira-enterprise-3.2.3-source/jira/src/java/com/atlassian/jira/issue/link/IssueLinkType.java	(revision 23)
      +++ C:/Development/jira-devel/atlassian-jira-enterprise-3.2.3-source/jira/src/java/com/atlassian/jira/issue/link/IssueLinkType.java	(working copy)
      @@ -126,6 +126,6 @@
               // TODO introduce another field to indicate whether the issue link type is
               // a system link type, as we might let the users create their own link styles
               // and therefore if an link type has a style does NOT mean it is a system link type
      -        return (getStyle() != null);
      +        return (getStyle() != null && getStyle().startsWith("jira_"));
           }
       }
      
      DefaultIssueLinkTypeManager changes (not patch format):
      
          public Collection getIssueLinkTypes(IssueLinkTypeManager ilm)
          {
              final List linkTypeGVs = delegator.findAll(OfBizDelegator.ISSUE_LINK_TYPE, UtilMisc.toList("linkname" + " ASC"));
              if (linkTypeGVs != null)
              {
                  return buildIssueLinkTypes(linkTypeGVs, ilm);
              }
              else
              {
                  return Collections.EMPTY_LIST;
              }
          }
      
          private List buildIssueLinkTypes(List issueLinkTypeGVs, IssueLinkTypeManager ilm)
          {
              List issueLinkTypes = new ArrayList();
              for (Iterator iterator = issueLinkTypeGVs.iterator(); iterator.hasNext();)
              {
                  GenericValue issueLinkTypeGV = (GenericValue) iterator.next();
                  IssueLinkType ilt = buildIssueLinkType(issueLinkTypeGV, ilm);
                  if (! ilt.isSystemLinkType())
                  	issueLinkTypes.add(ilt);
              }
              return issueLinkTypes;
          }
      

              Assignee:
              Dylan Etkin [Atlassian]
              Reporter:
              Vincent Fiano
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 0.25h
                  0.25h
                  Remaining:
                  Remaining Estimate - 0.25h
                  0.25h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified