This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 192150 - Allow setting the display name of a database connection through the API
Summary: Allow setting the display name of a database connection through the API
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: API_REVIEW_FAST, NETFIX
Depends on:
Blocks:
 
Reported: 2010-11-19 00:11 UTC by akochnev
Modified: 2010-11-27 06:24 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
patch to allow for setting the display name with create factory method (2.53 KB, patch)
2010-11-19 00:12 UTC, akochnev
Details | Diff
unit tests to cover the modified api (2.47 KB, patch)
2010-11-19 19:03 UTC, akochnev
Details | Diff
proposed API change (7.31 KB, patch)
2010-11-22 10:10 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description akochnev 2010-11-19 00:11:18 UTC
The Database Explorer API (http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-db/allclasses-frame.html) provides a nice way to add connections programmatically. However, when I create the DatabaseConnection object using the DatabaseConnection.create method and when I add it to the list of connections, it displays w/ a very long name corresponding to the connection url and the schema. Now, in the UI I can go to the properties and adjust the name of the connection. The DatabaseConnection itself has a method to get the displayName; however, no setter for neither name or display name is provided. Also, the class is final, so I can’t subclass the getName method to use something more reasonable. Thus, I have no way to programmatically create a DatabaseConnection that would have a nice display name.
Comment 1 akochnev 2010-11-19 00:12:32 UTC
Created attachment 103089 [details]
patch to allow for setting the display name with create factory method
Comment 2 Jiri Rechtacek 2010-11-19 09:26:44 UTC
The patch makes sense, just a unit test is missing. Thanks
Comment 3 akochnev 2010-11-19 19:03:42 UTC
Created attachment 103114 [details]
unit tests to cover the modified api
Comment 4 Jiri Rechtacek 2010-11-22 10:10:33 UTC
Created attachment 103175 [details]
proposed API change

Please, review proposed API change. Thanks
Comment 5 Jiri Rechtacek 2010-11-22 10:12:00 UTC
Please, review proposed API change. Thanks
Comment 6 Jaroslav Tulach 2010-11-22 14:24:50 UTC
The new method shall be annotated with @since tag.
Comment 7 akochnev 2010-11-22 14:57:29 UTC
Jiri - do I need to produce another patch w/ the @since tag or is this something you would do ?
Comment 8 Jiri Rechtacek 2010-11-25 16:02:08 UTC
Thanks for review. I'm going to integrated it tomorrow.
Comment 9 Jiri Rechtacek 2010-11-26 08:32:02 UTC
The patch was applied in core-main/rev/35f292b1c239
Thanks for your contribution.
Comment 10 Jiri Kovalsky 2010-11-26 12:06:54 UTC
Cool, thanks Jirko for the review and especially Alex for your patch. I added this RFE to our list of community fixed issues.

http://wiki.netbeans.org/NetFIXIssues
Comment 11 Quality Engineering 2010-11-27 06:24:44 UTC
Integrated into 'main-golden', will be available in build *201011270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/35f292b1c239
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #192150: Allow setting the display name of a database connection through the API