generate crud for models
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandCreateKinosaal {
|
||||
name: string {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandCreateKinosaalResponse {
|
||||
hall: Kinosaal {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandDeleteKinosaal {
|
||||
hall: Kinosaal {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandDeleteKinosaalResponse {
|
||||
hall: Kinosaal {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandGetKinosaal {
|
||||
id: int {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandGetKinosaalResponse {
|
||||
hall: Kinosaal {} ;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandListKinosaal {
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandListKinosaalResponse {
|
||||
list: Kinosaal[] {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandUpdateKinosaal {
|
||||
hall: Kinosaal {} ;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#Command
|
||||
@Extends(Command)
|
||||
CommandUpdateKinosaalResponse {
|
||||
hall: Kinosaal {} ;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#BaseModel
|
||||
Eintrittskarte {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
show: Vorstellung { } ;
|
||||
seat: Sitzplatz { } ;
|
||||
code: string { @Unique } ;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#BaseModel
|
||||
Film {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
title: string { @NotNull } ;
|
||||
description: string { @NotNull } ;
|
||||
duration: int { @NotNull } ;
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
#BaseModel
|
||||
Filmkategorie {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
name: string { @NotNull @Unique } ;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
#BaseModel
|
||||
Kartenstatus {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
name: string { @NotNull @Unique } ;
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
#BaseModel
|
||||
Kinosaal {
|
||||
id : int { @Id @AutoIncremented } ;
|
||||
id : int { @Id @AutoIncremented @ObjectType } ;
|
||||
name : string { @NotNull @Unique } ;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
#BaseModel
|
||||
Sitzkategorie {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
name: string { @NotNull @Unique } ;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#BaseModel
|
||||
Sitzplatz {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
row: Sitzreihe { } ;
|
||||
position: int { @NotNull } ;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#BaseModel
|
||||
Sitzreihe {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
hall: Kinosaal { } ;
|
||||
position: int { @NotNull } ;
|
||||
category: Sitzkategorie { } ;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#BaseModel
|
||||
Vorstellung {
|
||||
id: int { @Id @AutoIncremented } ;
|
||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||
hall: Kinosaal { } ;
|
||||
movie: Film { } ;
|
||||
start: date { @NotNull } ;
|
||||
|
||||
@@ -22,7 +22,7 @@ ENTITY_PKG=de.infinimotion.model.bean
|
||||
ProjectVariable.MAVEN_ARTIFACT_ID=model
|
||||
ProjectVariable.MAVEN_GROUP_ID=de.infinimotion
|
||||
ProjectVariable.PROJECT_NAME=infinimodel
|
||||
ProjectVariable.PROJECT_VERSION=0.0.56
|
||||
ProjectVariable.PROJECT_VERSION=0.0.64
|
||||
ProjectVariable.REST_SERVER_PORT=3000
|
||||
ProjectVariable.REST_API_ROOT=/api/v1
|
||||
ProjectVariable.REST_URL_ROOT=http://localhost:3000
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Create" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Delete" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Get" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "List" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Create" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Delete" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Get" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "List" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Update" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Create" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Delete" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Get" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "List" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Update" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "backend" )
|
||||
#set( $commandType = "Update" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -27,6 +27,16 @@
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.enterprise</groupId>
|
||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.ws.rs</groupId>
|
||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Java request reply interface
|
||||
* Created on $now.date ( $now.time )
|
||||
* Generated by $generator.name ( version $generator.version )
|
||||
*/
|
||||
package ${target.javaPackageFromFolder("backend/${SRC}")};
|
||||
|
||||
/**
|
||||
* Request reply interface
|
||||
*
|
||||
* @author Telosys Tools Generator
|
||||
*
|
||||
*/
|
||||
public interface RequestReply {
|
||||
|
||||
CommandWrapper request(CommandWrapper wrapper) throws Exception;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
## --------------------------------------------------
|
||||
#if ( !($entity.hasTag("BaseModel")) )
|
||||
#cancel("Not a Base Model")
|
||||
#end
|
||||
## --------------------------------------------------
|
||||
/*
|
||||
* Java resource class for entity "${entity.name}"
|
||||
* Created on $now.date ( $now.time )
|
||||
* Generated by $generator.name ( version $generator.version )
|
||||
*/
|
||||
package ${target.javaPackageFromFolder("backend/${SRC}")};
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Resource class for entity "${entity.name}"
|
||||
*
|
||||
* @author Telosys Tools Generator
|
||||
*
|
||||
*/
|
||||
@ApplicationScoped
|
||||
@Path("/${fn.toLowerCase( $entity.name )}")
|
||||
public class ${entity.name}Resource {
|
||||
|
||||
@Inject
|
||||
RequestReply requester;
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public ${entity.name} get${entity.name}(@PathParam("id") Integer id) throws Exception {
|
||||
CommandGet${entity.name} request = new CommandGet${entity.name}(id);
|
||||
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
|
||||
return CommandGet${entity.name}Response.deserialize(response).get${entity.name}();
|
||||
}
|
||||
|
||||
@GET
|
||||
public List<${entity.name}> list${entity.name}() throws Exception {
|
||||
CommandList${entity.name} request = new CommandList${entity.name}();
|
||||
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
|
||||
return CommandList${entity.name}Response.deserialize(response).getList();
|
||||
}
|
||||
|
||||
@POST
|
||||
public ${entity.name} create${entity.name}(${entity.name} entity) throws Exception {
|
||||
CommandCreate${entity.name} request = new CommandCreate${entity.name}(entity);
|
||||
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
|
||||
return CommandCreate${entity.name}Response.deserialize(response).get${entity.name}();
|
||||
}
|
||||
|
||||
@PUT
|
||||
public ${entity.name} update${entity.name}(${entity.name} entity) throws Exception {
|
||||
CommandUpdate${entity.name} request = new CommandUpdate${entity.name}(entity);
|
||||
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
|
||||
return CommandUpdate${entity.name}Response.deserialize(response).get${entity.name}();
|
||||
}
|
||||
|
||||
@DELETE
|
||||
public ${entity.name} delete${entity.name}(${entity.name} entity) throws Exception {
|
||||
CommandDelete${entity.name} request = new CommandDelete${entity.name}(entity);
|
||||
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
|
||||
return CommandDelete${entity.name}Response.deserialize(response).get${entity.name}();
|
||||
}
|
||||
|
||||
}
|
||||
106
TelosysTools/templates/infinimotion/include_command.vm
Normal file
106
TelosysTools/templates/infinimotion/include_command.vm
Normal file
@@ -0,0 +1,106 @@
|
||||
## --------------------------------------------------
|
||||
#if ( !($entity.hasTag("BaseModel"))) )
|
||||
#cancel("Not a Base Model")
|
||||
#end
|
||||
## --------------------------------------------------
|
||||
/*
|
||||
* Java generated command class for entity "${entity.name}"
|
||||
* Created on $now.date ( $now.time )
|
||||
* Generated by $generator.name ( version $generator.version )
|
||||
*/
|
||||
package ${target.javaPackageFromFolder("${component}/${SRC}")};
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Generated command class for entity "${entity.name}"
|
||||
*
|
||||
* @author Telosys Tools Generator
|
||||
*
|
||||
*/
|
||||
public class Command${commandType}${entity.name} extends Command implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#if ( ${commandType} == "Get" )
|
||||
private Integer id;
|
||||
#end
|
||||
#if ( ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
|
||||
private ${entity.name} entity;
|
||||
#end
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// CONSTRUCTOR(S)
|
||||
//----------------------------------------------------------------------
|
||||
public Command${commandType}${entity.name}() {
|
||||
super();
|
||||
}
|
||||
|
||||
#if ( ${commandType} == "Get" )
|
||||
public Command${commandType}${entity.name}(Integer id) {
|
||||
this();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
#end
|
||||
#if ( ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
|
||||
public Command${commandType}${entity.name}(${entity.name} entity) {
|
||||
this();
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public void set${entity.name}(${entity.name} entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public ${entity.name} get${entity.name}() {
|
||||
return this.entity;
|
||||
}
|
||||
#end
|
||||
|
||||
public CommandWrapper serialize() throws java.io.IOException {
|
||||
CommandWrapper wrapper = new CommandWrapper();
|
||||
wrapper.setType(Command${commandType}${entity.name}.class.getSimpleName());
|
||||
wrapper.setPayload(OBJECT_MAPPER.writeValueAsBytes(this));
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public static Command${commandType}$entity.name deserialize(CommandWrapper wrapper) throws java.io.IOException {
|
||||
return OBJECT_MAPPER.readValue(wrapper.getPayload(), Command${commandType}${entity.name}.class);
|
||||
}
|
||||
|
||||
public static boolean isType(CommandWrapper wrapper) {
|
||||
return wrapper.getType().equals(Command${commandType}${entity.name}.class.getSimpleName());
|
||||
}
|
||||
|
||||
#if ( $component == "persistence" )
|
||||
@Override
|
||||
public Command process() throws Exception {
|
||||
return jakarta.enterprise.inject.spi.CDI.current().select(Command${commandType}${entity.name}Processor.class).get().processCommand${commandType}${entity.name}(this);
|
||||
}
|
||||
#end
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// toString METHOD
|
||||
//----------------------------------------------------------------------
|
||||
public String toString() {
|
||||
String separator = "|";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("${entity.name}[");
|
||||
#if ( ${commandType} == "Get" )
|
||||
sb.append("id=").append(this.id);
|
||||
#end
|
||||
#if ( ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
|
||||
sb.append("entity=").append(this.entity);
|
||||
#end
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
## --------------------------------------------------
|
||||
#if ( !($entity.hasTag("BaseModel"))) )
|
||||
#cancel("Not a Base Model")
|
||||
#end
|
||||
## --------------------------------------------------
|
||||
/*
|
||||
* Java command processor interface for entity "${entity.name}"
|
||||
* Created on $now.date ( $now.time )
|
||||
* Generated by $generator.name ( version $generator.version )
|
||||
*/
|
||||
package ${target.javaPackageFromFolder("${component}/${SRC}")};
|
||||
|
||||
/**
|
||||
* Command processor interface for entity "${entity.name}"
|
||||
*
|
||||
* @author Telosys Tools Generator
|
||||
*
|
||||
*/
|
||||
public interface Command${commandType}${entity.name}Processor {
|
||||
|
||||
Command processCommand${commandType}${entity.name}(Command${commandType}${entity.name} request) throws Exception;
|
||||
|
||||
}
|
||||
106
TelosysTools/templates/infinimotion/include_command_response.vm
Normal file
106
TelosysTools/templates/infinimotion/include_command_response.vm
Normal file
@@ -0,0 +1,106 @@
|
||||
## --------------------------------------------------
|
||||
#if ( !($entity.hasTag("BaseModel"))) )
|
||||
#cancel("Not a Base Model")
|
||||
#end
|
||||
## --------------------------------------------------
|
||||
/*
|
||||
* Java generated command response class for entity "${entity.name}"
|
||||
* Created on $now.date ( $now.time )
|
||||
* Generated by $generator.name ( version $generator.version )
|
||||
*/
|
||||
package ${target.javaPackageFromFolder("${component}/${SRC}")};
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Generated command response class for entity "${entity.name}"
|
||||
*
|
||||
* @author Telosys Tools Generator
|
||||
*
|
||||
*/
|
||||
public class Command${commandType}${entity.name}Response extends Command implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#if ( ${commandType} == "List" )
|
||||
private java.util.List<${entity.name}> entities;
|
||||
#end
|
||||
#if ( ${commandType} == "Get" || ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
|
||||
private ${entity.name} entity;
|
||||
#end
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// CONSTRUCTOR(S)
|
||||
//----------------------------------------------------------------------
|
||||
public Command${commandType}${entity.name}Response() {
|
||||
super();
|
||||
}
|
||||
|
||||
#if ( ${commandType} == "List" )
|
||||
public Command${commandType}${entity.name}Response(java.util.List<${entity.name}> entities) {
|
||||
this();
|
||||
this.entities = entities;
|
||||
}
|
||||
|
||||
public void setList(java.util.List<${entity.name}> entities) {
|
||||
this.entities = entities;
|
||||
}
|
||||
|
||||
public java.util.List<${entity.name}> getList() {
|
||||
return this.entities;
|
||||
}
|
||||
#end
|
||||
#if ( ${commandType} == "Get" || ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
|
||||
public Command${commandType}${entity.name}Response(${entity.name} entity) {
|
||||
this();
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public void set${entity.name}(${entity.name} entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public ${entity.name} get${entity.name}() {
|
||||
return this.entity;
|
||||
}
|
||||
#end
|
||||
|
||||
public CommandWrapper serialize() throws java.io.IOException {
|
||||
CommandWrapper wrapper = new CommandWrapper();
|
||||
wrapper.setType(Command${commandType}${entity.name}Response.class.getSimpleName());
|
||||
wrapper.setPayload(OBJECT_MAPPER.writeValueAsBytes(this));
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public static Command${commandType}${entity.name}Response deserialize(CommandWrapper wrapper) throws java.io.IOException {
|
||||
return OBJECT_MAPPER.readValue(wrapper.getPayload(), Command${commandType}${entity.name}Response.class);
|
||||
}
|
||||
|
||||
public static boolean isType(CommandWrapper wrapper) {
|
||||
return wrapper.getType().equals(Command${commandType}${entity.name}Response.class.getSimpleName());
|
||||
}
|
||||
|
||||
#if ( $component == "persistence" )
|
||||
@Override
|
||||
public Command process() throws Exception {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
#end
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// toString METHOD
|
||||
//----------------------------------------------------------------------
|
||||
public String toString() {
|
||||
String separator = "|";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("${entity.name}[");
|
||||
#if ( ${commandType} == "List" )
|
||||
sb.append("entities=").append(this.entities);
|
||||
#end
|
||||
#if ( ${commandType} == "Get" || ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
|
||||
sb.append("entity=").append(this.entity);
|
||||
#end
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Create" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Delete" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Get" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "List" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Create" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Delete" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Get" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "List" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Update" )
|
||||
#parse( "include_command_processor.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Create" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Delete" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Get" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "List" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Update" )
|
||||
#parse( "include_command_response.vm" )
|
||||
@@ -0,0 +1,3 @@
|
||||
#set( $component = "persistence" )
|
||||
#set( $commandType = "Update" )
|
||||
#parse( "include_command.vm" )
|
||||
@@ -32,16 +32,16 @@
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.inject</groupId>
|
||||
<artifactId>jakarta.inject-api</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.enterprise</groupId>
|
||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus.arc</groupId>
|
||||
<artifactId>arc</artifactId>
|
||||
<version>3.28.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
## --------------------------------------------------
|
||||
#if ( !($entity.hasTag("BaseModel")) )
|
||||
#cancel("Not a Base Model")
|
||||
#end
|
||||
## --------------------------------------------------
|
||||
/*
|
||||
* Java processor class for entity "${entity.name}"
|
||||
* Created on $now.date ( $now.time )
|
||||
* Generated by $generator.name ( version $generator.version )
|
||||
*/
|
||||
package ${target.javaPackageFromFolder("persistence/${SRC}")};
|
||||
|
||||
import io.quarkus.arc.Unremovable;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Resource class for entity "${entity.name}"
|
||||
*
|
||||
* @author Telosys Tools Generator
|
||||
*
|
||||
*/
|
||||
@Unremovable
|
||||
@ApplicationScoped
|
||||
public class ${entity.name}Processor implements CommandGet${entity.name}Processor, CommandList${entity.name}Processor, CommandCreate${entity.name}Processor, CommandUpdate${entity.name}Processor, CommandDelete${entity.name}Processor {
|
||||
|
||||
@Inject
|
||||
EntityManager em;
|
||||
|
||||
@Override
|
||||
public Command processCommandList${entity.name}(CommandList${entity.name} request) {
|
||||
List<${entity.name}> entities = em.createQuery("SELECT e FROM ${entity.name} e", ${entity.name}.class).getResultList();
|
||||
return new CommandList${entity.name}Response(entities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command processCommandGet${entity.name}(CommandGet${entity.name} request) throws Exception {
|
||||
${entity.name} entity = em.find(${entity.name}.class, request.getId());
|
||||
return new CommandGet${entity.name}Response(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command processCommandCreate${entity.name}(CommandCreate${entity.name} request) {
|
||||
${entity.name} entity = request.get${entity.name}();
|
||||
entity.setId(null);
|
||||
em.persist(entity);
|
||||
return new CommandCreate${entity.name}Response(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command processCommandDelete${entity.name}(CommandDelete${entity.name} request) {
|
||||
Integer id = request.get${entity.name}().getId();
|
||||
${entity.name} entity = em.find(${entity.name}.class, id);
|
||||
em.remove(entity);
|
||||
return new CommandDelete${entity.name}Response(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command processCommandUpdate${entity.name}(CommandUpdate${entity.name} request) {
|
||||
${entity.name} entity = em.merge(request.get${entity.name}());
|
||||
return new CommandUpdate${entity.name}Response(entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,10 +25,51 @@ TypeScript Models ; ${BEANNAME}.ts ; frontend
|
||||
### Backend ###
|
||||
Java Backend Models ; ${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/backend_entity_java.vm
|
||||
Java Command Models (B) ; ${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command_entity_java.vm
|
||||
Java Model Resources ; ${BEANNAME}Resource.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/resource_entity_java.vm
|
||||
Java Request Reply Interface ; RequestReply.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/request_reply_java.vm ; 1
|
||||
|
||||
Java Command GetModels (B) ; CommandGet${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/get_java.vm
|
||||
Java Command ListModels (B) ; CommandList${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/list_java.vm
|
||||
Java Command CreateModels (B) ; CommandCreate${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/create_java.vm
|
||||
Java Command UpdateModels (B) ; CommandUpdate${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/update_java.vm
|
||||
Java Command DeleteModels (B) ; CommandDelete${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/delete_java.vm
|
||||
|
||||
Java CR GetModels (B) ; CommandGet${BEANNAME}Response.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/response_get_java.vm
|
||||
Java CR ListModels (B) ; CommandList${BEANNAME}Response.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/response_list_java.vm
|
||||
Java CR CreateModels (B) ; CommandCreate${BEANNAME}Response.java; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/response_create_java.vm
|
||||
Java CR UpdateModels (B) ; CommandUpdate${BEANNAME}Response.java; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/response_update_java.vm
|
||||
Java CR DeleteModels (B) ; CommandDelete${BEANNAME}Response.java; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/response_delete_java.vm
|
||||
|
||||
Java CP GetModels (B) ; CommandGet${BEANNAME}Processor.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/processor_get_java.vm
|
||||
Java CP ListModels (B) ; CommandList${BEANNAME}Processor.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/processor_list_java.vm
|
||||
Java CP CreateModels (B) ; CommandCreate${BEANNAME}Processor.java; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/processor_create_java.vm
|
||||
Java CP UpdateModels (B) ; CommandUpdate${BEANNAME}Processor.java; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/processor_update_java.vm
|
||||
Java CP DeleteModels (B) ; CommandDelete${BEANNAME}Processor.java; backend/${SRC}/${ROOT_PKG}/backend ; backend/command/processor_delete_java.vm
|
||||
|
||||
Maven Backend pom.xml ; pom.xml ; backend ; backend/pom_xml.vm ; 1
|
||||
|
||||
### Persistence ###
|
||||
Java Persistence Models ; ${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/persistence_entity_java.vm
|
||||
Java Command Models (P) ; ${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command_entity_java.vm
|
||||
Java Command Processors (P) ; ${BEANNAME}Processor.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command_processor_java.vm
|
||||
Java Model Processors ; ${BEANNAME}Processor.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/processor_entity_java.vm
|
||||
|
||||
Java Command GetModels (P) ; CommandGet${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/get_java.vm
|
||||
Java Command ListModels (P) ; CommandList${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/list_java.vm
|
||||
Java Command CreateModels (P) ; CommandCreate${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/create_java.vm
|
||||
Java Command UpdateModels (P) ; CommandUpdate${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/update_java.vm
|
||||
Java Command DeleteModels (P) ; CommandDelete${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/delete_java.vm
|
||||
|
||||
Java CR GetModels (B) ; CommandGet${BEANNAME}Response.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/response_get_java.vm
|
||||
Java CR ListModels (B) ; CommandList${BEANNAME}Response.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/response_list_java.vm
|
||||
Java CR CreateModels (B) ; CommandCreate${BEANNAME}Response.java; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/response_create_java.vm
|
||||
Java CR UpdateModels (B) ; CommandUpdate${BEANNAME}Response.java; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/response_update_java.vm
|
||||
Java CR DeleteModels (B) ; CommandDelete${BEANNAME}Response.java; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/response_delete_java.vm
|
||||
|
||||
Java CP GetModels (P) ; CommandGet${BEANNAME}Processor.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/processor_get_java.vm
|
||||
Java CP ListModels (P) ; CommandList${BEANNAME}Processor.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/processor_list_java.vm
|
||||
Java CP CreateModels (P) ; CommandCreate${BEANNAME}Processor.java; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/processor_create_java.vm
|
||||
Java CP UpdateModels (P) ; CommandUpdate${BEANNAME}Processor.java; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/processor_update_java.vm
|
||||
Java CP DeleteModels (P) ; CommandDelete${BEANNAME}Processor.java; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/processor_delete_java.vm
|
||||
|
||||
Maven Persistence pom.xml ; pom.xml ; persistence ; persistence/pom_xml.vm ; 1
|
||||
|
||||
Reference in New Issue
Block a user