Bug 175922 - Support Bugzilla 3.0 custom fields
Summary: Support Bugzilla 3.0 custom fields
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 enhancement with 5 votes (vote)
Target Milestone: 3.0   Edit
Assignee: Frank Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 209131 (view as bug list)
Depends on: 214835
Blocks:
  Show dependency tree
 
Reported: 2007-02-28 17:30 EST by kinra CLA
Modified: 2009-06-08 13:36 EDT (History)
9 users (show)

See Also:


Attachments
config.cgi of a clean 3.0.2 (17.18 KB, text/plain)
2008-01-12 11:07 EST, Frank Becker CLA
no flags Details
config.cgi with one custom field (17.44 KB, text/plain)
2008-01-12 11:12 EST, Frank Becker CLA
no flags Details
proof of concept (23.66 KB, patch)
2008-01-13 16:41 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (15.76 KB, application/octet-stream)
2008-01-13 16:42 EST, Frank Becker CLA
no flags Details
Patch (27.35 KB, patch)
2008-01-17 15:32 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (18.48 KB, application/octet-stream)
2008-01-17 15:33 EST, Frank Becker CLA
no flags Details
New Patch (26.55 KB, patch)
2008-01-18 16:18 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (20.08 KB, application/octet-stream)
2008-01-18 16:18 EST, Frank Becker CLA
no flags Details
correted patch (20.79 KB, patch)
2008-02-19 18:36 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (4.69 KB, application/octet-stream)
2008-02-19 18:36 EST, Frank Becker CLA
no flags Details
Updated patch, minor alterations (21.67 KB, patch)
2008-03-28 13:29 EDT, Robert Elves CLA
no flags Details | Diff
updated patch with jUnit Test (29.22 KB, patch)
2008-03-28 18:16 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (7.88 KB, application/octet-stream)
2008-03-28 18:16 EDT, Frank Becker CLA
no flags Details
new Implementation (comment 41) (7.59 KB, patch)
2008-04-13 15:47 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (8.82 KB, application/octet-stream)
2008-04-13 15:47 EDT, Frank Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kinra CLA 2007-02-28 17:30:24 EST
The Bugzilla we are using is version 2.20 with some customization.

We have added reproducibility, frequency, locales, work item type, Web request number fields to bugbase.

Currently The Mylar Bugzilla plugin does not seem to support these fields. Is this something that we can add to our Mylar configuration or can we get a patch from you  guy? We would really love to use the Mylar plug in but are stuck right now on a "legal reproducibility" error on a bug submit because of our bugzilla's custom fields.
Comment 1 Mik Kersten CLA 2007-03-02 14:10:01 EST
This might require a custom connector that extends the current Bugzilla connector.  We will investigate next week.  Is there any other customization beyond what you have listed?
Comment 2 kinra CLA 2007-03-02 16:07:51 EST
Thanks so much for the quick reply, we are excited to start using the Mylar plugin! ;-)  No other customizations beyond that. Let me know if you need any other additional info from my end.

Thanks again,
-Kinra
Comment 3 Robert Elves CLA 2007-03-22 17:17:54 EDT
Bugzilla 3.0 will have support for custom fields (http://www.bugzilla.org/releases/3.0/new-features.html#v30_feat_cf)
We intend to support these custom fields in our rich editor. I would suggest migrating to Bugzilla 3.0 and Myalr 2.0 when available.

On a technical note, currently the valid options for newly created custom fields are not being exported in the config rdf. I've brought this to their attention (https://bugzilla.mozilla.org/show_bug.cgi?id=287326#c40).
Comment 4 Robert Elves CLA 2007-03-22 18:53:18 EDT
Filed: https://bugzilla.mozilla.org/show_bug.cgi?id=374981
Comment 5 Thomas Ehrnhoefer CLA 2007-04-10 11:01:31 EDT
Does this mean that without having the filed Bugzilla-Bug fiex, it wont work in Mylar?
We are currently migrating to Bugzilla 3.0 (RC1) and thinking abount using custom fields, so I am wondering if this Bug depends on the Bugzilla-Bug.

Thx :=)
Comment 6 Robert Elves CLA 2007-04-10 14:43:39 EDT
Correct. We need that Bugzilla bug fixed in order to support custom fields correctly in the rich editor.
Comment 7 Robert Elves CLA 2007-06-21 22:02:37 EDT
Was not resolved in Bugzilla 3.0, deferring.
Comment 8 Mik Kersten CLA 2007-07-09 23:50:11 EDT
Tentatively scheduling for 2.1 since bugs.eclipse.org is likely to update to 3.0 in the same timeframe.
Comment 9 Robert Elves CLA 2007-11-14 16:29:45 EST
*** Bug 209131 has been marked as a duplicate of this bug. ***
Comment 10 Robert Elves CLA 2007-11-14 16:34:48 EST
The Bugzilla team has resolved the following bug:

