Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mylyn-integrators] Is JiraAttributeFactory.mapCommonAttributeKey backwards?

Hi,

> Looking at JiraAttributeFactory.mapCommoneAttributeKey(String), it seems
> to expect strings like "summary" and return keys like
> RepositoryTaskAttribute.SUMMARY ("task.common.summary").  But the
> IntegratorGuide says that "mapCommonAttributeKey() is used to map the
> RepositoryTaskAttribute attributes to the connector attributes."  And
> that's what the Trac connector seems to do, mapping
> RepositoryTaskAttribute.DATE_CREATION to Key.TIME, for example.

The integrator guide is correct. Previous implementations of the JIRA 
connector used the mapping method for mapping internal keys as well as the 
providing a mapping for task attribute keys (which in the case of JIRA is 
just a 1:1 mapping). The method has been reimplemented in JiraAttributeMapper 
in cvs head:

	public String mapToRepositoryKey(TaskAttribute parent, String key) {
		if (TaskAttribute.COMPONENT.equals(key)) {
			return JiraAttribute.COMPONENTS.getId();
		}
		return super.mapToRepositoryKey(parent, key);
	}

> I don't have a Trac repository set up here, but I do have a Jira
> repository.  Whem I'm confused, I sometimes debug through the Jira
> connector.  But in this case, it looks like the TracAttributeFactory
> maps from RepositoryTaskAttribute keys to Trac-specific keys, and the
> JiraAttributeFactory maps from Jira-specific keys to
> RepositoryTaskAttribute keys.
>
> In this case, is the TracAttributeFactory.mapCommonAttributeKey
> implementation a better guide?

Yes, the Trac or Bugzilla implementation are the better reference in this 
case. You might want to take a look at the JiraAttribute class though which 
provides a mapping between JIRA repository attributes and Mylyn task data 
attributes. Having this information encapsulated for each kind of attribute 
that your repository knows in a single place (enum) made porting from Mylyn 
2.3 to 3.0 much easier:

 - repository key
 - repository type
 - meta data: repository label, read-only...
 - mylyn key

For porting the attribute factory for the JIRA connector I only had to add a 
mapping form the JIRA repository types to the new Mylyn TaskAttribute types.

Steffen

-- 
Steffen Pingel - steffenp@xxxxxx - http://steffenpingel.de


Back to the top