{{ 'codbex-partners:codbex-partners-model.t.CUSTOMER_ADDRESS' | t }}
diff --git a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/controller.js b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/controller.js
index 13b7765..ea0ef11 100644
--- a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Manufacturers/ManufacturerContactController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerContactController';
}])
.controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/dialog-window/controller.js b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/dialog-window/controller.js
index f8da0d9..e469a4e 100644
--- a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/dialog-window/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/ManufacturerContact/dialog-window/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Manufacturers/ManufacturerContactController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerContactController';
}])
.controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/controller.js b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/controller.js
index da5c058..aca31b6 100644
--- a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Manufacturers/ManufacturerController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerController';
}])
.controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/dialog-window/controller.js b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/dialog-window/controller.js
index 820f5c1..04e1a25 100644
--- a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/dialog-window/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/dialog-window/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Manufacturers/ManufacturerController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerController';
}])
.controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/main-details/controller.js b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/main-details/controller.js
index 507b22c..c66e665 100644
--- a/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/main-details/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Manufacturers/Manufacturer/main-details/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(["EntityServiceProvider", (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Manufacturers/ManufacturerController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerController';
}])
.controller('PageController', ($scope, $http, Extensions, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/controller.js
index a78023a..030c38e 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierContactController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierContactController';
}])
.controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/dialog-window/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/dialog-window/controller.js
index 3da8de8..56e269c 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/dialog-window/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierContact/dialog-window/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierContactController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierContactController';
}])
.controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/controller.js
index 81a244f..4dea660 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierNoteController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierNoteController';
}])
.controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/dialog-window/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/dialog-window/controller.js
index bfcaf1c..e93a8ad 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/dialog-window/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/SupplierNote/dialog-window/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierNoteController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierNoteController';
}])
.controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/controller.js
index aac1d13..f1ad545 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierController';
}])
.controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/dialog-window/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/dialog-window/controller.js
index a900c2a..1d429f8 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/dialog-window/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/dialog-window/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(['EntityServiceProvider', (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierController';
}])
.controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/main-details/controller.js b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/main-details/controller.js
index 27d6b5d..74c5b17 100644
--- a/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/main-details/controller.js
+++ b/codbex-partners/gen/codbex-partners/ui/Suppliers/Supplier/main-details/controller.js
@@ -1,6 +1,6 @@
angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService'])
.config(["EntityServiceProvider", (EntityServiceProvider) => {
- EntityServiceProvider.baseUrl = '/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts';
+ EntityServiceProvider.baseUrl = '/services/java/codbex-partners/gen/codbex_partners/api/suppliers/SupplierController';
}])
.controller('PageController', ($scope, $http, Extensions, LocaleService, EntityService) => {
const Dialogs = new DialogHub();
diff --git a/codbex-partners/gen/codbex_partners/api/customers/CustomerContactController.java b/codbex-partners/gen/codbex_partners/api/customers/CustomerContactController.java
new file mode 100644
index 0000000..e9a248e
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/customers/CustomerContactController.java
@@ -0,0 +1,199 @@
+package gen.codbex_partners.api.customers;
+
+import gen.codbex_partners.data.customers.CustomerContactEntity;
+import gen.codbex_partners.data.customers.CustomerContactRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - CustomerContact Controller")
+public class CustomerContactController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "Customer", "Name", "Designation", "Email", "Phone", "CreatedAt", "CreatedBy");
+
+ @Inject
+ private CustomerContactRepository repository;
+
+ @Get
+ @Documentation("List CustomerContact")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset,
+ @QueryParam("Customer") String Customer) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result;
+ if (Customer != null) {
+ Map params = new LinkedHashMap<>();
+ params.put("Customer", Customer);
+ result = repository.query("from CustomerContactEntity e where e.Customer = :Customer", params);
+ } else {
+ result = repository.findAll(actualLimit, actualOffset);
+ }
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count CustomerContact")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count CustomerContact with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search CustomerContact")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get CustomerContact by id")
+ public CustomerContactEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ CustomerContactEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "CustomerContact not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create CustomerContact")
+ public CustomerContactEntity create(@Body CustomerContactEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update CustomerContact by id")
+ public CustomerContactEntity update(@PathParam("id") Integer id, @Body CustomerContactEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete CustomerContact by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "CustomerContact not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from CustomerContactEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Customers.CustomerContactReadOnly") || UserFacade.isInRole("codbex-partners.Customers.CustomerContactFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Customers.CustomerContactFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(CustomerContactEntity entity) {
+ if (entity.Name == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' property is required");
+ }
+ if (entity.Name != null && entity.Name.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 255");
+ }
+ if (entity.Designation == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Designation' property is required");
+ }
+ if (entity.Designation != null && entity.Designation.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Designation' exceeds the maximum length of 255");
+ }
+ if (entity.Email == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required");
+ }
+ if (entity.Email != null && entity.Email.length() > 100) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 100");
+ }
+ if (entity.Phone == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' property is required");
+ }
+ if (entity.Phone != null && entity.Phone.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' exceeds the maximum length of 15");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/customers/CustomerController.java b/codbex-partners/gen/codbex_partners/api/customers/CustomerController.java
new file mode 100644
index 0000000..7422ce7
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/customers/CustomerController.java
@@ -0,0 +1,233 @@
+package gen.codbex_partners.api.customers;
+
+import gen.codbex_partners.data.customers.CustomerEntity;
+import gen.codbex_partners.data.customers.CustomerRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - Customer Controller")
+public class CustomerController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "FirstName", "LastName", "LegalEntityName", "Name", "Email", "Phone", "Country", "City", "Fax", "Address", "PostalCode", "TIN", "IBAN", "ResponsiblePerson", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy");
+
+ @Inject
+ private CustomerRepository repository;
+
+ @Get
+ @Documentation("List Customer")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result = repository.findAll(actualLimit, actualOffset);
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count Customer")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count Customer with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search Customer")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get Customer by id")
+ public CustomerEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ CustomerEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Customer not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create Customer")
+ public CustomerEntity create(@Body CustomerEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update Customer by id")
+ public CustomerEntity update(@PathParam("id") Integer id, @Body CustomerEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete Customer by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Customer not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from CustomerEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Customers.CustomerReadOnly") || UserFacade.isInRole("codbex-partners.Customers.CustomerFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Customers.CustomerFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(CustomerEntity entity) {
+ if (entity.FirstName != null && entity.FirstName.length() > 50) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'FirstName' exceeds the maximum length of 50");
+ }
+ if (entity.LastName != null && entity.LastName.length() > 50) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LastName' exceeds the maximum length of 50");
+ }
+ if (entity.LegalEntityName != null && entity.LegalEntityName.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LegalEntityName' exceeds the maximum length of 255");
+ }
+ if (entity.Name != null && entity.Name.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 255");
+ }
+ if (entity.Email == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required");
+ }
+ if (entity.Email != null && entity.Email.length() > 100) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 100");
+ }
+ if (entity.Phone == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' property is required");
+ }
+ if (entity.Phone != null && entity.Phone.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' exceeds the maximum length of 15");
+ }
+ if (entity.Country == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Country' property is required");
+ }
+ if (entity.City == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'City' property is required");
+ }
+ if (entity.Fax != null && entity.Fax.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Fax' exceeds the maximum length of 20");
+ }
+ if (entity.Address == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Address' property is required");
+ }
+ if (entity.Address != null && entity.Address.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Address' exceeds the maximum length of 255");
+ }
+ if (entity.PostalCode == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PostalCode' property is required");
+ }
+ if (entity.PostalCode != null && entity.PostalCode.length() > 10) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PostalCode' exceeds the maximum length of 10");
+ }
+ if (entity.TIN == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'TIN' property is required");
+ }
+ if (entity.TIN != null && entity.TIN.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'TIN' exceeds the maximum length of 15");
+ }
+ if (entity.IBAN == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'IBAN' property is required");
+ }
+ if (entity.IBAN != null && entity.IBAN.length() > 34) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'IBAN' exceeds the maximum length of 34");
+ }
+ if (entity.IBAN != null && !entity.IBAN.toString().matches("^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$")) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The value of 'IBAN' does not match the required pattern '^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$'");
+ }
+ if (entity.ResponsiblePerson != null && entity.ResponsiblePerson.length() > 150) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'ResponsiblePerson' exceeds the maximum length of 150");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ if (entity.UpdatedBy != null && entity.UpdatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'UpdatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/customers/CustomerNoteController.java b/codbex-partners/gen/codbex_partners/api/customers/CustomerNoteController.java
new file mode 100644
index 0000000..815abb9
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/customers/CustomerNoteController.java
@@ -0,0 +1,184 @@
+package gen.codbex_partners.api.customers;
+
+import gen.codbex_partners.data.customers.CustomerNoteEntity;
+import gen.codbex_partners.data.customers.CustomerNoteRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - CustomerNote Controller")
+public class CustomerNoteController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "Customer", "Note", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy");
+
+ @Inject
+ private CustomerNoteRepository repository;
+
+ @Get
+ @Documentation("List CustomerNote")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset,
+ @QueryParam("Customer") String Customer) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result;
+ if (Customer != null) {
+ Map params = new LinkedHashMap<>();
+ params.put("Customer", Customer);
+ result = repository.query("from CustomerNoteEntity e where e.Customer = :Customer", params);
+ } else {
+ result = repository.findAll(actualLimit, actualOffset);
+ }
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count CustomerNote")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count CustomerNote with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search CustomerNote")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get CustomerNote by id")
+ public CustomerNoteEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ CustomerNoteEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "CustomerNote not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create CustomerNote")
+ public CustomerNoteEntity create(@Body CustomerNoteEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update CustomerNote by id")
+ public CustomerNoteEntity update(@PathParam("id") Integer id, @Body CustomerNoteEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete CustomerNote by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "CustomerNote not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from CustomerNoteEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Customers.CustomerNoteReadOnly") || UserFacade.isInRole("codbex-partners.Customers.CustomerNoteFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Customers.CustomerNoteFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(CustomerNoteEntity entity) {
+ if (entity.Note == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Note' property is required");
+ }
+ if (entity.Note != null && entity.Note.length() > 5000) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Note' exceeds the maximum length of 5000");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ if (entity.UpdatedBy != null && entity.UpdatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'UpdatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerContactController.java b/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerContactController.java
new file mode 100644
index 0000000..9a5b2a5
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerContactController.java
@@ -0,0 +1,182 @@
+package gen.codbex_partners.api.manufacturers;
+
+import gen.codbex_partners.data.manufacturers.ManufacturerContactEntity;
+import gen.codbex_partners.data.manufacturers.ManufacturerContactRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - ManufacturerContact Controller")
+public class ManufacturerContactController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "Manufacturer", "Name", "Designation", "Email", "Phone", "CreatedAt", "CreatedBy");
+
+ @Inject
+ private ManufacturerContactRepository repository;
+
+ @Get
+ @Documentation("List ManufacturerContact")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset,
+ @QueryParam("Manufacturer") String Manufacturer) {
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result;
+ if (Manufacturer != null) {
+ Map params = new LinkedHashMap<>();
+ params.put("Manufacturer", Manufacturer);
+ result = repository.query("from ManufacturerContactEntity e where e.Manufacturer = :Manufacturer", params);
+ } else {
+ result = repository.findAll(actualLimit, actualOffset);
+ }
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count ManufacturerContact")
+ public Map count() {
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count ManufacturerContact with filter")
+ public Map countWithFilter(@Body Map filter) {
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search ManufacturerContact")
+ public List search(@Body Map filter) {
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get ManufacturerContact by id")
+ public ManufacturerContactEntity getById(@PathParam("id") Integer id) {
+ ManufacturerContactEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "ManufacturerContact not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create ManufacturerContact")
+ public ManufacturerContactEntity create(@Body ManufacturerContactEntity entity) {
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update ManufacturerContact by id")
+ public ManufacturerContactEntity update(@PathParam("id") Integer id, @Body ManufacturerContactEntity entity) {
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete ManufacturerContact by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "ManufacturerContact not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from ManufacturerContactEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private static void validate(ManufacturerContactEntity entity) {
+ if (entity.Name == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' property is required");
+ }
+ if (entity.Name != null && entity.Name.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 255");
+ }
+ if (entity.Designation == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Designation' property is required");
+ }
+ if (entity.Designation != null && entity.Designation.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Designation' exceeds the maximum length of 255");
+ }
+ if (entity.Email == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required");
+ }
+ if (entity.Email != null && entity.Email.length() > 100) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 100");
+ }
+ if (entity.Phone == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' property is required");
+ }
+ if (entity.Phone != null && entity.Phone.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' exceeds the maximum length of 15");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerController.java b/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerController.java
new file mode 100644
index 0000000..2adad68
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerController.java
@@ -0,0 +1,215 @@
+package gen.codbex_partners.api.manufacturers;
+
+import gen.codbex_partners.data.manufacturers.ManufacturerEntity;
+import gen.codbex_partners.data.manufacturers.ManufacturerRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - Manufacturer Controller")
+public class ManufacturerController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "FirstName", "LastName", "LegalEntityName", "Name", "Email", "Phone", "Fax", "TIN", "IBAN", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy");
+
+ @Inject
+ private ManufacturerRepository repository;
+
+ @Get
+ @Documentation("List Manufacturer")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result = repository.findAll(actualLimit, actualOffset);
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count Manufacturer")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count Manufacturer with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search Manufacturer")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get Manufacturer by id")
+ public ManufacturerEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ ManufacturerEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Manufacturer not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create Manufacturer")
+ public ManufacturerEntity create(@Body ManufacturerEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update Manufacturer by id")
+ public ManufacturerEntity update(@PathParam("id") Integer id, @Body ManufacturerEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete Manufacturer by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Manufacturer not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from ManufacturerEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Manufacturers.ManufacturerReadOnly") || UserFacade.isInRole("codbex-partners.Manufacturers.ManufacturerFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Manufacturers.ManufacturerFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(ManufacturerEntity entity) {
+ if (entity.FirstName != null && entity.FirstName.length() > 50) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'FirstName' exceeds the maximum length of 50");
+ }
+ if (entity.LastName != null && entity.LastName.length() > 50) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LastName' exceeds the maximum length of 50");
+ }
+ if (entity.LegalEntityName != null && entity.LegalEntityName.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LegalEntityName' exceeds the maximum length of 255");
+ }
+ if (entity.Name != null && entity.Name.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 255");
+ }
+ if (entity.Email == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required");
+ }
+ if (entity.Email != null && entity.Email.length() > 100) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 100");
+ }
+ if (entity.Phone == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' property is required");
+ }
+ if (entity.Phone != null && entity.Phone.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' exceeds the maximum length of 15");
+ }
+ if (entity.Fax == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Fax' property is required");
+ }
+ if (entity.Fax != null && entity.Fax.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Fax' exceeds the maximum length of 20");
+ }
+ if (entity.TIN == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'TIN' property is required");
+ }
+ if (entity.TIN != null && entity.TIN.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'TIN' exceeds the maximum length of 15");
+ }
+ if (entity.IBAN == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'IBAN' property is required");
+ }
+ if (entity.IBAN != null && entity.IBAN.length() > 34) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'IBAN' exceeds the maximum length of 34");
+ }
+ if (entity.IBAN != null && !entity.IBAN.toString().matches("^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$")) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The value of 'IBAN' does not match the required pattern '^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$'");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ if (entity.UpdatedBy != null && entity.UpdatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'UpdatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerNoteController.java b/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerNoteController.java
new file mode 100644
index 0000000..70c1fec
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/manufacturers/ManufacturerNoteController.java
@@ -0,0 +1,176 @@
+package gen.codbex_partners.api.manufacturers;
+
+import gen.codbex_partners.data.manufacturers.ManufacturerNoteEntity;
+import gen.codbex_partners.data.manufacturers.ManufacturerNoteRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - ManufacturerNote Controller")
+public class ManufacturerNoteController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "Manufacturer", "Note", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy");
+
+ @Inject
+ private ManufacturerNoteRepository repository;
+
+ @Get
+ @Documentation("List ManufacturerNote")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result = repository.findAll(actualLimit, actualOffset);
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count ManufacturerNote")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count ManufacturerNote with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search ManufacturerNote")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get ManufacturerNote by id")
+ public ManufacturerNoteEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ ManufacturerNoteEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "ManufacturerNote not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create ManufacturerNote")
+ public ManufacturerNoteEntity create(@Body ManufacturerNoteEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update ManufacturerNote by id")
+ public ManufacturerNoteEntity update(@PathParam("id") Integer id, @Body ManufacturerNoteEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete ManufacturerNote by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "ManufacturerNote not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from ManufacturerNoteEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Manufacturers.ManufacturerNoteReadOnly") || UserFacade.isInRole("codbex-partners.Manufacturers.ManufacturerNoteFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Manufacturers.ManufacturerNoteFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(ManufacturerNoteEntity entity) {
+ if (entity.Note == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Note' property is required");
+ }
+ if (entity.Note != null && entity.Note.length() > 5000) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Note' exceeds the maximum length of 5000");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ if (entity.UpdatedBy != null && entity.UpdatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'UpdatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/suppliers/SupplierContactController.java b/codbex-partners/gen/codbex_partners/api/suppliers/SupplierContactController.java
new file mode 100644
index 0000000..84d84b7
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/suppliers/SupplierContactController.java
@@ -0,0 +1,182 @@
+package gen.codbex_partners.api.suppliers;
+
+import gen.codbex_partners.data.suppliers.SupplierContactEntity;
+import gen.codbex_partners.data.suppliers.SupplierContactRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - SupplierContact Controller")
+public class SupplierContactController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "Supplier", "Name", "Designation", "Email", "Phone", "CreatedAt", "CreatedBy");
+
+ @Inject
+ private SupplierContactRepository repository;
+
+ @Get
+ @Documentation("List SupplierContact")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset,
+ @QueryParam("Supplier") String Supplier) {
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result;
+ if (Supplier != null) {
+ Map params = new LinkedHashMap<>();
+ params.put("Supplier", Supplier);
+ result = repository.query("from SupplierContactEntity e where e.Supplier = :Supplier", params);
+ } else {
+ result = repository.findAll(actualLimit, actualOffset);
+ }
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count SupplierContact")
+ public Map count() {
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count SupplierContact with filter")
+ public Map countWithFilter(@Body Map filter) {
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search SupplierContact")
+ public List search(@Body Map filter) {
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get SupplierContact by id")
+ public SupplierContactEntity getById(@PathParam("id") Integer id) {
+ SupplierContactEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "SupplierContact not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create SupplierContact")
+ public SupplierContactEntity create(@Body SupplierContactEntity entity) {
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update SupplierContact by id")
+ public SupplierContactEntity update(@PathParam("id") Integer id, @Body SupplierContactEntity entity) {
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete SupplierContact by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "SupplierContact not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from SupplierContactEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private static void validate(SupplierContactEntity entity) {
+ if (entity.Name == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' property is required");
+ }
+ if (entity.Name != null && entity.Name.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 255");
+ }
+ if (entity.Designation == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Designation' property is required");
+ }
+ if (entity.Designation != null && entity.Designation.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Designation' exceeds the maximum length of 255");
+ }
+ if (entity.Email == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required");
+ }
+ if (entity.Email != null && entity.Email.length() > 100) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 100");
+ }
+ if (entity.Phone == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' property is required");
+ }
+ if (entity.Phone != null && entity.Phone.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' exceeds the maximum length of 15");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/suppliers/SupplierController.java b/codbex-partners/gen/codbex_partners/api/suppliers/SupplierController.java
new file mode 100644
index 0000000..085e67e
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/suppliers/SupplierController.java
@@ -0,0 +1,215 @@
+package gen.codbex_partners.api.suppliers;
+
+import gen.codbex_partners.data.suppliers.SupplierEntity;
+import gen.codbex_partners.data.suppliers.SupplierRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - Supplier Controller")
+public class SupplierController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "FirstName", "LastName", "LegalEntityName", "Name", "Email", "Phone", "Fax", "TIN", "IBAN", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy");
+
+ @Inject
+ private SupplierRepository repository;
+
+ @Get
+ @Documentation("List Supplier")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result = repository.findAll(actualLimit, actualOffset);
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count Supplier")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count Supplier with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search Supplier")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get Supplier by id")
+ public SupplierEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ SupplierEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Supplier not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create Supplier")
+ public SupplierEntity create(@Body SupplierEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update Supplier by id")
+ public SupplierEntity update(@PathParam("id") Integer id, @Body SupplierEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete Supplier by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Supplier not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from SupplierEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Suppliers.SupplierReadOnly") || UserFacade.isInRole("codbex-partners.Suppliers.SupplierFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Suppliers.SupplierFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(SupplierEntity entity) {
+ if (entity.FirstName != null && entity.FirstName.length() > 50) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'FirstName' exceeds the maximum length of 50");
+ }
+ if (entity.LastName != null && entity.LastName.length() > 50) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LastName' exceeds the maximum length of 50");
+ }
+ if (entity.LegalEntityName != null && entity.LegalEntityName.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LegalEntityName' exceeds the maximum length of 255");
+ }
+ if (entity.Name != null && entity.Name.length() > 255) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 255");
+ }
+ if (entity.Email == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required");
+ }
+ if (entity.Email != null && entity.Email.length() > 100) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 100");
+ }
+ if (entity.Phone == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' property is required");
+ }
+ if (entity.Phone != null && entity.Phone.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Phone' exceeds the maximum length of 15");
+ }
+ if (entity.Fax == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Fax' property is required");
+ }
+ if (entity.Fax != null && entity.Fax.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Fax' exceeds the maximum length of 20");
+ }
+ if (entity.TIN == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'TIN' property is required");
+ }
+ if (entity.TIN != null && entity.TIN.length() > 15) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'TIN' exceeds the maximum length of 15");
+ }
+ if (entity.IBAN == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'IBAN' property is required");
+ }
+ if (entity.IBAN != null && entity.IBAN.length() > 34) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'IBAN' exceeds the maximum length of 34");
+ }
+ if (entity.IBAN != null && !entity.IBAN.toString().matches("^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$")) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The value of 'IBAN' does not match the required pattern '^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$'");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ if (entity.UpdatedBy != null && entity.UpdatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'UpdatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/api/suppliers/SupplierNoteController.java b/codbex-partners/gen/codbex_partners/api/suppliers/SupplierNoteController.java
new file mode 100644
index 0000000..74fd90c
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/api/suppliers/SupplierNoteController.java
@@ -0,0 +1,184 @@
+package gen.codbex_partners.api.suppliers;
+
+import gen.codbex_partners.data.suppliers.SupplierNoteEntity;
+import gen.codbex_partners.data.suppliers.SupplierNoteRepository;
+
+import org.eclipse.dirigible.components.api.security.UserFacade;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.component.Inject;
+import org.eclipse.dirigible.sdk.http.Body;
+import org.eclipse.dirigible.sdk.http.Controller;
+import org.eclipse.dirigible.sdk.http.Delete;
+import org.eclipse.dirigible.sdk.http.Get;
+import org.eclipse.dirigible.sdk.http.PathParam;
+import org.eclipse.dirigible.sdk.http.Post;
+import org.eclipse.dirigible.sdk.http.Put;
+import org.eclipse.dirigible.sdk.http.QueryParam;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@Controller
+@Documentation("codbex-partners - SupplierNote Controller")
+public class SupplierNoteController {
+
+ private static final Set FILTER_FIELDS = Set.of("Id", "Supplier", "Note", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy");
+
+ @Inject
+ private SupplierNoteRepository repository;
+
+ @Get
+ @Documentation("List SupplierNote")
+ public List getAll(@QueryParam("$limit") Integer limit,
+ @QueryParam("$offset") Integer offset,
+ @QueryParam("Supplier") String Supplier) {
+ checkPermissions("read");
+ int actualLimit = limit != null ? limit.intValue() : 20;
+ int actualOffset = offset != null ? offset.intValue() : 0;
+ List result;
+ if (Supplier != null) {
+ Map params = new LinkedHashMap<>();
+ params.put("Supplier", Supplier);
+ result = repository.query("from SupplierNoteEntity e where e.Supplier = :Supplier", params);
+ } else {
+ result = repository.findAll(actualLimit, actualOffset);
+ }
+ return result;
+ }
+
+ @Get("/count")
+ @Documentation("Count SupplierNote")
+ public Map count() {
+ checkPermissions("read");
+ return Map.of("count", repository.count());
+ }
+
+ @Post("/count")
+ @Documentation("Count SupplierNote with filter")
+ public Map countWithFilter(@Body Map filter) {
+ checkPermissions("read");
+ return Map.of("count", (long) runFilter(filter).size());
+ }
+
+ @Post("/search")
+ @Documentation("Search SupplierNote")
+ public List search(@Body Map filter) {
+ checkPermissions("read");
+ List result = runFilter(filter);
+ return result;
+ }
+
+ @Get("/{id}")
+ @Documentation("Get SupplierNote by id")
+ public SupplierNoteEntity getById(@PathParam("id") Integer id) {
+ checkPermissions("read");
+ SupplierNoteEntity entity = repository.findOne(id)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "SupplierNote not found"));
+ return entity;
+ }
+
+ @Post
+ @Documentation("Create SupplierNote")
+ public SupplierNoteEntity create(@Body SupplierNoteEntity entity) {
+ checkPermissions("write");
+ validate(entity);
+ return repository.save(entity);
+ }
+
+ @Put("/{id}")
+ @Documentation("Update SupplierNote by id")
+ public SupplierNoteEntity update(@PathParam("id") Integer id, @Body SupplierNoteEntity entity) {
+ checkPermissions("write");
+ entity.Id = id;
+ validate(entity);
+ return repository.update(entity);
+ }
+
+ @Delete("/{id}")
+ @Documentation("Delete SupplierNote by id")
+ public void deleteById(@PathParam("id") Integer id) {
+ checkPermissions("write");
+ if (repository.findOne(id).isEmpty()) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "SupplierNote not found");
+ }
+ repository.deleteById(id);
+ }
+
+ private List runFilter(Map filter) {
+ StringBuilder hql = new StringBuilder("from SupplierNoteEntity e");
+ Map params = new LinkedHashMap<>();
+ boolean first = true;
+ if (filter != null && filter.get("equals") instanceof Map, ?> equals) {
+ for (Map.Entry, ?> entry : equals.entrySet()) {
+ String field = requireKnownField(String.valueOf(entry.getKey()));
+ String paramName = "p" + params.size();
+ hql.append(first ? " where e." : " and e.").append(field).append(" = :").append(paramName);
+ params.put(paramName, entry.getValue());
+ first = false;
+ }
+ }
+ if (filter != null && filter.get("conditions") instanceof List> conditions) {
+ for (Object raw : conditions) {
+ if (!(raw instanceof Map, ?> condition)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid filter condition");
+ }
+ String field = requireKnownField(String.valueOf(condition.get("propertyName")));
+ String operator = String.valueOf(condition.get("operator")).toUpperCase(Locale.ROOT);
+ Object value = condition.get("value");
+ String paramName = "p" + params.size();
+ String clause = switch (operator) {
+ case "EQ" -> "e." + field + " = :" + paramName;
+ case "IN" -> {
+ if (!(value instanceof Collection>)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "IN value must be a list for field: " + field);
+ }
+ yield "e." + field + " in (:" + paramName + ")";
+ }
+ case "LIKE" -> "e." + field + " like :" + paramName;
+ default -> throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported operator: " + operator);
+ };
+ hql.append(first ? " where " : " and ").append(clause);
+ params.put(paramName, value);
+ first = false;
+ }
+ }
+ return repository.query(hql.toString(), params);
+ }
+
+ private static String requireKnownField(String field) {
+ if (!FILTER_FIELDS.contains(field)) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown filter field: " + field);
+ }
+ return field;
+ }
+
+ private void checkPermissions(String op) {
+ if ("read".equals(op) && !(UserFacade.isInRole("codbex-partners.Suppliers.SupplierNoteReadOnly") || UserFacade.isInRole("codbex-partners.Suppliers.SupplierNoteFullAccess"))) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ if ("write".equals(op) && !UserFacade.isInRole("codbex-partners.Suppliers.SupplierNoteFullAccess")) {
+ throw new ResponseStatusException(HttpStatus.FORBIDDEN);
+ }
+ }
+
+ private static void validate(SupplierNoteEntity entity) {
+ if (entity.Note == null) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Note' property is required");
+ }
+ if (entity.Note != null && entity.Note.length() > 5000) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Note' exceeds the maximum length of 5000");
+ }
+ if (entity.CreatedBy != null && entity.CreatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'CreatedBy' exceeds the maximum length of 20");
+ }
+ if (entity.UpdatedBy != null && entity.UpdatedBy.length() > 20) {
+ throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'UpdatedBy' exceeds the maximum length of 20");
+ }
+ }
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Customers/Customer.extensionpoint b/codbex-partners/gen/codbex_partners/data/customers/Customer.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Customers/Customer.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/customers/Customer.extensionpoint
index ea09d03..d435e56 100644
--- a/codbex-partners/gen/codbex-partners/data/Customers/Customer.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/customers/Customer.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Customers-Customer",
"description": "Extension Point for the codbex-partners-Customers-Customer entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Customers/CustomerContact.extensionpoint b/codbex-partners/gen/codbex_partners/data/customers/CustomerContact.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Customers/CustomerContact.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/customers/CustomerContact.extensionpoint
index 30191ad..8e5593f 100644
--- a/codbex-partners/gen/codbex-partners/data/Customers/CustomerContact.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerContact.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Customers-CustomerContact",
"description": "Extension Point for the codbex-partners-Customers-CustomerContact entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex_partners/data/customers/CustomerContactEntity.java b/codbex-partners/gen/codbex_partners/data/customers/CustomerContactEntity.java
new file mode 100644
index 0000000..1aa3655
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerContactEntity.java
@@ -0,0 +1,56 @@
+package gen.codbex_partners.data.customers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_CUSTOMERCONTACT")
+@Documentation("CustomerContact entity mapping")
+public class CustomerContactEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "CUSTOMERCONTACT_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "CUSTOMERCONTACT_CUSTOMER", nullable = true)
+ @Documentation("Customer")
+ public Integer Customer;
+
+ @Column(name = "CUSTOMERCONTACT_NAME", length = 255, nullable = false)
+ @Documentation("Name")
+ public String Name;
+
+ @Column(name = "CUSTOMERCONTACT_DESIGNATION", length = 255, nullable = false)
+ @Documentation("Designation")
+ public String Designation;
+
+ @Column(name = "CUSTOMERCONTACT_EMAIL", length = 100, nullable = false, unique = true)
+ @Documentation("Email")
+ public String Email;
+
+ @Column(name = "CUSTOMERCONTACT_PHONE", length = 15, nullable = false)
+ @Documentation("Phone")
+ public String Phone;
+
+ @CreatedAt
+ @Column(name = "CUSTOMERCONTACT_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "CUSTOMERCONTACT_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex_partners/data/customers/CustomerContactRepository.java b/codbex-partners/gen/codbex_partners/data/customers/CustomerContactRepository.java
new file mode 100644
index 0000000..b286f84
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerContactRepository.java
@@ -0,0 +1,12 @@
+package gen.codbex_partners.data.customers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class CustomerContactRepository extends JavaRepository {
+
+ public CustomerContactRepository() {
+ super(CustomerContactEntity.class);
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/data/customers/CustomerEntity.java b/codbex-partners/gen/codbex_partners/data/customers/CustomerEntity.java
new file mode 100644
index 0000000..767a8e6
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerEntity.java
@@ -0,0 +1,102 @@
+package gen.codbex_partners.data.customers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_CUSTOMER")
+@Documentation("Customer entity mapping")
+public class CustomerEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "CUSTOMER_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "CUSTOMER_FIRSTNAME", length = 50, nullable = true)
+ @Documentation("FirstName")
+ public String FirstName;
+
+ @Column(name = "CUSTOMER_LASTNAME", length = 50, nullable = true)
+ @Documentation("LastName")
+ public String LastName;
+
+ @Column(name = "CUSTOMER_LEGALENTITYNAME", length = 255, nullable = true)
+ @Documentation("LegalEntityName")
+ public String LegalEntityName;
+
+ @Column(name = "CUSTOMER_NAME", length = 255, nullable = true)
+ @Documentation("Name")
+ public String Name;
+
+ @Column(name = "CUSTOMER_EMAIL", length = 100, nullable = false, unique = true)
+ @Documentation("Email")
+ public String Email;
+
+ @Column(name = "CUSTOMER_PHONE", length = 15, nullable = false)
+ @Documentation("Phone")
+ public String Phone;
+
+ @Column(name = "CUSTOMER_COUNTRY", nullable = false)
+ @Documentation("Country")
+ public Integer Country;
+
+ @Column(name = "CUSTOMER_CITY", nullable = false)
+ @Documentation("City")
+ public Integer City;
+
+ @Column(name = "CUSTOMER_FAX", length = 20, nullable = true)
+ @Documentation("Fax")
+ public String Fax;
+
+ @Column(name = "CUSTOMER_ADDRESS", length = 255, nullable = false)
+ @Documentation("Address")
+ public String Address;
+
+ @Column(name = "CUSTOMER_POSTALCODE", length = 10, nullable = false)
+ @Documentation("PostalCode")
+ public String PostalCode;
+
+ @Column(name = "CUSTOMER_TIN", length = 15, nullable = false, unique = true)
+ @Documentation("TIN")
+ public String TIN;
+
+ @Column(name = "CUSTOMER_IBAN", length = 34, nullable = false, unique = true)
+ @Documentation("IBAN")
+ public String IBAN;
+
+ @Column(name = "CUSTOMER_RESPONSIBLEPERSON", length = 150, nullable = true)
+ @Documentation("ResponsiblePerson")
+ public String ResponsiblePerson;
+
+ @CreatedAt
+ @Column(name = "CUSTOMER_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "CUSTOMER_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+ @UpdatedAt
+ @Column(name = "CUSTOMER_UPDATEDAT", nullable = true)
+ @Documentation("UpdatedAt")
+ public java.time.Instant UpdatedAt;
+
+ @UpdatedBy
+ @Column(name = "CUSTOMER_UPDATEDBY", length = 20, nullable = true)
+ @Documentation("UpdatedBy")
+ public String UpdatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Customers/CustomerNote.extensionpoint b/codbex-partners/gen/codbex_partners/data/customers/CustomerNote.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Customers/CustomerNote.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/customers/CustomerNote.extensionpoint
index f351445..2650427 100644
--- a/codbex-partners/gen/codbex-partners/data/Customers/CustomerNote.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerNote.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Customers-CustomerNote",
"description": "Extension Point for the codbex-partners-Customers-CustomerNote entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex_partners/data/customers/CustomerNoteEntity.java b/codbex-partners/gen/codbex_partners/data/customers/CustomerNoteEntity.java
new file mode 100644
index 0000000..1767f96
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerNoteEntity.java
@@ -0,0 +1,54 @@
+package gen.codbex_partners.data.customers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_CUSTOMERNOTE")
+@Documentation("CustomerNote entity mapping")
+public class CustomerNoteEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "CUSTOMERNOTE_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "CUSTOMERNOTE_CUSTOMER", nullable = true)
+ @Documentation("Customer")
+ public Integer Customer;
+
+ @Column(name = "CUSTOMERNOTE_NOTE", length = 5000, nullable = false)
+ @Documentation("Note")
+ public String Note;
+
+ @CreatedAt
+ @Column(name = "CUSTOMERNOTE_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "CUSTOMERNOTE_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+ @UpdatedAt
+ @Column(name = "CUSTOMERNOTE_UPDATEDAT", nullable = true)
+ @Documentation("UpdatedAt")
+ public java.time.Instant UpdatedAt;
+
+ @UpdatedBy
+ @Column(name = "CUSTOMERNOTE_UPDATEDBY", length = 20, nullable = true)
+ @Documentation("UpdatedBy")
+ public String UpdatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex_partners/data/customers/CustomerNoteRepository.java b/codbex-partners/gen/codbex_partners/data/customers/CustomerNoteRepository.java
new file mode 100644
index 0000000..dada9eb
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerNoteRepository.java
@@ -0,0 +1,12 @@
+package gen.codbex_partners.data.customers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class CustomerNoteRepository extends JavaRepository {
+
+ public CustomerNoteRepository() {
+ super(CustomerNoteEntity.class);
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/data/customers/CustomerRepository.java b/codbex-partners/gen/codbex_partners/data/customers/CustomerRepository.java
new file mode 100644
index 0000000..4ca60bf
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/customers/CustomerRepository.java
@@ -0,0 +1,24 @@
+package gen.codbex_partners.data.customers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class CustomerRepository extends JavaRepository {
+
+ public CustomerRepository() {
+ super(CustomerEntity.class);
+ }
+
+ @Override
+ public CustomerEntity save(CustomerEntity entity) {
+ entity.Name = (entity.FirstName != null && !entity.FirstName.trim().isEmpty() && entity.LastName != null && !entity.LastName.trim().isEmpty()) ? (entity.FirstName + " " + entity.LastName) : entity.LegalEntityName;
+ return super.save(entity);
+ }
+
+ @Override
+ public CustomerEntity update(CustomerEntity entity) {
+ entity.Name = (entity.FirstName != null && !entity.FirstName.trim().isEmpty() && entity.LastName != null && !entity.LastName.trim().isEmpty()) ? (entity.FirstName + " " + entity.LastName) : entity.LegalEntityName;
+ return super.update(entity);
+ }
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Manufacturers/Manufacturer.extensionpoint b/codbex-partners/gen/codbex_partners/data/manufacturers/Manufacturer.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Manufacturers/Manufacturer.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/manufacturers/Manufacturer.extensionpoint
index e4ca25f..db4cba7 100644
--- a/codbex-partners/gen/codbex-partners/data/Manufacturers/Manufacturer.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/Manufacturer.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Manufacturers-Manufacturer",
"description": "Extension Point for the codbex-partners-Manufacturers-Manufacturer entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Manufacturers/ManufacturerContact.extensionpoint b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContact.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Manufacturers/ManufacturerContact.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContact.extensionpoint
index 9617477..1f7650b 100644
--- a/codbex-partners/gen/codbex-partners/data/Manufacturers/ManufacturerContact.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContact.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Manufacturers-ManufacturerContact",
"description": "Extension Point for the codbex-partners-Manufacturers-ManufacturerContact entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContactEntity.java b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContactEntity.java
new file mode 100644
index 0000000..daab4ee
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContactEntity.java
@@ -0,0 +1,56 @@
+package gen.codbex_partners.data.manufacturers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_MANUFACTURERCONTACT")
+@Documentation("ManufacturerContact entity mapping")
+public class ManufacturerContactEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "MANUFACTURERCONTACT_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "MANUFACTURERCONTACT_MANUFACTURER", nullable = true)
+ @Documentation("Manufacturer")
+ public Integer Manufacturer;
+
+ @Column(name = "MANUFACTURERCONTACT_NAME", length = 255, nullable = false)
+ @Documentation("Name")
+ public String Name;
+
+ @Column(name = "MANUFACTURERCONTACT_DESIGNATION", length = 255, nullable = false)
+ @Documentation("Designation")
+ public String Designation;
+
+ @Column(name = "MANUFACTURERCONTACT_EMAIL", length = 100, nullable = false, unique = true)
+ @Documentation("Email")
+ public String Email;
+
+ @Column(name = "MANUFACTURERCONTACT_PHONE", length = 15, nullable = false)
+ @Documentation("Phone")
+ public String Phone;
+
+ @CreatedAt
+ @Column(name = "MANUFACTURERCONTACT_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "MANUFACTURERCONTACT_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContactRepository.java b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContactRepository.java
new file mode 100644
index 0000000..400b1ea
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerContactRepository.java
@@ -0,0 +1,12 @@
+package gen.codbex_partners.data.manufacturers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class ManufacturerContactRepository extends JavaRepository {
+
+ public ManufacturerContactRepository() {
+ super(ManufacturerContactEntity.class);
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerEntity.java b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerEntity.java
new file mode 100644
index 0000000..537e645
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerEntity.java
@@ -0,0 +1,82 @@
+package gen.codbex_partners.data.manufacturers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_MANUFACTURER")
+@Documentation("Manufacturer entity mapping")
+public class ManufacturerEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "MANUFACTURER_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "MANUFACTURER_FIRSTNAME", length = 50, nullable = true)
+ @Documentation("FirstName")
+ public String FirstName;
+
+ @Column(name = "MANUFACTURER_LASTNAME", length = 50, nullable = true)
+ @Documentation("LastName")
+ public String LastName;
+
+ @Column(name = "MANUFACTURER_LEGALENTITYNAME", length = 255, nullable = true)
+ @Documentation("LegalEntityName")
+ public String LegalEntityName;
+
+ @Column(name = "MANUFACTURER_NAME", length = 255, nullable = true)
+ @Documentation("Name")
+ public String Name;
+
+ @Column(name = "MANUFACTURER_EMAIL", length = 100, nullable = false, unique = true)
+ @Documentation("Email")
+ public String Email;
+
+ @Column(name = "MANUFACTURER_PHONE", length = 15, nullable = false)
+ @Documentation("Phone")
+ public String Phone;
+
+ @Column(name = "MANUFACTURER_FAX", length = 20, nullable = false)
+ @Documentation("Fax")
+ public String Fax;
+
+ @Column(name = "MANUFACTURER_TIN", length = 15, nullable = false, unique = true)
+ @Documentation("TIN")
+ public String TIN;
+
+ @Column(name = "MANUFACTURER_IBAN", length = 34, nullable = false, unique = true)
+ @Documentation("IBAN")
+ public String IBAN;
+
+ @CreatedAt
+ @Column(name = "MANUFACTURER_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "MANUFACTURER_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+ @UpdatedAt
+ @Column(name = "MANUFACTURER_UPDATEDAT", nullable = true)
+ @Documentation("UpdatedAt")
+ public java.time.Instant UpdatedAt;
+
+ @UpdatedBy
+ @Column(name = "MANUFACTURER_UPDATEDBY", length = 20, nullable = true)
+ @Documentation("UpdatedBy")
+ public String UpdatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Manufacturers/ManufacturerNote.extensionpoint b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNote.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Manufacturers/ManufacturerNote.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNote.extensionpoint
index 5f3b2f1..ea59855 100644
--- a/codbex-partners/gen/codbex-partners/data/Manufacturers/ManufacturerNote.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNote.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Manufacturers-ManufacturerNote",
"description": "Extension Point for the codbex-partners-Manufacturers-ManufacturerNote entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNoteEntity.java b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNoteEntity.java
new file mode 100644
index 0000000..628b772
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNoteEntity.java
@@ -0,0 +1,54 @@
+package gen.codbex_partners.data.manufacturers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_MANUFACTURERNOTE")
+@Documentation("ManufacturerNote entity mapping")
+public class ManufacturerNoteEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "MANUFACTURERNOTE_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "MANUFACTURERNOTE_MANUFACTURER", nullable = true)
+ @Documentation("Manufacturer")
+ public Integer Manufacturer;
+
+ @Column(name = "MANUFACTURERNOTE_NOTE", length = 5000, nullable = false)
+ @Documentation("Note")
+ public String Note;
+
+ @CreatedAt
+ @Column(name = "MANUFACTURERNOTE_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "MANUFACTURERNOTE_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+ @UpdatedAt
+ @Column(name = "MANUFACTURERNOTE_UPDATEDAT", nullable = true)
+ @Documentation("UpdatedAt")
+ public java.time.Instant UpdatedAt;
+
+ @UpdatedBy
+ @Column(name = "MANUFACTURERNOTE_UPDATEDBY", length = 20, nullable = true)
+ @Documentation("UpdatedBy")
+ public String UpdatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNoteRepository.java b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNoteRepository.java
new file mode 100644
index 0000000..2bf1bb1
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerNoteRepository.java
@@ -0,0 +1,12 @@
+package gen.codbex_partners.data.manufacturers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class ManufacturerNoteRepository extends JavaRepository {
+
+ public ManufacturerNoteRepository() {
+ super(ManufacturerNoteEntity.class);
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerRepository.java b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerRepository.java
new file mode 100644
index 0000000..a90fb42
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/manufacturers/ManufacturerRepository.java
@@ -0,0 +1,24 @@
+package gen.codbex_partners.data.manufacturers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class ManufacturerRepository extends JavaRepository {
+
+ public ManufacturerRepository() {
+ super(ManufacturerEntity.class);
+ }
+
+ @Override
+ public ManufacturerEntity save(ManufacturerEntity entity) {
+ entity.Name = (entity.FirstName != null && !entity.FirstName.trim().isEmpty() && entity.LastName != null && !entity.LastName.trim().isEmpty()) ? (entity.FirstName + " " + entity.LastName) : entity.LegalEntityName;
+ return super.save(entity);
+ }
+
+ @Override
+ public ManufacturerEntity update(ManufacturerEntity entity) {
+ entity.Name = (entity.FirstName != null && !entity.FirstName.trim().isEmpty() && entity.LastName != null && !entity.LastName.trim().isEmpty()) ? (entity.FirstName + " " + entity.LastName) : entity.LegalEntityName;
+ return super.update(entity);
+ }
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Suppliers/Supplier.extensionpoint b/codbex-partners/gen/codbex_partners/data/suppliers/Supplier.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Suppliers/Supplier.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/suppliers/Supplier.extensionpoint
index 8909ecb..7fe1450 100644
--- a/codbex-partners/gen/codbex-partners/data/Suppliers/Supplier.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/Supplier.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Suppliers-Supplier",
"description": "Extension Point for the codbex-partners-Suppliers-Supplier entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Suppliers/SupplierContact.extensionpoint b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContact.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Suppliers/SupplierContact.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/suppliers/SupplierContact.extensionpoint
index 8c5a275..95ba585 100644
--- a/codbex-partners/gen/codbex-partners/data/Suppliers/SupplierContact.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContact.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Suppliers-SupplierContact",
"description": "Extension Point for the codbex-partners-Suppliers-SupplierContact entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContactEntity.java b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContactEntity.java
new file mode 100644
index 0000000..d7e5712
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContactEntity.java
@@ -0,0 +1,56 @@
+package gen.codbex_partners.data.suppliers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_SUPPLIERCONTACT")
+@Documentation("SupplierContact entity mapping")
+public class SupplierContactEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "SUPPLIERCONTACT_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "SUPPLIERCONTACT_SUPPLIER", nullable = true)
+ @Documentation("Supplier")
+ public Integer Supplier;
+
+ @Column(name = "SUPPLIERCONTACT_NAME", length = 255, nullable = false)
+ @Documentation("Name")
+ public String Name;
+
+ @Column(name = "SUPPLIERCONTACT_DESIGNATION", length = 255, nullable = false)
+ @Documentation("Designation")
+ public String Designation;
+
+ @Column(name = "SUPPLIERCONTACT_EMAIL", length = 100, nullable = false, unique = true)
+ @Documentation("Email")
+ public String Email;
+
+ @Column(name = "SUPPLIERCONTACT_PHONE", length = 15, nullable = false)
+ @Documentation("Phone")
+ public String Phone;
+
+ @CreatedAt
+ @Column(name = "SUPPLIERCONTACT_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "SUPPLIERCONTACT_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContactRepository.java b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContactRepository.java
new file mode 100644
index 0000000..493917f
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierContactRepository.java
@@ -0,0 +1,12 @@
+package gen.codbex_partners.data.suppliers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class SupplierContactRepository extends JavaRepository {
+
+ public SupplierContactRepository() {
+ super(SupplierContactEntity.class);
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/data/suppliers/SupplierEntity.java b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierEntity.java
new file mode 100644
index 0000000..91ecb64
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierEntity.java
@@ -0,0 +1,82 @@
+package gen.codbex_partners.data.suppliers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_SUPPLIER")
+@Documentation("Supplier entity mapping")
+public class SupplierEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "SUPPLIER_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "SUPPLIER_FIRSTNAME", length = 50, nullable = true)
+ @Documentation("FirstName")
+ public String FirstName;
+
+ @Column(name = "SUPPLIER_LASTNAME", length = 50, nullable = true)
+ @Documentation("LastName")
+ public String LastName;
+
+ @Column(name = "SUPPLIER_LEGALENTITYNAME", length = 255, nullable = true)
+ @Documentation("LegalEntityName")
+ public String LegalEntityName;
+
+ @Column(name = "SUPPLIER_NAME", length = 255, nullable = true)
+ @Documentation("Name")
+ public String Name;
+
+ @Column(name = "SUPPLIER_EMAIL", length = 100, nullable = false, unique = true)
+ @Documentation("Email")
+ public String Email;
+
+ @Column(name = "SUPPLIER_PHONE", length = 15, nullable = false)
+ @Documentation("Phone")
+ public String Phone;
+
+ @Column(name = "SUPPLIER_FAX", length = 20, nullable = false)
+ @Documentation("Fax")
+ public String Fax;
+
+ @Column(name = "SUPPLIER_TIN", length = 15, nullable = false, unique = true)
+ @Documentation("TIN")
+ public String TIN;
+
+ @Column(name = "SUPPLIER_IBAN", length = 34, nullable = false, unique = true)
+ @Documentation("IBAN")
+ public String IBAN;
+
+ @CreatedAt
+ @Column(name = "SUPPLIER_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "SUPPLIER_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+ @UpdatedAt
+ @Column(name = "SUPPLIER_UPDATEDAT", nullable = true)
+ @Documentation("UpdatedAt")
+ public java.time.Instant UpdatedAt;
+
+ @UpdatedBy
+ @Column(name = "SUPPLIER_UPDATEDBY", length = 20, nullable = true)
+ @Documentation("UpdatedBy")
+ public String UpdatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex-partners/data/Suppliers/SupplierNote.extensionpoint b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNote.extensionpoint
similarity index 98%
rename from codbex-partners/gen/codbex-partners/data/Suppliers/SupplierNote.extensionpoint
rename to codbex-partners/gen/codbex_partners/data/suppliers/SupplierNote.extensionpoint
index 3ca580d..5bf4c48 100644
--- a/codbex-partners/gen/codbex-partners/data/Suppliers/SupplierNote.extensionpoint
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNote.extensionpoint
@@ -1,4 +1,4 @@
{
"name": "codbex-partners-Suppliers-SupplierNote",
"description": "Extension Point for the codbex-partners-Suppliers-SupplierNote entity"
-}
\ No newline at end of file
+}
diff --git a/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNoteEntity.java b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNoteEntity.java
new file mode 100644
index 0000000..256170b
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNoteEntity.java
@@ -0,0 +1,54 @@
+package gen.codbex_partners.data.suppliers;
+
+import org.eclipse.dirigible.sdk.db.Column;
+import org.eclipse.dirigible.sdk.db.CreatedAt;
+import org.eclipse.dirigible.sdk.db.CreatedBy;
+import org.eclipse.dirigible.sdk.platform.Documentation;
+import org.eclipse.dirigible.sdk.db.Entity;
+import org.eclipse.dirigible.sdk.db.GeneratedValue;
+import org.eclipse.dirigible.sdk.db.GenerationType;
+import org.eclipse.dirigible.sdk.db.Id;
+import org.eclipse.dirigible.sdk.db.Table;
+import org.eclipse.dirigible.sdk.db.UpdatedAt;
+import org.eclipse.dirigible.sdk.db.UpdatedBy;
+
+@Entity
+@Table(name = "CODBEX_SUPPLIERNOTE")
+@Documentation("SupplierNote entity mapping")
+public class SupplierNoteEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "SUPPLIERNOTE_ID")
+ @Documentation("Id")
+ public Integer Id;
+
+ @Column(name = "SUPPLIERNOTE_SUPPLIER", nullable = true)
+ @Documentation("Supplier")
+ public Integer Supplier;
+
+ @Column(name = "SUPPLIERNOTE_NOTE", length = 5000, nullable = false)
+ @Documentation("Note")
+ public String Note;
+
+ @CreatedAt
+ @Column(name = "SUPPLIERNOTE_CREATEDAT", nullable = true)
+ @Documentation("CreatedAt")
+ public java.time.Instant CreatedAt;
+
+ @CreatedBy
+ @Column(name = "SUPPLIERNOTE_CREATEDBY", length = 20, nullable = true)
+ @Documentation("CreatedBy")
+ public String CreatedBy;
+
+ @UpdatedAt
+ @Column(name = "SUPPLIERNOTE_UPDATEDAT", nullable = true)
+ @Documentation("UpdatedAt")
+ public java.time.Instant UpdatedAt;
+
+ @UpdatedBy
+ @Column(name = "SUPPLIERNOTE_UPDATEDBY", length = 20, nullable = true)
+ @Documentation("UpdatedBy")
+ public String UpdatedBy;
+
+}
diff --git a/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNoteRepository.java b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNoteRepository.java
new file mode 100644
index 0000000..7953063
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierNoteRepository.java
@@ -0,0 +1,12 @@
+package gen.codbex_partners.data.suppliers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class SupplierNoteRepository extends JavaRepository {
+
+ public SupplierNoteRepository() {
+ super(SupplierNoteEntity.class);
+ }
+}
diff --git a/codbex-partners/gen/codbex_partners/data/suppliers/SupplierRepository.java b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierRepository.java
new file mode 100644
index 0000000..1901e21
--- /dev/null
+++ b/codbex-partners/gen/codbex_partners/data/suppliers/SupplierRepository.java
@@ -0,0 +1,24 @@
+package gen.codbex_partners.data.suppliers;
+
+import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository;
+import org.eclipse.dirigible.sdk.component.Repository;
+
+@Repository
+public class SupplierRepository extends JavaRepository {
+
+ public SupplierRepository() {
+ super(SupplierEntity.class);
+ }
+
+ @Override
+ public SupplierEntity save(SupplierEntity entity) {
+ entity.Name = (entity.FirstName != null && !entity.FirstName.trim().isEmpty() && entity.LastName != null && !entity.LastName.trim().isEmpty()) ? (entity.FirstName + " " + entity.LastName) : entity.LegalEntityName;
+ return super.save(entity);
+ }
+
+ @Override
+ public SupplierEntity update(SupplierEntity entity) {
+ entity.Name = (entity.FirstName != null && !entity.FirstName.trim().isEmpty() && entity.LastName != null && !entity.LastName.trim().isEmpty()) ? (entity.FirstName + " " + entity.LastName) : entity.LegalEntityName;
+ return super.update(entity);
+ }
+}
diff --git a/codbex-partners/gen/codbex-partners/roles/default-roles.roles b/codbex-partners/gen/codbex_partners/roles/default-roles.roles
similarity index 99%
rename from codbex-partners/gen/codbex-partners/roles/default-roles.roles
rename to codbex-partners/gen/codbex_partners/roles/default-roles.roles
index 38b4711..dfcfc7c 100644
--- a/codbex-partners/gen/codbex-partners/roles/default-roles.roles
+++ b/codbex-partners/gen/codbex_partners/roles/default-roles.roles
@@ -55,4 +55,4 @@
"name": "codbex-partners.Customers.CustomerContactFullAccess",
"description": "A role that grants full access for CustomerContact."
}
-]
\ No newline at end of file
+]
diff --git a/codbex-partners/translations/en-US/codbex-partners.model.json b/codbex-partners/translations/en-US/codbex-partners.model.json
index 590f92d..92d9921 100644
--- a/codbex-partners/translations/en-US/codbex-partners.model.json
+++ b/codbex-partners/translations/en-US/codbex-partners.model.json
@@ -74,9 +74,9 @@
"CUSTOMER_NAME": "Name",
"CUSTOMER_EMAIL": "Email",
"CUSTOMER_PHONE": "Phone",
- "CUSTOMER_FAX": "Fax",
"CUSTOMER_COUNTRY": "Country",
"CUSTOMER_CITY": "City",
+ "CUSTOMER_FAX": "Fax",
"CUSTOMER_ADDRESS": "Address",
"CUSTOMER_POSTALCODE": "PostalCode",
"CUSTOMER_TIN": "TIN",
@@ -125,16 +125,6 @@
"MANUFACTURERNOTE_CREATEDBY": "CreatedBy",
"MANUFACTURERNOTE_UPDATEDAT": "UpdatedAt",
"MANUFACTURERNOTE_UPDATEDBY": "UpdatedBy",
- "CITY": "City",
- "CITY_ID": "Id",
- "CITY_NAME": "Name",
- "CITY_COUNTRY": "Country",
- "COUNTRY": "Country",
- "COUNTRY_ID": "Id",
- "COUNTRY_NAME": "Name",
- "COUNTRY_CODE2": "Code2",
- "COUNTRY_CODE3": "Code3",
- "COUNTRY_NUMERIC": "Numeric",
"MANUFACTURER": "Manufacturer",
"MANUFACTURER_ID": "Id",
"MANUFACTURER_FIRSTNAME": "FirstName",
@@ -177,6 +167,16 @@
"MANUFACTURERCONTACT_PHONE": "Phone",
"MANUFACTURERCONTACT_CREATEDAT": "CreatedAt",
"MANUFACTURERCONTACT_CREATEDBY": "CreatedBy",
+ "COUNTRY": "Country",
+ "COUNTRY_ID": "Id",
+ "COUNTRY_NAME": "Name",
+ "COUNTRY_CODE2": "Code2",
+ "COUNTRY_CODE3": "Code3",
+ "COUNTRY_NUMERIC": "Numeric",
+ "CITY": "City",
+ "CITY_ID": "Id",
+ "CITY_NAME": "Name",
+ "CITY_COUNTRY": "Country",
"Customers": "Customers",
"Suppliers": "Suppliers",
"Manufacturers": "Manufacturers"