374981: Custom field single select options not available in config.cgi rdf
https://bugzilla.mozilla.org/show_bug.cgi?id=374981

We are now just waiting for next 3.0.x release that includes this fix.
Comment 11 Robert Elves CLA 2008-01-09 19:33:17 EST
3.0.3 was just release so we should be able to make progress on this now. Frank this is a high value item as can be seen by the number of votes. Do you want to take this on for 2.3? We'll need to be backwards compatible i.e disallow custom fields for Bugzilla < 3.0.3 and will need test coverage as per usual. I'll need to install a 3.0.3 test server (created bug#214835).
Comment 12 Frank Becker CLA 2008-01-10 01:56:39 EST
(In reply to comment #11)
> 3.0.3 was just release so we should be able to make progress on this now. Frank
> this is a high value item as can be seen by the number of votes. Do you want to
> take this on for 2.3? We'll need to be backwards compatible i.e disallow custom
> fields for Bugzilla < 3.0.3 and will need test coverage as per usual. I'll need
> to install a 3.0.3 test server (created bug#214835).
>

Hi Rob,

I will start with install the new 3.0.3 on my MacBook Pro when I come home.

Comment 13 Frank Becker CLA 2008-01-11 02:31:32 EST
Here some questions.

1) The rdf file contains all bugzilla fields an not only the custom fields. Should we store only the custom fields?
2) In the rdf file only name and desciption are included an not the other flags. Should we create a new bug for the missing fields?
   By example we did not know the type of the custom field (freetext, drop down).
3) I must extend the RepositoryConfiguration, which has a serialID. What is to do to get backward compatibility?

Actual state of my work.

new List for fields in RepositoryConfiguration (only the name of the fields) can be filled by the parser of the rdf file.

Over the weekend I will continue the work.
Comment 14 Robert Elves CLA 2008-01-11 20:27:04 EST
1) For now it may be best to treat these as special and just store the additional custom fields
2) I haven't installed 3.0.3 yet here. Could you post or email me a copy of the rdf output from your 3.0.3 install so I can look at what we now get to work with?
3) Up the serial number and BugzillaCorePlugin will log the error, downloading a new config. I don't think we have any other option.
Comment 15 Frank Becker CLA 2008-01-12 11:07:54 EST
Created attachment 86762 [details]
config.cgi of a clean 3.0.2

2) I haven't installed 3.0.3 yet here. Could you post or email me a copy of the rdf output from your 3.0.3 install so I can look at what we now get to work with?
Comment 16 Frank Becker CLA 2008-01-12 11:12:55 EST
Created attachment 86763 [details]
config.cgi with one custom field

No need for Bugzilla 3.0.3. You can do this with verson 3.0.2.
Comment 17 Robert Elves CLA 2008-01-12 12:28:03 EST
My understanding is that in 3.0.3 the option values for custom fields should now be in the rdf. I.e. when you define a single select field with options those options should now be available to  us in the rdf. Is this the case?
Comment 18 Frank Becker CLA 2008-01-13 16:41:55 EST
Created attachment 86779 [details]
proof of concept

Questions:

1) Is it OK that I add a parameter to client.getTaskData. This is needed to have the RepositoryConfiguration within the SaxMultiBugReportContentHandler file.

