-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from jGauravGupta/jeddict-templates-erDiagram
Integrate Jeddict templates to generate full-stack application using ER Diagram - Add (+/-) Buttons for Auto-Increasing/Decreasing Entities in ER Diagram Designer
- Loading branch information
Showing
67 changed files
with
6,755 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>fish.payara.starter</groupId> | ||
<artifactId>payara-starter-parent</artifactId> | ||
<version>1.0-beta8</version> | ||
</parent> | ||
<artifactId>payara-starter-generator</artifactId> | ||
<name>Payara Starter Generator</name> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.freemarker</groupId> | ||
<artifactId>freemarker</artifactId> | ||
<version>2.3.31</version> | ||
<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> |
151 changes: 151 additions & 0 deletions
151
PayaraStarterGenerator/src/main/java/fish/payara/starter/application/domain/Attribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
/** | ||
* Copyright 2024 the original author or authors from the Jeddict project (https://jeddict.github.io/). | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package fish.payara.starter.application.domain; | ||
|
||
import fish.payara.starter.application.util.AttributeType; | ||
import static fish.payara.starter.application.util.StringHelper.pluralize; | ||
import static fish.payara.starter.application.util.StringHelper.startCase; | ||
import static fish.payara.starter.application.util.StringHelper.titleCase; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author Gaurav Gupta | ||
*/ | ||
public class Attribute { | ||
|
||
private final String name; | ||
private final String type; | ||
private boolean isPrimaryKey; | ||
private boolean required; | ||
private List<String> _import = new ArrayList<>(); | ||
private Entity relation; | ||
private boolean multi; | ||
|
||
private final List<KeyValue> property; | ||
|
||
public Attribute(String name, String type, boolean isPrimaryKey, List<KeyValue> property) { | ||
this.name = name; | ||
this.type = type; | ||
this.isPrimaryKey = isPrimaryKey; | ||
this.property = property; | ||
} | ||
|
||
public Attribute(String name, Entity relation, boolean multi, List<KeyValue> property) { | ||
this.name = name; | ||
this.type = relation.getName(); | ||
this.relation = relation; | ||
this.multi = multi; | ||
this.property = property; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getStartCaseName() { | ||
return startCase(name); | ||
} | ||
|
||
public String getLowerCaseName() { | ||
return name.toLowerCase(); | ||
} | ||
|
||
public String getTitleCaseName() { | ||
return titleCase(name); | ||
} | ||
|
||
public String getLowerCasePluralizeName() { | ||
return pluralize(name.toLowerCase()); | ||
} | ||
|
||
public String getTitleCasePluralizeName() { | ||
return pluralize(titleCase(name)); | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public boolean isNumber() { | ||
return AttributeType.isNumber(type); | ||
} | ||
|
||
public boolean isPrimaryKey() { | ||
return isPrimaryKey; | ||
} | ||
|
||
public boolean isRequired() { | ||
return required; | ||
} | ||
|
||
public boolean isMulti() { | ||
return multi; | ||
} | ||
|
||
public Entity getRelation() { | ||
return relation; | ||
} | ||
|
||
public List<KeyValue> getProperty() { | ||
return property; | ||
} | ||
|
||
public String getProperty(String key) { | ||
for (KeyValue keyValue : property) { | ||
if (keyValue.getKey().equals(key)) { | ||
return keyValue.getValue(); | ||
} | ||
} | ||
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; | ||
} | ||
|
||
public boolean addImport(String e) { | ||
return _import.add(e); | ||
} | ||
|
||
public boolean removeImport(String o) { | ||
return _import.remove(o); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "\n\t\tAttribute{name=" + name + ", type=" + type + ", isPrimaryKey=" + isPrimaryKey + ", property=" + property + '}'; | ||
} | ||
|
||
} |
99 changes: 99 additions & 0 deletions
99
PayaraStarterGenerator/src/main/java/fish/payara/starter/application/domain/ERModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/** | ||
* Copyright 2024 the original author or authors from the Jeddict project (https://jeddict.github.io/). | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package fish.payara.starter.application.domain; | ||
|
||
/** | ||
* | ||
* @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 = Collections.EMPTY_LIST; | ||
|
||
public void addEntity(Entity entity) { | ||
entities.add(entity); | ||
} | ||
|
||
public Entity getEntity(String entityName) { | ||
for (Entity entity : entities) { | ||
if (entity.getName().equals(entityName)) { | ||
return entity; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public void addRelationship(Relationship relationship) { | ||
relationships.add(relationship); | ||
} | ||
|
||
public List<Entity> getEntities() { | ||
return entities; | ||
} | ||
|
||
public List<Relationship> getRelationships() { | ||
return relationships; | ||
} | ||
|
||
public List<KeyValue> getProperty() { | ||
return property; | ||
} | ||
|
||
public void setProperty(List<KeyValue> property) { | ||
this.property = property; | ||
} | ||
|
||
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 getIcon() { | ||
return getProperty("icon", "circle"); | ||
} | ||
|
||
public String getTitle() { | ||
return getProperty("title", "Jakarta EE Sample"); | ||
} | ||
|
||
public String getLongTitle() { | ||
return getProperty("long-title", getProperty("title", "EE Sample")); | ||
} | ||
|
||
public String getDescription() { | ||
return getProperty("home-page-description", "Unlock the full potential of your application by harnessing the power of Jakarta EE"); | ||
} | ||
|
||
public String getAboutUsDescription() { | ||
return getProperty("about-us-page-description", "Welcome to our About Us page, where innovation meets reliability with Payara Jakarta EE. As a team passionate about delivering unparalleled solutions, we specialize in harnessing the power of Jakarta EE to create robust, scalable, and secure applications. With a deep understanding of enterprise-grade development, we are committed to crafting tailored solutions that drive business growth and exceed client expectations. Backed by years of experience and a dedication to staying at the forefront of technology, we take pride in our ability to transform ideas into reality, empowering businesses to thrive in the digital landscape. Discover more about our journey, expertise, and the vision that propels us forward."); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ERModel{" + "\nentities=" + entities + "\n, relationships=" + relationships + '}'; | ||
} | ||
|
||
} |
Oops, something went wrong.