diff --git a/cobigen/files/CustomerEntity.java b/cobigen/files/CustomerEntity.java deleted file mode 100644 index f16846c6..00000000 --- a/cobigen/files/CustomerEntity.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.example.application.cobigenexample.customermanagement.dataaccess.api; - -import java.sql.Timestamp; - -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name = "Customer") -public class CustomerEntity { - - private String firstname; - - private String lastname; - - private int age; - - /** - * @return the firstname - */ - public String getFirstname() { - return firstname; - } - - /** - * @param firstname the firstname to set - */ - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - /** - * @return the lastname - */ - public String getLastname() { - return lastname; - } - - /** - * @param lastname the lastname to set - */ - public void setLastname(String lastname) { - this.lastname = lastname; - } - - /** - * @return the age - */ - public int getAge() { - return age; - } - - /** - * @param age the age to set - */ - public void setAge(int age) { - this.age = age; - } - -} \ No newline at end of file diff --git a/cobigen/files/Placeholder.java b/cobigen/files/Placeholder.java deleted file mode 100644 index 9b5cedde..00000000 --- a/cobigen/files/Placeholder.java +++ /dev/null @@ -1,9 +0,0 @@ -private int age; -private String company; - -public String getCompany() { - return company; -} -public void setCompany(String company) { - this.company = company; -} \ No newline at end of file diff --git a/cobigen/index.asciidoc b/cobigen/index.asciidoc deleted file mode 100644 index 9cbdad4e..00000000 --- a/cobigen/index.asciidoc +++ /dev/null @@ -1,76 +0,0 @@ -= Generate your Java backend code with devonfw -==== -CobiGen is a generic incremental code generator for end to end code generation tasks. It allows you to build Java, Angular CRUD application code based on the devonfw architecture including all software layers. - -### Prerequisites -* User should have Java development experience - -### Learning goals -* After completing this scenario, you will have learned how to generate an end-to-end Java CRUD application code using devonfw CobiGen. - -More information about CobiGen on https://devonfw.com/website/pages/docs/master-cobigen.asciidoc.html -==== - -[step] --- -restoreDevonfwIde(["java","mvn"]) --- -To begin you need to install CobiGen and create a Java Project. -[step] -== Install CobiGen and create Java Project --- -installCobiGen() -createDevon4jProject("com.example.application.cobigenexample") --- - -Create the entity class which will be passed to the cobigen cli generator later -[step] --- -createFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java", "files/CustomerEntity.java") --- - -Now Build the java project -[step] --- -buildJava("cobigenexample", false) --- - -==== -CobiGen is integrated via plugin in the VS Code IDE. We will use it to generate code from one single java class based on existing templates. -[step] --- -cobiGenJava("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java",[1,3,5,6,8]) --- -The CobiGen code generator will generate some java classes for you. These contain code for basic CRUD operations, REST service handling and data access. - -For example, the following files are generated by CobiGen when using the specified templates: - -(1) CRUD logic: Generates the logic layer and implementations for some use cases. -- `devonfw/workspaces/main/cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/logic/impl/CustomermanagementImpl.java`{{open}} -- `devonfw/workspaces/main/cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/logic/impl/usecase/UcManageCustomerImpl.java`{{open}} -- `devonfw/workspaces/main/cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/logic/impl/usecase/UcFindCustomerImpl.java`{{open}} -- `devonfw/workspaces/main/cobigenexample/api/src/main/java/com/example/application/cobigenexample/customermanagement/logic/api/Customermanagement.java`{{open}} - -(3) CRUD REST services: Generates the service layer with CRUD operations for using in REST services. -- `devonfw/workspaces/main/cobigenexample/api/src/main/java/com/example/application/cobigenexample/customermanagement/service/api/rest/CustomermanagementRestService.java`{{open}} -- `devonfw/workspaces/main/cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/service/impl/rest/CustomermanagementRestServiceImpl.java`{{open}} - -(5) TO's: Generates the related Transfer Objects. -- `devonfw/workspaces/main/cobigenexample/api/src/main/java/com/example/application/cobigenexample/customermanagement/logic/api/to/CustomerEto.java`{{open}} -- `devonfw/workspaces/main/cobigenexample/api/src/main/java/com/example/application/cobigenexample/customermanagement/logic/api/to/CustomerSearchCriteriaTo.java`{{open}} - -(6) Entity infrastructure: Creates the entity main interface and edits (by a merge) the current entity to extend the newly generated classes. -- `devonfw/workspaces/main/cobigenexample/api/src/main/java/com/example/application/cobigenexample/customermanagement/common/api/Customer.java`{{open}} -- `devonfw/workspaces/main/cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java`{{open}} (changed) - -(8) CRUD SpringData Repository: Generates the entity repository (that contains the CRUD operations) in the data access layer. -- `devonfw/workspaces/main/cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/repo/CustomerRepository.java`{{open}} -==== - -Furthermore, we can change the CustomerEntity afterwards and update our source files simply by running cobigen again. -[step] -== Change Entity and run cobigen again --- -changeFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java", { "file": "files/Placeholder.java", "placeholder": "private int age;" }) -cobiGenJava("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java",[1,3,5,6,8]) ---