2) Is it ther right way to show the custom Fieldes under the Attributes section in an extra area.

Next steps

Hope that I can finsh the cleanup until Wednesday.
Comment 19 Frank Becker CLA 2008-01-13 16:42:00 EST
Created attachment 86780 [details]
mylyn/context/zip
Comment 20 Robert Elves CLA 2008-01-14 12:29:46 EST
This is looking good Frank,

 (In reply to comment #18)
> 1) Is it OK that I add a parameter to client.getTaskData. This is needed to have
> the RepositoryConfiguration within the SaxMultiBugReportContentHandler file.

Since this is an internal class we have license to make these sort of changes, but I'm wondering if instead the client should be constructed with  a configuration (if available), otherwise when getConfiguration is called it is set internal to BugzillaClient?  That way the client has a configuration at its disposal.  This would keep the api cleaner. Thoughts?
> 
> 2) Is it ther right way to show the custom Fieldes under the Attributes section
> in an extra area.
That is fine for now and we can iterate on this if need be.
Comment 21 Mik Kersten CLA 2008-01-15 12:47:42 EST
Great to see progress on this Frank!
Comment 22 Frank Becker CLA 2008-01-16 16:41:48 EST
 (In reply to comment #20)
> 
> Since this is an internal class we have license to make these sort of changes,
> but I'm wondering if instead the client should be constructed with  a
> configuration (if available), otherwise when getConfiguration is called it is
> set internal to BugzillaClient?  That way the client has a configuration at its
> disposal.  This would keep the api cleaner. Thoughts?

To read the Configuration from the cache file you need TaskRepository as an parameter. But in BugzillaClientFactory.createClient you only have ther repositoryURL. That wase the reason for add the customFields as an parameter for the two getTaskData methods of BugzillaClient.

Or should we extend BugzillaCorePlugin.getRepositoryConfiguration(String repositoryUrl) to read the cache file like in BugzillaCorePlugin.getRepositoryConfiguration(TaskRepository repository, boolean forceRefresh).

Comment 23 Robert Elves CLA 2008-01-16 19:55:26 EST
 (In reply to comment #22)
> To read the Configuration from the cache file you need TaskRepository as an
> parameter. But in BugzillaClientFactory.createClient you only have ther
> repositoryURL. That wase the reason for add the customFields as an parameter for
> the two getTaskData methods of BugzillaClient.
 
 One possible solution would be to set the cached configuration within the BugzillaClientManager.getClient() method right after client construction. We have a repository there. It will require an additional method on BugzillaClient for setting this value. This configuration could then get updated internally by the client whenever BugzillaClient.getRepositoryConfiguration() is called.
 

Comment 24 Frank Becker CLA 2008-01-17 15:32:58 EST
Created attachment 87200 [details]
Patch

 Suggestion from comment 23 included
Comment 25 Frank Becker CLA 2008-01-17 15:33:01 EST
Created attachment 87201 [details]
mylyn/context/zip
Comment 26 Frank Becker CLA 2008-01-18 16:18:50 EST
Created attachment 87302 [details]
New Patch

This patch use getManagedForm().getToolkit() instead of toolkit
Comment 27 Frank Becker CLA 2008-01-18 16:18:56 EST
Created attachment 87303 [details]
mylyn/context/zip
Comment 28 Robert Elves CLA 2008-02-18 21:53:05 EST
Frank, is there code missing from SaxMultiBugReportContentHandler in this patch? I notice the custom fields are being passed in bug not used.
Comment 29 Robert Elves CLA 2008-02-18 21:54:14 EST
Also, are you able to cut a new patch that is synced with head? (If not possible I can resolve the conflicts).
Comment 30 Frank Becker CLA 2008-02-19 02:05:23 EST
 (In reply to comment #28)
> Frank, is there code missing from SaxMultiBugReportContentHandler in this patch?
> I notice the custom fields are being passed in bug not used.

 (In reply to comment #29)
> Also, are you able to cut a new patch that is synced with head? (If not possible
> I can resolve the conflicts).

Hope that I can look into before is start with my seminar(next two days).
Comment 31 Frank Becker CLA 2008-02-19 18:36:18 EST
Created attachment 90125 [details]
correted patch

Rob, I found a problem what is currently not solved.

You must first update the repository Attributes to get the Custom Fields.

I'm not at home for the next two days.
Comment 32 Frank Becker CLA 2008-02-19 18:36:21 EST
Created attachment 90126 [details]
mylyn/context/zip
Comment 33 Robert Elves CLA 2008-02-21 21:53:09 EST
Frank, I'll defer this post 2.3 and help get this resolved early in the 3.0 cycle. My apologies for the lack of timely feedback on this. 
Comment 34 Robert Elves CLA 2008-03-28 13:29:09 EDT
I've set up a 3.0.3 at /bugs303 and added a custom field CF_FRUIT with APPLE and ORANGE as the possible values. Upon trying to create a new bug report and opening I'm getting the following exception. Frank, if you could investigate these add some test coverage now that we have a 3.0.3 server that would be great.  I'll post and updated patch...
	
	java.lang.IllegalArgumentException: No enum const class org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement.CF_FRUIT
	at java.lang.Enum.valueOf(Unknown Source)
	at org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement.valueOf(BugzillaReportElement.java:1)
	at org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.updateAttributeOptions(BugzillaTaskDataHandler.java:497)
	at org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.configureTaskData(BugzillaTaskDataHandler.java:187)
	at org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.getTaskData(BugzillaTaskDataHandler.java:92)
	at org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector.createTaskFromExistingId(AbstractRepositoryConnector.java:102)
	at org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector.createTaskFromExistingId(AbstractRepositoryConnector.java:91)
	at org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor.updateSubmittedTask(AbstractRepositoryTaskEditor.java:3796)
	at org.eclipse.mylyn.tasks.ui.editors.AbstractNewRepositoryTaskEditor.updateSubmittedTask(AbstractNewRepositoryTaskEditor.java:476)
	at org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor$49.run(AbstractRepositoryTaskEditor.java:3560)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
	
Comment 35 Robert Elves CLA 2008-03-28 13:29:57 EDT
Created attachment 94017 [details]
Updated patch, minor alterations
Comment 36 Frank Becker CLA 2008-03-28 18:16:56 EDT
Created attachment 94073 [details]
updated patch with jUnit Test

Correction for failure of comment 34 and usage of the new Test Bugzilla (3.0.3).

Rob, hope that this was what you expect.
Comment 37 Frank Becker CLA 2008-03-28 18:16:59 EDT
Created attachment 94074 [details]
mylyn/context/zip
Comment 38 Robert Elves CLA 2008-03-31 19:53:07 EDT
Looking good Frank! I've added a second custom field "cf_testfield2" to bugs303 that is of type fee text.  Unfortunately it looks like this field isn't appearing in the the task xml sent by bugzilla when the field is blank, which results in this field not being visible in the editor. To circumvent this we'll probably need to create all custom fields (in the task xml or not) in the editor. If the custom attribute has no options we render it as a free text field in the editor. Thoughts?

Additionally, it would be cool if we could add custom attribute support to the NewBugzillaTaskEditor, but we don't have access to the "Can be set on bug creation" field in the config rdf output. We'll need to investigate whether the new bugzilla web service api is exposing this field or not (perhaps as part of bug#154785 ).  Once we know this we can decide how to proceed (submit bug report or defer until we adopt the ws api).
Comment 39 Frank Becker CLA 2008-04-01 19:07:18 EDT
(In reply to comment #38)
> Looking good Frank! I've added a second custom field "cf_testfield2" to bugs303
> that is of type fee text.  Unfortunately it looks like this field isn't
> appearing in the the task xml sent by bugzilla when the field is blank, which
> results in this field not being visible in the editor. To circumvent this we'll
> probably need to create all custom fields (in the task xml or not) in the
> editor. 
Actually in BugzillaTaskEditor.createCustomAttributeLayout we iterate over
all CustomFields from the Configuration. Is your configuration up to date (did you an update Attributes after definition of testfield2)

> If the custom attribute has no options we render it as a free text field
> in the editor. Thoughts?
> 
> Additionally, it would be cool if we could add custom attribute support to the
> NewBugzillaTaskEditor, but we don't have access to the "Can be set on bug
> creation" field in the config rdf output. 
Should we report this as an enhancment request to Bugzilla?

> We'll need to investigate whether the
> new bugzilla web service api is exposing this field or not (perhaps as part of
> bug#154785 ).  Once we know this we can decide how to proceed (submit bug report
> or defer until we adopt the ws api).
I take a look for this!
Comment 40 Frank Becker CLA 2008-04-07 00:03:18 EDT
(In reply to comment #39)
> (In reply to comment #38)
> > We'll need to investigate whether the
> > new bugzilla web service api is exposing this field or not (perhaps as part of
> > bug#154785 ).  Once we know this we can decide how to proceed (submit bug report
> > or defer until we adopt the ws api).
> I take a look for this!
This can take some time becaus on my bugzilla I have some problem with bz_webservice_demo.pl.

Comment 41 Robert Elves CLA 2008-04-08 18:56:47 EDT
Patch applied and ip log updated.

 (In reply to comment #39)
> Actually in BugzillaTaskEditor.createCustomAttributeLayout we iterate over
> all CustomFields from the Configuration. Is your configuration up to date (did
> you an update Attributes after definition of testfield2)
This was likely the problem.  I've committed your patch. There was some problems merging BugzillaRepositoryConnector so if you don't mind, could you do a sanity check between that class and your copy and provide an updated patch for BugzillaRepositoryConnector if necessar?

> > We'll need to investigate whether the
> > new bugzilla web service api is exposing this field or not (perhaps as part of
> > bug#154785 ).  Once we know this we can decide how to proceed (submit bug
> report
> > or defer until we adopt the ws api).
> I take a look for this!
Great. No rush here Frank.


In terms of the layout of custom fields, we may want to consider just appending them to the regular attributes section, just before the depends on field rather than giving these an entirely separate section.  Frank, Mik, what are your thoughts on this?
Comment 42 Frank Becker CLA 2008-04-13 15:47:34 EDT
Created attachment 95839 [details]
new Implementation (comment 41)

 (In reply to comment #41)
> In terms of the layout of custom fields, we may want to consider just appending
> them to the regular attributes section, just before the depends on field rather
> than giving these an entirely separate section.  Frank, Mik, what are your
> thoughts on this?

Rob, I think we should move the attribute up (as you suggested) but then we should remove the separator line.

This is included in the patch.
Comment 43 Frank Becker CLA 2008-04-13 15:47:38 EDT
Created attachment 95840 [details]
mylyn/context/zip
Comment 44 Robert Elves CLA 2008-04-13 20:36:26 EDT
Perfect. Patch applied, ip log updated. Created bug#226851 to address the new bug editor.
Comment 45 Oded Arbel CLA 2009-06-03 16:50:11 EDT
(In reply to comment #38)
> Additionally, it would be cool if we could add custom attribute support to the
> NewBugzillaTaskEditor, but we don't have access to the "Can be set on bug
> creation" field in the config rdf output. We'll need to investigate whether the
> new bugzilla web service api is exposing this field or not (perhaps as part of
> bug#154785 ).  Once we know this we can decide how to proceed (submit bug
> report or defer until we adopt the ws api).

Sorry the bug spam.

I see this bug is fixed, and indeed bugzilla custom fields are supported in the task editor.

Unfortunately in the "new task" editor there are no custom fields listed. Are there any plans of adding support to custom fields in the new task editor? I've read bug #154785 which is still open and looks stalled for more then two years.

What is the status with Mylyn support for custom fields in the new task editor, and what can be done to get this complete?
Comment 46 Robert Elves CLA 2009-06-08 13:36:37 EDT
Consider adding yourself to the cc on bug#279357 as Frank has begun to address this need.