The generator was failing to identify primary key columns, resulting in generated beans without them. This has been fixed by updating the code to use the `getColumnsRef()` method, which correctly retrieves the column names for the primary key.
ActionModelsGenerator
Project Overview
The ActionModelsGenerator is an IntelliJ Platform Plugin designed to automate the generation of Java ActionBean and Data Transfer Object (DTO) classes from a database schema. This plugin integrates directly into the IntelliJ IDE, allowing developers to select a database table and generate corresponding Java classes based on predefined FreeMarker templates.
Key Features:
- Database Schema Introspection: Utilizes IntelliJ's database tools to read table and column metadata.
- Code Generation: Generates
ActionBeanand DTO classes using FreeMarker templates. - Template-driven: Customizable code generation via FreeMarker templates (
actionBean.ftl,actionBean.extend.ftl,actionDTO.ftl,actionDTO.extend.ftl). - IDE Integration: Provides a context menu action ("Generate Action Models") in the Database View for easy access.
Core Technologies:
- Java: Primary development language.
- Kotlin: Configured in
build.gradle.kts, indicating potential for Kotlin usage. - Gradle (Kotlin DSL): Build automation system.
- IntelliJ Platform SDK: For IDE integration and database interaction.
- FreeMarker: Templating engine for code generation.
Building and Running
This project is an IntelliJ Platform Plugin built with Gradle.
Build the Plugin: To build the plugin, use the following Gradle command:
./gradlew build
This will produce a .zip plugin artifact in the build/distributions directory.
Run the Plugin in a Development IDE: To run a new IntelliJ IDE instance with this plugin installed for development and testing:
./gradlew runIde
Alternatively, you can use the "Run IDE with Plugin" run configuration provided in the .run directory within IntelliJ IDEA.
Development Conventions
- Language: Primarily Java, with Kotlin support configured.
- Build System: Gradle with Kotlin DSL (
.gradle.ktsfiles). - Code Generation: FreeMarker templates are located in
src/main/resources/templates/. Modifications to these templates will change the generated code structure. - IntelliJ Platform APIs: Development involves using IntelliJ Platform SDK for UI actions, virtual file system operations, and database schema access.
- Action Definition: New actions are defined in
src/main/resources/META-INF/plugin.xml.