-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for generating Micronaut Data entity classes end repository interfaces added. #3584
Conversation
dbalek
commented
Feb 10, 2022
•
edited
edited
- Generator for Micronaut Data entity classes from database added.
- Generator for Micronaut Data repository interfaces from entity classes added.
- Both generators are available form New Form Template wizard in NetBeans and VSCode.
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Outdated
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Outdated
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Outdated
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Outdated
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Outdated
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Outdated
Show resolved
Hide resolved
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautEntity.java
Show resolved
Hide resolved
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/MDEntityClassFromDB.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we build the customization of templates around FileBuilder
as introduced by @sdedic?
enterprise/micronaut/src/org/netbeans/modules/micronaut/resources/layer.xml
Outdated
Show resolved
Hide resolved
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
Outdated
Show resolved
Hide resolved
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
Outdated
Show resolved
Hide resolved
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
Outdated
Show resolved
Hide resolved
ConnectionManager.getDefault().connect(connection); | ||
Connection conn = connection.getJDBCConnection(); | ||
ResultSet rs = conn.getMetaData().getTables(conn.getCatalog(), conn.getSchema(), "%", new String[]{"TABLE", "VIEW"}); //NOI18N | ||
List<NotifyDescriptor.QuickPick.Item> dbItems = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ask @sdedic , but I believe createFromTemplate(CreateDescriptor desc)
was never intended for displaying UI. I'd rather see that user-related code in a separate method which could be invoked by Swing as well as VSCode UI optionally.
return name != null ? builder.name(name) : null; | ||
}); | ||
} | ||
return CompletableFuture.completedFuture(builder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird. If there is no handler
we ask for a name. If there is some handler
then we assume it will handle all the UI on itself. That's a change in the API. Handlers could have been written for NetBeans 13 for completely different reason.
Some other way to find out hander
wants to provide additional customization is desirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be IMHO solved as a separate PR. Once we agree upon how to provide an additional customization via handler
, the implementation could be easily changed without breaking any API.
Also, an additional configuration could be useful for other templates, not just the two added by this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for handler == null to detect that a special UI is present is an incompatible change. The current implementation of Micronaut createFromTemplate
that shows dialogs is ugly (but compatible).
I am not going to approve this PR. I am not requesting changes either - I just suggest to come up with better, compatible API.
I am not going to approve this PR. I am not requesting changes either - I just suggest to come up with better, compatible API.