Skip to content

Commit

Permalink
Examples of ER Diagram added
Browse files Browse the repository at this point in the history
  • Loading branch information
jGauravGupta committed Jun 20, 2024
1 parent 101645e commit 1e5a0c0
Show file tree
Hide file tree
Showing 32 changed files with 1,136 additions and 122 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/starter-archetype/src/main/resources/archetype-resources/.gradle
/starter-ui/payara-starter-ui.iml
/PayaraStarterGenerator/target/
starter-ui/nb-configuration.xml
starter-ui/nb-configuration.xml
15 changes: 14 additions & 1 deletion PayaraStarterGenerator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>fish.payara.starter</groupId>
<artifactId>payara-starter-parent</artifactId>
<version>1.0-beta7</version>
<version>1.0-beta8</version>
</parent>
<artifactId>payara-starter-generator</artifactId>
<name>Payara Starter Generator</name>
Expand All @@ -17,4 +17,17 @@
<type>jar</type>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,23 @@ public String getProperty(String key) {
}
return null;
}

public String getProperty(String key, String defaultValue) {
for (KeyValue keyValue : property) {
if (keyValue.getKey().equals(key)) {
return keyValue.getValue() == null ? defaultValue : keyValue.getValue();
}
}
return defaultValue;
}

public String getToolTipText() {
return getProperty("tooltip", "");
}

public boolean isToolTip() {
return !getToolTipText().trim().isEmpty();
}

public List<String> getImports() {
return _import;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
* @author Gaurav Gupta
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ERModel {

private final List<Entity> entities = new ArrayList<>();
private final List<Relationship> relationships = new ArrayList<>();
private List<KeyValue> property;
private List<KeyValue> property = Collections.EMPTY_LIST;

public void addEntity(Entity entity) {
entities.add(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public String getLowerCasePluralizeName() {
}

public String getTitleCasePluralizeName() {
return pluralize(titleCase(name));
return getProperty("title", pluralize(titleCase(name)));
}

public List<Attribute> getAttributes() {
Expand Down Expand Up @@ -117,11 +117,11 @@ public String getIcon() {
}

public String getTitle() {
return getProperty("title", name);
return getProperty("title", titleCase(name));
}

public String getDescription() {
return getProperty("description", name);
return getProperty("description", "");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import java.util.Map;
import java.util.Set;

public class ApplicationGenerator {
public class CRUDAppGenerator {

private final String _package;
private final String domainLayer;
Expand All @@ -52,7 +52,7 @@ public class ApplicationGenerator {
private final ERModel model;
private static final boolean IS_LOCAL = false; // Change this flag for local vs. production

public ApplicationGenerator(ERModel model, String _package, String domainLayer, String repositoryLayer, String controllerLayer) {
public CRUDAppGenerator(ERModel model, String _package, String domainLayer, String repositoryLayer, String controllerLayer) {
this._package = _package;
this.model = model;
if (domainLayer == null || domainLayer.trim().isEmpty()) {
Expand Down Expand Up @@ -131,7 +131,7 @@ public static void main(String[] args) {
String domainLayer = "domain";
String repositoryLayer = "service";
String controllerLayer = "resource";
ApplicationGenerator generator = new ApplicationGenerator(erModel, _package, domainLayer, repositoryLayer, controllerLayer);
CRUDAppGenerator generator = new CRUDAppGenerator(erModel, _package, domainLayer, repositoryLayer, controllerLayer);
try {
generator.generate(new File("D:\\HelloWorld"), true, true, true, true); // Output directory
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
the License.
-->
<div class="container mt-5">
<h1 class="mb-4">${entityNameTitleCase} Management</h1>
<button class="btn btn-success mb-4" id="new${entityNameTitleCase}Button">Add ${entityNameTitleCase}</button>
<h1 class="mb-4">${entity.getTitle()}</h1>
<p>${entity.getDescription()}</p>
<button class="btn btn-success mb-4" id="new${entityNameTitleCase}Button">Add ${entity.getTitle()}</button>

<!-- ${entityNameTitleCase} Table -->
<table id="${entityNameLowerCasePluralize}Table" class="table table-bordered">
Expand All @@ -37,7 +38,7 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="${entityNameLowerCase}ModalLabel">Add ${entityNameTitleCase}</h5>
<h5 class="modal-title" id="${entityNameLowerCase}ModalLabel">Add ${entity.getTitle()}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
Expand Down Expand Up @@ -143,7 +144,7 @@
$('#new${entityNameTitleCase}Button').on('click', function () {
$('#${entityNameLowerCase}Form')[0].reset();
$('#${entity.getPrimaryKeyName()}').prop('disabled', false);
$('#${entityNameLowerCase}ModalLabel').text('Add ${entityNameTitleCase}');
$('#${entityNameLowerCase}ModalLabel').text('Add ${entity.getTitle()}');
$('#saveButton').show();
$('#updateButton').hide();
$('#${entityNameLowerCase}Modal').modal('show');
Expand Down Expand Up @@ -235,7 +236,7 @@
$('#${attribute.name}').val(${entityNameLowerCase}.${attribute.name})<#if attribute.isPrimaryKey()>.prop('disabled', true)</#if>;
</#if>
</#list>
$('#${entityNameLowerCase}ModalLabel').text('Edit ${entityNameTitleCase}');
$('#${entityNameLowerCase}ModalLabel').text('Edit ${entity.getTitle()}');
$('#saveButton').hide();
$('#updateButton').show();
$('#${entityNameLowerCase}Modal').modal('show');
Expand Down
2 changes: 1 addition & 1 deletion starter-ui/nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You can copy and paste the single properties, into the pom.xml file and the IDE
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv5ee8</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
<netbeans.hint.jdkPlatform>JDK_17</netbeans.hint.jdkPlatform>
</properties>
</project-shared-configuration>
24 changes: 22 additions & 2 deletions starter-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@
<artifactId>payara-starter-generator</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-open-ai</artifactId>
<version>0.30.0</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-easy-rag</artifactId>
<version>0.30.0</version>
</dependency>
<dependency>
<groupId>com.theokanning.openai-gpt3-java</groupId>
<artifactId>service</artifactId>
<version>0.18.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<build>
<extensions>
Expand Down Expand Up @@ -129,7 +149,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>11</release>
<release>17</release>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -174,7 +194,7 @@
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-cloud-maven-plugin</artifactId>
<version>1.0-Alpha1</version>
<version>1.0-Alpha2</version>
</plugin>
</plugins>
</build>
Expand Down
Loading

0 comments on commit 1e5a0c0

Please sign in to comment.