diff --git a/TelosysTools/telosys-tools.cfg b/TelosysTools/telosys-tools.cfg
index a33236c..79f1421 100644
--- a/TelosysTools/telosys-tools.cfg
+++ b/TelosysTools/telosys-tools.cfg
@@ -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.76
+ProjectVariable.PROJECT_VERSION=0.0.83
ProjectVariable.REST_SERVER_PORT=3000
ProjectVariable.REST_API_ROOT=/api/v1
ProjectVariable.REST_URL_ROOT=http://localhost:3000
diff --git a/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm b/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm
index 9bebacd..a731a39 100644
--- a/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm
+++ b/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm
@@ -30,6 +30,7 @@ import $import;
* @author Telosys Tools Generator
*
*/
+@lombok.EqualsAndHashCode
@JsonFormat(with = JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
public class ${entity.name} implements Serializable {
diff --git a/TelosysTools/templates/infinimotion/backend/pom_xml.vm b/TelosysTools/templates/infinimotion/backend/pom_xml.vm
index 15812a9..623b038 100644
--- a/TelosysTools/templates/infinimotion/backend/pom_xml.vm
+++ b/TelosysTools/templates/infinimotion/backend/pom_xml.vm
@@ -42,6 +42,11 @@
jakarta.ws.rs-api
3.1.0
+
+ org.projectlombok
+ lombok
+ 1.18.32
+
diff --git a/TelosysTools/templates/infinimotion/backend/resource_entity_java.vm b/TelosysTools/templates/infinimotion/backend/resource_entity_java.vm
index d73f590..cb2b11a 100644
--- a/TelosysTools/templates/infinimotion/backend/resource_entity_java.vm
+++ b/TelosysTools/templates/infinimotion/backend/resource_entity_java.vm
@@ -49,6 +49,14 @@ public class ${entity.name}Resource {
return CommandList${entity.name}Response.deserialize(response).getList();
}
+ @POST
+ @Path("/filter")
+ public List<${entity.name}> filter${entity.name}(List filters) throws Exception {
+ CommandList${entity.name} request = new CommandList${entity.name}(filters);
+ 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);
diff --git a/TelosysTools/templates/infinimotion/include/command.vm b/TelosysTools/templates/infinimotion/include/command.vm
index 92705b5..0548f2a 100644
--- a/TelosysTools/templates/infinimotion/include/command.vm
+++ b/TelosysTools/templates/infinimotion/include/command.vm
@@ -11,6 +11,7 @@
package ${target.javaPackageFromFolder("${component}/${SRC}")};
import java.io.Serializable;
+import java.util.List;
/**
* Generated command class for entity "${entity.name}"
@@ -18,6 +19,7 @@ import java.io.Serializable;
* @author Telosys Tools Generator
*
*/
+@lombok.EqualsAndHashCode(callSuper=true)
public class Command${commandType}${entity.name} extends Command implements Serializable {
private static final long serialVersionUID = 1L;
@@ -28,6 +30,9 @@ public class Command${commandType}${entity.name} extends Command implements Seri
#if ( ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
private ${entity.name} entity;
#end
+#if ( ${commandType} == "List" )
+ private List filters;
+#end
//----------------------------------------------------------------------
// CONSTRUCTOR(S)
@@ -64,6 +69,20 @@ public class Command${commandType}${entity.name} extends Command implements Seri
return this.entity;
}
#end
+#if ( ${commandType} == "List" )
+ public Command${commandType}${entity.name}(List filters) {
+ this();
+ this.filters = filters;
+ }
+
+ public void setFilters(List filters) {
+ this.filters = filters;
+ }
+
+ public List getFilters() {
+ return this.filters;
+ }
+#end
public CommandWrapper serialize() throws java.io.IOException {
CommandWrapper wrapper = new CommandWrapper();
@@ -99,6 +118,9 @@ public class Command${commandType}${entity.name} extends Command implements Seri
#end
#if ( ${commandType} == "Create" || ${commandType} == "Update" || ${commandType} == "Delete" )
sb.append("entity=").append(this.entity);
+#end
+#if ( ${commandType} == "List" )
+ sb.append("filters=").append(this.filters);
#end
sb.append("]");
return sb.toString();
diff --git a/TelosysTools/templates/infinimotion/include/command_entity.vm b/TelosysTools/templates/infinimotion/include/command_entity.vm
index 3911d5b..0d762d4 100644
--- a/TelosysTools/templates/infinimotion/include/command_entity.vm
+++ b/TelosysTools/templates/infinimotion/include/command_entity.vm
@@ -29,6 +29,7 @@ import $import;
* @author Telosys Tools Generator
*
*/
+@lombok.EqualsAndHashCode#if( $entity.hasSuperClass() )(callSuper=true)#else #end
public#if( $entity.isAbstract() ) abstract#end class ${entity.name}#if( $entity.hasSuperClass() ) extends $entity.superClass#end implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/TelosysTools/templates/infinimotion/include/command_response.vm b/TelosysTools/templates/infinimotion/include/command_response.vm
index 50b89e0..0bede9f 100644
--- a/TelosysTools/templates/infinimotion/include/command_response.vm
+++ b/TelosysTools/templates/infinimotion/include/command_response.vm
@@ -18,6 +18,7 @@ import java.io.Serializable;
* @author Telosys Tools Generator
*
*/
+@lombok.EqualsAndHashCode(callSuper=true)
public class Command${commandType}${entity.name}Response extends Command implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/TelosysTools/templates/infinimotion/persistence/generic_filter_query_java.vm b/TelosysTools/templates/infinimotion/persistence/generic_filter_query_java.vm
new file mode 100644
index 0000000..fc0bb7a
--- /dev/null
+++ b/TelosysTools/templates/infinimotion/persistence/generic_filter_query_java.vm
@@ -0,0 +1,21 @@
+/*
+ * Java generic filter query interface
+ * Created on $now.date ( $now.time )
+ * Generated by $generator.name ( version $generator.version )
+ */
+package ${target.javaPackageFromFolder("persistence/${SRC}")};
+
+import java.util.List;
+
+/**
+ * Generic filter query interface
+ *
+ * @author Telosys Tools Generator
+ *
+ */
+public interface GenericFilterQuery {
+
+ // Filter: eq;hall.id;int;1
+ List query(Class clazz, List filters);
+
+}
diff --git a/TelosysTools/templates/infinimotion/persistence/persistence_entity_id_java.vm b/TelosysTools/templates/infinimotion/persistence/persistence_entity_id_java.vm
index 329a8de..f8dfaad 100644
--- a/TelosysTools/templates/infinimotion/persistence/persistence_entity_id_java.vm
+++ b/TelosysTools/templates/infinimotion/persistence/persistence_entity_id_java.vm
@@ -28,6 +28,7 @@ import $import;
*
*/
## @Embeddable
+@lombok.EqualsAndHashCode
public class $jpaEntityIdClass implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm
index 8891f6f..5ef2937 100644
--- a/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm
+++ b/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm
@@ -67,6 +67,7 @@ $jpa.entityAnnotations(0, $entity)
#if ( $entity.hasCompositePrimaryKey() )
@IdClass(${jpaEntityIdClass}.class)
#end
+@lombok.EqualsAndHashCode
public class ${entity.name} implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/TelosysTools/templates/infinimotion/persistence/pom_xml.vm b/TelosysTools/templates/infinimotion/persistence/pom_xml.vm
index 6ce82bd..b2e68bb 100644
--- a/TelosysTools/templates/infinimotion/persistence/pom_xml.vm
+++ b/TelosysTools/templates/infinimotion/persistence/pom_xml.vm
@@ -47,6 +47,11 @@
arc
3.28.4
+
+ org.projectlombok
+ lombok
+ 1.18.32
+
diff --git a/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm
index d71c544..a4ce64b 100644
--- a/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm
+++ b/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm
@@ -30,9 +30,12 @@ public class ${entity.name}Processor implements CommandGet${entity.name}Processo
@Inject
EntityManager em;
+ @Inject
+ GenericFilterQuery filterQuery;
+
@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();
+ List<${entity.name}> entities = filterQuery.query(${entity.name}.class, request.getFilters());
return new CommandList${entity.name}Response(entities);
}
diff --git a/TelosysTools/templates/infinimotion/templates.cfg b/TelosysTools/templates/infinimotion/templates.cfg
index 8e35d0f..517fb12 100644
--- a/TelosysTools/templates/infinimotion/templates.cfg
+++ b/TelosysTools/templates/infinimotion/templates.cfg
@@ -53,6 +53,7 @@ Java Persistence Models ; ${BEANNAME}.java ; persis
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 Filter Query Interface ; GenericFilterQuery.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/generic_filter_query_java.vm ; 1
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
@@ -72,4 +73,4 @@ Java CP CreateModels (P) ; CommandCreate${BEANNAME}Processor.java; persis
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
+Maven Persistence pom.xml ; pom.xml ; persistence ; persistence/pom_xml.vm ; 1