From eeab9b6e4fcc170d959cb357e20d554c6b228455 Mon Sep 17 00:00:00 2001 From: NicoleNG18 Date: Tue, 9 Jun 2026 14:37:19 +0300 Subject: [PATCH 1/3] regenerate module with new Java template --- codbex-employees/codbex-employees.gen | 112 +++++++-- .../api/Employees/AddressController.ts | 188 -------------- .../api/Employees/ContactController.ts | 201 --------------- .../api/Employees/EmployeeController.ts | 235 ------------------ .../api/Settings/GenderController.ts | 178 ------------- .../api/Settings/MartialStatusController.ts | 178 ------------- .../data/Employees/AddressEntity.ts | 95 ------- .../data/Employees/AddressRepository.ts | 43 ---- .../data/Employees/ContactEntity.ts | 81 ------ .../data/Employees/ContactRepository.ts | 43 ---- .../data/Employees/EmployeeEntity.ts | 151 ----------- .../data/Employees/EmployeeRepository.ts | 61 ----- .../data/Settings/GenderEntity.ts | 28 --- .../data/Settings/GenderRepository.ts | 25 -- .../data/Settings/MartialStatusEntity.ts | 28 --- .../data/Settings/MartialStatusRepository.ts | 25 -- .../odata/codbex-employees.odata | 4 - .../Employees/Employee/Address/controller.js | 14 +- .../Address/dialog-filter/controller.js | 8 +- .../Address/dialog-window/controller.js | 16 +- .../Employees/Employee/Contact/controller.js | 2 +- .../Contact/dialog-window/controller.js | 2 +- .../ui/Employees/Employee/controller.js | 20 +- .../Employee/dialog-filter/controller.js | 12 +- .../Employee/dialog-window/controller.js | 26 +- .../Employee/main-details/controller.js | 26 +- .../ui/Settings/Gender/controller.js | 2 +- .../Gender/dialog-window/controller.js | 2 +- .../ui/Settings/MartialStatus/controller.js | 2 +- .../MartialStatus/dialog-window/controller.js | 2 +- .../api/employees/AddressController.java | 179 +++++++++++++ .../api/employees/ContactController.java | 190 ++++++++++++++ .../api/employees/EmployeeController.java | 227 +++++++++++++++++ .../api/settings/GenderController.java | 170 +++++++++++++ .../api/settings/MartialStatusController.java | 170 +++++++++++++ .../data/employees}/Address.extensionpoint | 2 +- .../data/employees/AddressEntity.java | 66 +++++ .../data/employees/AddressRepository.java | 12 + .../data/employees}/Contact.extensionpoint | 2 +- .../data/employees/ContactEntity.java | 58 +++++ .../data/employees/ContactRepository.java | 12 + .../data/employees}/Employee.extensionpoint | 2 +- .../data/employees/EmployeeEntity.java | 94 +++++++ .../data/employees/EmployeeRepository.java | 24 ++ .../data/settings}/Gender.extensionpoint | 2 +- .../data/settings/GenderEntity.java | 30 +++ .../data/settings/GenderRepository.java | 12 + .../settings}/MartialStatus.extensionpoint | 2 +- .../data/settings/MartialStatusEntity.java | 30 +++ .../settings/MartialStatusRepository.java | 12 + .../roles/default-roles.roles | 2 +- 51 files changed, 1451 insertions(+), 1657 deletions(-) delete mode 100644 codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts delete mode 100644 codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts delete mode 100644 codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts delete mode 100644 codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts delete mode 100644 codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Employees/AddressEntity.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Employees/AddressRepository.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Employees/ContactEntity.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Employees/ContactRepository.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Employees/EmployeeEntity.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Employees/EmployeeRepository.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Settings/GenderEntity.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Settings/GenderRepository.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Settings/MartialStatusEntity.ts delete mode 100644 codbex-employees/gen/codbex-employees/data/Settings/MartialStatusRepository.ts delete mode 100644 codbex-employees/gen/codbex-employees/odata/codbex-employees.odata create mode 100644 codbex-employees/gen/codbex_employees/api/employees/AddressController.java create mode 100644 codbex-employees/gen/codbex_employees/api/employees/ContactController.java create mode 100644 codbex-employees/gen/codbex_employees/api/employees/EmployeeController.java create mode 100644 codbex-employees/gen/codbex_employees/api/settings/GenderController.java create mode 100644 codbex-employees/gen/codbex_employees/api/settings/MartialStatusController.java rename codbex-employees/gen/{codbex-employees/data/Employees => codbex_employees/data/employees}/Address.extensionpoint (98%) create mode 100644 codbex-employees/gen/codbex_employees/data/employees/AddressEntity.java create mode 100644 codbex-employees/gen/codbex_employees/data/employees/AddressRepository.java rename codbex-employees/gen/{codbex-employees/data/Employees => codbex_employees/data/employees}/Contact.extensionpoint (98%) create mode 100644 codbex-employees/gen/codbex_employees/data/employees/ContactEntity.java create mode 100644 codbex-employees/gen/codbex_employees/data/employees/ContactRepository.java rename codbex-employees/gen/{codbex-employees/data/Employees => codbex_employees/data/employees}/Employee.extensionpoint (98%) create mode 100644 codbex-employees/gen/codbex_employees/data/employees/EmployeeEntity.java create mode 100644 codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java rename codbex-employees/gen/{codbex-employees/data/Settings => codbex_employees/data/settings}/Gender.extensionpoint (98%) create mode 100644 codbex-employees/gen/codbex_employees/data/settings/GenderEntity.java create mode 100644 codbex-employees/gen/codbex_employees/data/settings/GenderRepository.java rename codbex-employees/gen/{codbex-employees/data/Settings => codbex_employees/data/settings}/MartialStatus.extensionpoint (98%) create mode 100644 codbex-employees/gen/codbex_employees/data/settings/MartialStatusEntity.java create mode 100644 codbex-employees/gen/codbex_employees/data/settings/MartialStatusRepository.java rename codbex-employees/gen/{codbex-employees => codbex_employees}/roles/default-roles.roles (99%) diff --git a/codbex-employees/codbex-employees.gen b/codbex-employees/codbex-employees.gen index dc69d24..56577d8 100644 --- a/codbex-employees/codbex-employees.gen +++ b/codbex-employees/codbex-employees.gen @@ -1,15 +1,17 @@ { "tablePrefix": "CODBEX_", "brand": "codbex", - "brandUrl": "codbex.com", + "brandUrl": "https://www.codbex.com/", "title": "Employees Management Module", "description": "Managing Employees Data", "projectName": "codbex-employees", "workspaceName": "workspace", "filePath": "codbex-employees.model", - "templateId": "template-application-angular-v2/template/template.js", + "templateId": "template-application-angular-java/template/template.js", "fileName": "codbex-employees", "genFolderName": "codbex-employees", + "javaRuntime": true, + "javaGenFolderName": "codbex_employees", "dataSource": "DefaultDB", "perspectives": { "Employees": { @@ -111,6 +113,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -139,6 +142,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 50, "inputRule": "" @@ -169,6 +173,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 50, "inputRule": "" @@ -199,6 +204,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 50, "inputRule": "" @@ -230,6 +236,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 70, "inputRule": "" @@ -259,6 +266,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 40, "inputRule": "" @@ -288,6 +296,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -316,6 +325,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "date", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.LocalDate", "isDateType": true, "inputRule": "" }, @@ -344,6 +354,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 10, "inputRule": "" @@ -374,10 +385,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Nationality", - "widgetDropdownUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts", + "widgetDropdownUrl": "/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController", + "widgetDropdownControllerUrl": "/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -406,10 +418,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Gender", - "widgetDropdownUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts", + "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController", + "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -438,10 +451,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "MartialStatus", - "widgetDropdownUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts", + "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController", + "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -470,6 +484,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 34, "inputRule": "^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$" @@ -498,6 +513,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -526,6 +542,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -554,6 +571,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -582,6 +600,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -614,6 +633,7 @@ "tooltip": "Employee", "type": "PRIMARY", "dataSource": "DefaultDB", + "javaPerspectiveName": "employees", "referencedProjections": [ { "name": "Country", @@ -652,6 +672,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 50, "inputRule": "" @@ -683,6 +704,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 50, "inputRule": "" @@ -713,6 +735,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 50, "inputRule": "" @@ -744,6 +767,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 70, "inputRule": "" @@ -773,6 +797,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 40, "inputRule": "" @@ -802,6 +827,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -830,6 +856,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "date", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.LocalDate", "isDateType": true, "inputRule": "" }, @@ -858,6 +885,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 10, "inputRule": "" @@ -888,10 +916,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Nationality", - "widgetDropdownUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts", + "widgetDropdownUrl": "/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController", + "widgetDropdownControllerUrl": "/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -920,10 +949,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Gender", - "widgetDropdownUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts", + "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController", + "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -952,10 +982,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "MartialStatus", - "widgetDropdownUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts", + "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController", + "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -984,6 +1015,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 34, "inputRule": "^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$" @@ -1012,6 +1044,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -1040,6 +1073,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1068,6 +1102,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -1096,6 +1131,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1131,6 +1167,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1158,6 +1195,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1187,6 +1225,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 2, "inputRule": "" @@ -1216,6 +1255,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 3, "inputRule": "" @@ -1245,6 +1285,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 3, "inputRule": "" @@ -1277,6 +1318,7 @@ "tooltip": "Country", "type": "PROJECTION", "dataSource": "DefaultDB", + "javaPerspectiveName": "settings", "referencedProjections": [], "primaryKeys": [ "Id" @@ -1309,6 +1351,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1336,6 +1379,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 100, "inputRule": "" @@ -1365,10 +1409,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Country", - "widgetDropdownUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/undefinedService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-employees/gen/codbex-employees/api/Settings/undefinedController.ts", + "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/undefinedController", + "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/undefinedController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" } ], @@ -1399,6 +1444,7 @@ "tooltip": "City", "type": "PROJECTION", "dataSource": "DefaultDB", + "javaPerspectiveName": "settings", "referencedProjections": [], "primaryKeys": [ "Id" @@ -1432,6 +1478,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1459,6 +1506,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 7, "inputRule": "" @@ -1491,6 +1539,7 @@ "tooltip": "Gender", "type": "SETTING", "dataSource": "DefaultDB", + "javaPerspectiveName": "settings", "referencedProjections": [], "primaryKeys": [ "Id" @@ -1523,6 +1572,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1550,6 +1600,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1582,6 +1633,7 @@ "tooltip": "MartialStatus", "type": "SETTING", "dataSource": "DefaultDB", + "javaPerspectiveName": "settings", "referencedProjections": [], "primaryKeys": [ "Id" @@ -1614,6 +1666,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1641,6 +1694,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1670,6 +1724,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 255, "inputRule": "" @@ -1704,6 +1759,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1730,6 +1786,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -1758,6 +1815,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1786,6 +1844,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -1814,6 +1873,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -1846,6 +1906,7 @@ "tooltip": "Contact", "type": "DEPENDENT", "dataSource": "DefaultDB", + "javaPerspectiveName": "employees", "referencedProjections": [], "primaryKeys": [ "Id" @@ -1881,6 +1942,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1909,10 +1971,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Country", - "widgetDropdownUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts", + "widgetDropdownUrl": "/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController", + "widgetDropdownControllerUrl": "/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1945,10 +2008,11 @@ "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "City", - "widgetDropdownUrl": "/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityService.ts", - "widgetDropdownControllerUrl": "/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts", + "widgetDropdownUrl": "/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController", + "widgetDropdownControllerUrl": "/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -1976,6 +2040,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 255, "inputRule": "" @@ -2005,6 +2070,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 12, "inputRule": "" @@ -2039,6 +2105,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "int", "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", "inputRule": "" }, { @@ -2065,6 +2132,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -2093,6 +2161,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -2121,6 +2190,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "timestamp", "dataTypeTypescript": "Date", + "dataTypeJavaClass": "java.time.Instant", "isDateType": true, "inputRule": "" }, @@ -2149,6 +2219,7 @@ "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", "minLength": 0, "maxLength": 20, "inputRule": "" @@ -2179,6 +2250,7 @@ "tooltip": "Address", "type": "DEPENDENT", "dataSource": "DefaultDB", + "javaPerspectiveName": "employees", "referencedProjections": [ { "name": "Country", diff --git a/codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts b/codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts deleted file mode 100644 index 58ce939..0000000 --- a/codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' -import { HttpUtils } from "@aerokit/sdk/http/utils"; -import { ValidationError } from '@aerokit/sdk/http/errors' -import { Options } from '@aerokit/sdk/db' -import { Extensions } from "@aerokit/sdk/extensions" -import { Injected, Inject } from '@aerokit/sdk/component' -import { AddressRepository } from '../../data/Employees/AddressRepository' -import { AddressEntity } from '../../data/Employees/AddressEntity' - -const validationModules = await Extensions.loadExtensionModules('codbex-employees-Employees-Address', ['validate']); - -@Controller -@Documentation('codbex-employees - Address Controller') -@Injected() -class AddressController { - - @Inject('AddressRepository') - private readonly repository!: AddressRepository; - - @Get('/') - @Documentation('Get All Address') - public getAll(_: any, ctx: any): AddressEntity[] { - try { - const options: Options = { - limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, - offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, - language: request.getLocale()?.split("_")[0] - }; - - let Employee = parseInt(ctx.queryParameters.Employee); - Employee = isNaN(Employee) ? ctx.queryParameters.Employee : Employee; - - if (Employee !== undefined) { - options.$filter = { - equals: { - Employee: Employee - } - }; - } - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/') - @Documentation('Create Address') - public create(entity: AddressEntity): AddressEntity { - try { - this.validateEntity(entity); - entity.Id = this.repository.create(entity) as any; - response.setHeader('Content-Location', '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts/' + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/count') - @Documentation('Count Address') - public count(): { count: number } { - try { - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/count') - @Documentation('Count Address with filter') - public countWithFilter(filter: any): { count: number } { - try { - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/search') - @Documentation('Search Address') - public search(filter: any): AddressEntity[] { - try { - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/:id') - @Documentation('Get Address by id') - public getById(_: any, ctx: any): AddressEntity { - try { - const id = parseInt(ctx.pathParameters.id); - const options: Options = { - language: request.getLocale()?.split("_")[0] - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound('Address not found'); - } - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Put('/:id') - @Documentation('Update Address by id') - public update(entity: AddressEntity, ctx: any): AddressEntity { - try { - const id = parseInt(ctx.pathParameters.id); - entity.Id = id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Delete('/:id') - @Documentation('Delete Address by id') - public deleteById(_: any, ctx: any): void { - try { - const id = parseInt(ctx.pathParameters.id); - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound('Address not found'); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === 'ForbiddenError') { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === 'ValidationError') { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private validateEntity(entity: any): void { - if (entity.Country === null || entity.Country === undefined) { - throw new ValidationError(`The 'Country' property is required, provide a valid value`); - } - if (entity.City === null || entity.City === undefined) { - throw new ValidationError(`The 'City' property is required, provide a valid value`); - } - if (entity.Address === null || entity.Address === undefined) { - throw new ValidationError(`The 'Address' property is required, provide a valid value`); - } - if (entity.Address?.length > 255) { - throw new ValidationError(`The 'Address' exceeds the maximum length of [255] characters`); - } - if (entity.PostalCode === null || entity.PostalCode === undefined) { - throw new ValidationError(`The 'PostalCode' property is required, provide a valid value`); - } - if (entity.PostalCode?.length > 12) { - throw new ValidationError(`The 'PostalCode' exceeds the maximum length of [12] characters`); - } - if (entity.CreatedBy?.length > 20) { - throw new ValidationError(`The 'CreatedBy' exceeds the maximum length of [20] characters`); - } - if (entity.UpdatedBy?.length > 20) { - throw new ValidationError(`The 'UpdatedBy' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts b/codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts deleted file mode 100644 index 0727e27..0000000 --- a/codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts +++ /dev/null @@ -1,201 +0,0 @@ -import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' -import { HttpUtils } from "@aerokit/sdk/http/utils"; -import { ValidationError } from '@aerokit/sdk/http/errors' -import { ForbiddenError } from '@aerokit/sdk/http/errors' -import { user } from '@aerokit/sdk/security' -import { Options } from '@aerokit/sdk/db' -import { Extensions } from "@aerokit/sdk/extensions" -import { Injected, Inject } from '@aerokit/sdk/component' -import { ContactRepository } from '../../data/Employees/ContactRepository' -import { ContactEntity } from '../../data/Employees/ContactEntity' - -const validationModules = await Extensions.loadExtensionModules('codbex-employees-Employees-Contact', ['validate']); - -@Controller -@Documentation('codbex-employees - Contact Controller') -@Injected() -class ContactController { - - @Inject('ContactRepository') - private readonly repository!: ContactRepository; - - @Get('/') - @Documentation('Get All Contact') - public getAll(_: any, ctx: any): ContactEntity[] { - try { - this.checkPermissions('read'); - const options: Options = { - limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, - offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, - language: request.getLocale()?.split("_")[0] - }; - - let Employee = parseInt(ctx.queryParameters.Employee); - Employee = isNaN(Employee) ? ctx.queryParameters.Employee : Employee; - - if (Employee !== undefined) { - options.$filter = { - equals: { - Employee: Employee - } - }; - } - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/') - @Documentation('Create Contact') - public create(entity: ContactEntity): ContactEntity { - try { - this.checkPermissions('write'); - this.validateEntity(entity); - entity.Id = this.repository.create(entity) as any; - response.setHeader('Content-Location', '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts/' + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/count') - @Documentation('Count Contact') - public count(): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/count') - @Documentation('Count Contact with filter') - public countWithFilter(filter: any): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/search') - @Documentation('Search Contact') - public search(filter: any): ContactEntity[] { - try { - this.checkPermissions('read'); - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/:id') - @Documentation('Get Contact by id') - public getById(_: any, ctx: any): ContactEntity { - try { - this.checkPermissions('read'); - const id = parseInt(ctx.pathParameters.id); - const options: Options = { - language: request.getLocale()?.split("_")[0] - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound('Contact not found'); - } - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Put('/:id') - @Documentation('Update Contact by id') - public update(entity: ContactEntity, ctx: any): ContactEntity { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - entity.Id = id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Delete('/:id') - @Documentation('Delete Contact by id') - public deleteById(_: any, ctx: any): void { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound('Contact not found'); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === 'ForbiddenError') { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === 'ValidationError') { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private checkPermissions(operationType: string) { - if (operationType === 'read' && !(user.isInRole('codbex-employees.Employees.ContactReadOnly') || user.isInRole('codbex-employees.Employees.ContactFullAccess'))) { - throw new ForbiddenError(); - } - if (operationType === 'write' && !user.isInRole('codbex-employees.Employees.ContactFullAccess')) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.PhoneNumber === null || entity.PhoneNumber === undefined) { - throw new ValidationError(`The 'PhoneNumber' property is required, provide a valid value`); - } - if (entity.PhoneNumber?.length > 20) { - throw new ValidationError(`The 'PhoneNumber' exceeds the maximum length of [20] characters`); - } - if (entity.Email === null || entity.Email === undefined) { - throw new ValidationError(`The 'Email' property is required, provide a valid value`); - } - if (entity.Email?.length > 255) { - throw new ValidationError(`The 'Email' exceeds the maximum length of [255] characters`); - } - if (entity.CreatedBy?.length > 20) { - throw new ValidationError(`The 'CreatedBy' exceeds the maximum length of [20] characters`); - } - if (entity.UpdatedBy?.length > 20) { - throw new ValidationError(`The 'UpdatedBy' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts b/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts deleted file mode 100644 index fb0c957..0000000 --- a/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts +++ /dev/null @@ -1,235 +0,0 @@ -import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' -import { HttpUtils } from "@aerokit/sdk/http/utils"; -import { ValidationError } from '@aerokit/sdk/http/errors' -import { ForbiddenError } from '@aerokit/sdk/http/errors' -import { user } from '@aerokit/sdk/security' -import { Options } from '@aerokit/sdk/db' -import { Extensions } from "@aerokit/sdk/extensions" -import { Injected, Inject } from '@aerokit/sdk/component' -import { EmployeeRepository } from '../../data/Employees/EmployeeRepository' -import { EmployeeEntity } from '../../data/Employees/EmployeeEntity' - -const validationModules = await Extensions.loadExtensionModules('codbex-employees-Employees-Employee', ['validate']); - -@Controller -@Documentation('codbex-employees - Employee Controller') -@Injected() -class EmployeeController { - - @Inject('EmployeeRepository') - private readonly repository!: EmployeeRepository; - - @Get('/') - @Documentation('Get All Employee') - public getAll(_: any, ctx: any): EmployeeEntity[] { - try { - this.checkPermissions('read'); - const options: Options = { - limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, - offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, - language: request.getLocale()?.split("_")[0] - }; - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/') - @Documentation('Create Employee') - public create(entity: EmployeeEntity): EmployeeEntity { - try { - this.checkPermissions('write'); - this.validateEntity(entity); - entity.Id = this.repository.create(entity) as any; - response.setHeader('Content-Location', '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts/' + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/count') - @Documentation('Count Employee') - public count(): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/count') - @Documentation('Count Employee with filter') - public countWithFilter(filter: any): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/search') - @Documentation('Search Employee') - public search(filter: any): EmployeeEntity[] { - try { - this.checkPermissions('read'); - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/:id') - @Documentation('Get Employee by id') - public getById(_: any, ctx: any): EmployeeEntity { - try { - this.checkPermissions('read'); - const id = parseInt(ctx.pathParameters.id); - const options: Options = { - language: request.getLocale()?.split("_")[0] - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound('Employee not found'); - } - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Put('/:id') - @Documentation('Update Employee by id') - public update(entity: EmployeeEntity, ctx: any): EmployeeEntity { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - entity.Id = id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Delete('/:id') - @Documentation('Delete Employee by id') - public deleteById(_: any, ctx: any): void { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound('Employee not found'); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === 'ForbiddenError') { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === 'ValidationError') { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private checkPermissions(operationType: string) { - if (operationType === 'read' && !(user.isInRole('codbex-employees.Employees.EmployeeReadOnly') || user.isInRole('codbex-employees.Employees.EmployeeFullAccess'))) { - throw new ForbiddenError(); - } - if (operationType === 'write' && !user.isInRole('codbex-employees.Employees.EmployeeFullAccess')) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.FirstName === null || entity.FirstName === undefined) { - throw new ValidationError(`The 'FirstName' property is required, provide a valid value`); - } - if (entity.FirstName?.length > 50) { - throw new ValidationError(`The 'FirstName' exceeds the maximum length of [50] characters`); - } - if (entity.MiddleName?.length > 50) { - throw new ValidationError(`The 'MiddleName' exceeds the maximum length of [50] characters`); - } - if (entity.LastName === null || entity.LastName === undefined) { - throw new ValidationError(`The 'LastName' property is required, provide a valid value`); - } - if (entity.LastName?.length > 50) { - throw new ValidationError(`The 'LastName' exceeds the maximum length of [50] characters`); - } - if (entity.Name?.length > 70) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [70] characters`); - } - if (entity.Email === null || entity.Email === undefined) { - throw new ValidationError(`The 'Email' property is required, provide a valid value`); - } - if (entity.Email?.length > 40) { - throw new ValidationError(`The 'Email' exceeds the maximum length of [40] characters`); - } - if (entity.PhoneNumber === null || entity.PhoneNumber === undefined) { - throw new ValidationError(`The 'PhoneNumber' property is required, provide a valid value`); - } - if (entity.PhoneNumber?.length > 20) { - throw new ValidationError(`The 'PhoneNumber' exceeds the maximum length of [20] characters`); - } - if (entity.BirthDate === null || entity.BirthDate === undefined) { - throw new ValidationError(`The 'BirthDate' property is required, provide a valid value`); - } - if (entity.PersonalNumber === null || entity.PersonalNumber === undefined) { - throw new ValidationError(`The 'PersonalNumber' property is required, provide a valid value`); - } - if (entity.PersonalNumber?.length > 10) { - throw new ValidationError(`The 'PersonalNumber' exceeds the maximum length of [10] characters`); - } - if (entity.Nationality === null || entity.Nationality === undefined) { - throw new ValidationError(`The 'Nationality' property is required, provide a valid value`); - } - if (entity.Gender === null || entity.Gender === undefined) { - throw new ValidationError(`The 'Gender' property is required, provide a valid value`); - } - if (entity.MartialStatus === null || entity.MartialStatus === undefined) { - throw new ValidationError(`The 'MartialStatus' property is required, provide a valid value`); - } - if (entity.IBAN === null || entity.IBAN === undefined) { - throw new ValidationError(`The 'IBAN' property is required, provide a valid value`); - } - if (entity.IBAN?.length > 34) { - throw new ValidationError(`The 'IBAN' exceeds the maximum length of [34] characters`); - } - if (!RegExp(/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/).test(entity.IBAN)) { - throw new ValidationError(`The value provided for the 'IBAN' property ('[${entity.IBAN}]') doesn't match the required pattern '^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$'`); - } - if (entity.CreatedBy?.length > 20) { - throw new ValidationError(`The 'CreatedBy' exceeds the maximum length of [20] characters`); - } - if (entity.UpdatedBy?.length > 20) { - throw new ValidationError(`The 'UpdatedBy' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts b/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts deleted file mode 100644 index 5e3a708..0000000 --- a/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' -import { HttpUtils } from "@aerokit/sdk/http/utils"; -import { ValidationError } from '@aerokit/sdk/http/errors' -import { ForbiddenError } from '@aerokit/sdk/http/errors' -import { user } from '@aerokit/sdk/security' -import { Options } from '@aerokit/sdk/db' -import { Extensions } from "@aerokit/sdk/extensions" -import { Injected, Inject } from '@aerokit/sdk/component' -import { GenderRepository } from '../../data/Settings/GenderRepository' -import { GenderEntity } from '../../data/Settings/GenderEntity' - -const validationModules = await Extensions.loadExtensionModules('codbex-employees-Settings-Gender', ['validate']); - -@Controller -@Documentation('codbex-employees - Gender Controller') -@Injected() -class GenderController { - - @Inject('GenderRepository') - private readonly repository!: GenderRepository; - - @Get('/') - @Documentation('Get All Gender') - public getAll(_: any, ctx: any): GenderEntity[] { - try { - this.checkPermissions('read'); - const options: Options = { - limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, - offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, - language: request.getLocale()?.split("_")[0] - }; - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/') - @Documentation('Create Gender') - public create(entity: GenderEntity): GenderEntity { - try { - this.checkPermissions('write'); - this.validateEntity(entity); - entity.Id = this.repository.create(entity) as any; - response.setHeader('Content-Location', '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts/' + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/count') - @Documentation('Count Gender') - public count(): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/count') - @Documentation('Count Gender with filter') - public countWithFilter(filter: any): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/search') - @Documentation('Search Gender') - public search(filter: any): GenderEntity[] { - try { - this.checkPermissions('read'); - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/:id') - @Documentation('Get Gender by id') - public getById(_: any, ctx: any): GenderEntity { - try { - this.checkPermissions('read'); - const id = parseInt(ctx.pathParameters.id); - const options: Options = { - language: request.getLocale()?.split("_")[0] - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound('Gender not found'); - } - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Put('/:id') - @Documentation('Update Gender by id') - public update(entity: GenderEntity, ctx: any): GenderEntity { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - entity.Id = id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Delete('/:id') - @Documentation('Delete Gender by id') - public deleteById(_: any, ctx: any): void { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound('Gender not found'); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === 'ForbiddenError') { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === 'ValidationError') { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private checkPermissions(operationType: string) { - if (operationType === 'read' && !(user.isInRole('codbex-employees.EmployeesSettings.GenderReadOnly') || user.isInRole('codbex-employees.EmployeesSettings.GenderFullAccess'))) { - throw new ForbiddenError(); - } - if (operationType === 'write' && !user.isInRole('codbex-employees.EmployeesSettings.GenderFullAccess')) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.Name === null || entity.Name === undefined) { - throw new ValidationError(`The 'Name' property is required, provide a valid value`); - } - if (entity.Name?.length > 7) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [7] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts b/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts deleted file mode 100644 index 2c9284b..0000000 --- a/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { Controller, Get, Post, Put, Delete, Documentation, request, response } from '@aerokit/sdk/http' -import { HttpUtils } from "@aerokit/sdk/http/utils"; -import { ValidationError } from '@aerokit/sdk/http/errors' -import { ForbiddenError } from '@aerokit/sdk/http/errors' -import { user } from '@aerokit/sdk/security' -import { Options } from '@aerokit/sdk/db' -import { Extensions } from "@aerokit/sdk/extensions" -import { Injected, Inject } from '@aerokit/sdk/component' -import { MartialStatusRepository } from '../../data/Settings/MartialStatusRepository' -import { MartialStatusEntity } from '../../data/Settings/MartialStatusEntity' - -const validationModules = await Extensions.loadExtensionModules('codbex-employees-Settings-MartialStatus', ['validate']); - -@Controller -@Documentation('codbex-employees - MartialStatus Controller') -@Injected() -class MartialStatusController { - - @Inject('MartialStatusRepository') - private readonly repository!: MartialStatusRepository; - - @Get('/') - @Documentation('Get All MartialStatus') - public getAll(_: any, ctx: any): MartialStatusEntity[] { - try { - this.checkPermissions('read'); - const options: Options = { - limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20, - offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0, - language: request.getLocale()?.split("_")[0] - }; - - return this.repository.findAll(options); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/') - @Documentation('Create MartialStatus') - public create(entity: MartialStatusEntity): MartialStatusEntity { - try { - this.checkPermissions('write'); - this.validateEntity(entity); - entity.Id = this.repository.create(entity) as any; - response.setHeader('Content-Location', '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts/' + entity.Id); - response.setStatus(response.CREATED); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/count') - @Documentation('Count MartialStatus') - public count(): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count() }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/count') - @Documentation('Count MartialStatus with filter') - public countWithFilter(filter: any): { count: number } { - try { - this.checkPermissions('read'); - return { count: this.repository.count(filter) }; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Post('/search') - @Documentation('Search MartialStatus') - public search(filter: any): MartialStatusEntity[] { - try { - this.checkPermissions('read'); - return this.repository.findAll(filter); - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Get('/:id') - @Documentation('Get MartialStatus by id') - public getById(_: any, ctx: any): MartialStatusEntity { - try { - this.checkPermissions('read'); - const id = parseInt(ctx.pathParameters.id); - const options: Options = { - language: request.getLocale()?.split("_")[0] - }; - const entity = this.repository.findById(id, options); - if (entity) { - return entity; - } else { - HttpUtils.sendResponseNotFound('MartialStatus not found'); - } - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Put('/:id') - @Documentation('Update MartialStatus by id') - public update(entity: MartialStatusEntity, ctx: any): MartialStatusEntity { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - entity.Id = id; - this.validateEntity(entity); - this.repository.update(entity); - return entity; - } catch (error: any) { - this.handleError(error); - } - return undefined as any; - } - - @Delete('/:id') - @Documentation('Delete MartialStatus by id') - public deleteById(_: any, ctx: any): void { - try { - this.checkPermissions('write'); - const id = parseInt(ctx.pathParameters.id); - const entity = this.repository.findById(id); - if (entity) { - this.repository.deleteById(id); - HttpUtils.sendResponseNoContent(); - } else { - HttpUtils.sendResponseNotFound('MartialStatus not found'); - } - } catch (error: any) { - this.handleError(error); - } - } - - private handleError(error: any) { - if (error.name === 'ForbiddenError') { - HttpUtils.sendForbiddenRequest(error.message); - } else if (error.name === 'ValidationError') { - HttpUtils.sendResponseBadRequest(error.message); - } else { - HttpUtils.sendInternalServerError(error.message); - } - } - - private checkPermissions(operationType: string) { - if (operationType === 'read' && !(user.isInRole('codbex-employees.EmployeesSettings.MartialStatusReadOnly') || user.isInRole('codbex-employees.EmployeesSettings.MartialStatusFullAccess'))) { - throw new ForbiddenError(); - } - if (operationType === 'write' && !user.isInRole('codbex-employees.EmployeesSettings.MartialStatusFullAccess')) { - throw new ForbiddenError(); - } - } - - private validateEntity(entity: any): void { - if (entity.Name === null || entity.Name === undefined) { - throw new ValidationError(`The 'Name' property is required, provide a valid value`); - } - if (entity.Name?.length > 20) { - throw new ValidationError(`The 'Name' exceeds the maximum length of [20] characters`); - } - for (const next of validationModules) { - next.validate(entity); - } - } - -} diff --git a/codbex-employees/gen/codbex-employees/data/Employees/AddressEntity.ts b/codbex-employees/gen/codbex-employees/data/Employees/AddressEntity.ts deleted file mode 100644 index 190e0b5..0000000 --- a/codbex-employees/gen/codbex-employees/data/Employees/AddressEntity.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { Entity, Table, Id, Generated, Column, Documentation, CreatedAt, CreatedBy, UpdatedAt, UpdatedBy} from '@aerokit/sdk/db' - -@Entity('AddressEntity') -@Table('CODBEX_ADDRESS') -@Documentation('Address entity mapping') -export class AddressEntity { - - @Id() - @Generated('sequence') - @Documentation('Id') - @Column({ - name: 'ADDRESS_ID', - type: 'integer', - }) - public Id?: number; - - @Documentation('Country') - @Column({ - name: 'ADDRESS_COUNTRY', - type: 'integer', - }) - public Country!: number; - - @Documentation('City') - @Column({ - name: 'ADDRESS_CITY', - type: 'integer', - }) - public City!: number; - - @Documentation('Address') - @Column({ - name: 'ADDRESS_ADDRESS', - type: 'string', - length: 255, - }) - public Address!: string; - - @Documentation('PostalCode') - @Column({ - name: 'ADDRESS_POSTALCODE', - type: 'string', - length: 12, - }) - public PostalCode!: string; - - @Documentation('Employee') - @Column({ - name: 'ADDRESS_EMPLOYEE', - type: 'integer', - nullable: true, - }) - public Employee?: number; - - @Documentation('CreatedAt') - @Column({ - name: 'ADDRESS_CREATEDAT', - type: 'timestamp', - nullable: true, - }) - @CreatedAt() - public CreatedAt?: Date; - - @Documentation('CreatedBy') - @Column({ - name: 'ADDRESS_CREATEDBY', - type: 'string', - length: 20, - nullable: true, - }) - @CreatedBy() - public CreatedBy?: string; - - @Documentation('UpdatedAt') - @Column({ - name: 'ADDRESS_UPDATEDAT', - type: 'timestamp', - nullable: true, - }) - @UpdatedAt() - public UpdatedAt?: Date; - - @Documentation('UpdatedBy') - @Column({ - name: 'ADDRESS_UPDATEDBY', - type: 'string', - length: 20, - nullable: true, - }) - @UpdatedBy() - public UpdatedBy?: string; - -} - -(new AddressEntity()); diff --git a/codbex-employees/gen/codbex-employees/data/Employees/AddressRepository.ts b/codbex-employees/gen/codbex-employees/data/Employees/AddressRepository.ts deleted file mode 100644 index 41a4d33..0000000 --- a/codbex-employees/gen/codbex-employees/data/Employees/AddressRepository.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Repository, EntityEvent, EntityConstructor, Options } from '@aerokit/sdk/db' -import { Component } from '@aerokit/sdk/component' -import { Producer } from '@aerokit/sdk/messaging' -import { Extensions } from '@aerokit/sdk/extensions' -import { AddressEntity } from './AddressEntity' - -@Component('AddressRepository') -export class AddressRepository extends Repository { - - constructor() { - super((AddressEntity as EntityConstructor)); - } - - public override findById(id: string | number, options?: Options): AddressEntity | undefined { - const entity = super.findById(id, options); - if (entity) { - entity.CreatedAt = entity.CreatedAt ? new Date(entity.CreatedAt) : undefined; - entity.UpdatedAt = entity.UpdatedAt ? new Date(entity.UpdatedAt) : undefined; - } - return entity; - } - - public override findAll(options?: Options): AddressEntity[] { - const entities = super.findAll(options); - entities.forEach(entity => { - entity.CreatedAt = entity.CreatedAt ? new Date(entity.CreatedAt) : undefined; - entity.UpdatedAt = entity.UpdatedAt ? new Date(entity.UpdatedAt) : undefined; - }); - return entities; - } - - protected override async triggerEvent(data: EntityEvent): Promise { - const triggerExtensions = await Extensions.loadExtensionModules('codbex-employees-Employees-Address', ['trigger']); - triggerExtensions.forEach(triggerExtension => { - try { - triggerExtension.trigger(data); - } catch (error) { - console.error(error); - } - }); - Producer.topic('codbex-employees-Employees-Address').send(JSON.stringify(data)); - } -} diff --git a/codbex-employees/gen/codbex-employees/data/Employees/ContactEntity.ts b/codbex-employees/gen/codbex-employees/data/Employees/ContactEntity.ts deleted file mode 100644 index 2d3057e..0000000 --- a/codbex-employees/gen/codbex-employees/data/Employees/ContactEntity.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Entity, Table, Id, Generated, Column, Documentation, CreatedAt, CreatedBy, UpdatedAt, UpdatedBy} from '@aerokit/sdk/db' - -@Entity('ContactEntity') -@Table('CODBEX_CONTACT') -@Documentation('Contact entity mapping') -export class ContactEntity { - - @Id() - @Generated('sequence') - @Documentation('Id') - @Column({ - name: 'CONTACT_ID', - type: 'integer', - }) - public Id?: number; - - @Documentation('PhoneNumber') - @Column({ - name: 'CONTACT_PHONENUMBER', - type: 'string', - length: 20, - }) - public PhoneNumber!: string; - - @Documentation('Email') - @Column({ - name: 'CONTACT_EMAIL', - type: 'string', - length: 255, - }) - public Email!: string; - - @Documentation('Employee') - @Column({ - name: 'CONTACT_EMPLOYEE', - type: 'integer', - nullable: true, - }) - public Employee?: number; - - @Documentation('CreatedAt') - @Column({ - name: 'CONTACT_CREATEDAT', - type: 'timestamp', - nullable: true, - }) - @CreatedAt() - public CreatedAt?: Date; - - @Documentation('CreatedBy') - @Column({ - name: 'CONTACT_CREATEDBY', - type: 'string', - length: 20, - nullable: true, - }) - @CreatedBy() - public CreatedBy?: string; - - @Documentation('UpdatedAt') - @Column({ - name: 'CONTACT_UPDATEDAT', - type: 'timestamp', - nullable: true, - }) - @UpdatedAt() - public UpdatedAt?: Date; - - @Documentation('UpdatedBy') - @Column({ - name: 'CONTACT_UPDATEDBY', - type: 'string', - length: 20, - nullable: true, - }) - @UpdatedBy() - public UpdatedBy?: string; - -} - -(new ContactEntity()); diff --git a/codbex-employees/gen/codbex-employees/data/Employees/ContactRepository.ts b/codbex-employees/gen/codbex-employees/data/Employees/ContactRepository.ts deleted file mode 100644 index f8cb20a..0000000 --- a/codbex-employees/gen/codbex-employees/data/Employees/ContactRepository.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Repository, EntityEvent, EntityConstructor, Options } from '@aerokit/sdk/db' -import { Component } from '@aerokit/sdk/component' -import { Producer } from '@aerokit/sdk/messaging' -import { Extensions } from '@aerokit/sdk/extensions' -import { ContactEntity } from './ContactEntity' - -@Component('ContactRepository') -export class ContactRepository extends Repository { - - constructor() { - super((ContactEntity as EntityConstructor)); - } - - public override findById(id: string | number, options?: Options): ContactEntity | undefined { - const entity = super.findById(id, options); - if (entity) { - entity.CreatedAt = entity.CreatedAt ? new Date(entity.CreatedAt) : undefined; - entity.UpdatedAt = entity.UpdatedAt ? new Date(entity.UpdatedAt) : undefined; - } - return entity; - } - - public override findAll(options?: Options): ContactEntity[] { - const entities = super.findAll(options); - entities.forEach(entity => { - entity.CreatedAt = entity.CreatedAt ? new Date(entity.CreatedAt) : undefined; - entity.UpdatedAt = entity.UpdatedAt ? new Date(entity.UpdatedAt) : undefined; - }); - return entities; - } - - protected override async triggerEvent(data: EntityEvent): Promise { - const triggerExtensions = await Extensions.loadExtensionModules('codbex-employees-Employees-Contact', ['trigger']); - triggerExtensions.forEach(triggerExtension => { - try { - triggerExtension.trigger(data); - } catch (error) { - console.error(error); - } - }); - Producer.topic('codbex-employees-Employees-Contact').send(JSON.stringify(data)); - } -} diff --git a/codbex-employees/gen/codbex-employees/data/Employees/EmployeeEntity.ts b/codbex-employees/gen/codbex-employees/data/Employees/EmployeeEntity.ts deleted file mode 100644 index 6f2a769..0000000 --- a/codbex-employees/gen/codbex-employees/data/Employees/EmployeeEntity.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { Entity, Table, Id, Generated, Column, Documentation, CreatedAt, CreatedBy, UpdatedAt, UpdatedBy} from '@aerokit/sdk/db' - -@Entity('EmployeeEntity') -@Table('CODBEX_EMPLOYEE') -@Documentation('Employee entity mapping') -export class EmployeeEntity { - - @Id() - @Generated('sequence') - @Documentation('Id') - @Column({ - name: 'EMPLOYEE_ID', - type: 'integer', - }) - public Id?: number; - - @Documentation('FirstName') - @Column({ - name: 'EMPLOYEE_FIRSTNAME', - type: 'string', - length: 50, - }) - public FirstName!: string; - - @Documentation('MiddleName') - @Column({ - name: 'EMPLOYEE_MIDDLENAME', - type: 'string', - length: 50, - nullable: true, - }) - public MiddleName?: string; - - @Documentation('LastName') - @Column({ - name: 'EMPLOYEE_LASTNAME', - type: 'string', - length: 50, - }) - public LastName!: string; - - @Documentation('Name') - @Column({ - name: 'EMPLOYEE_NAME', - type: 'string', - length: 70, - nullable: true, - }) - public Name?: string; - - @Documentation('Email') - @Column({ - name: 'EMPLOYEE_EMAIL', - type: 'string', - length: 40, - }) - public Email!: string; - - @Documentation('PhoneNumber') - @Column({ - name: 'EMPLOYEE_PHONENUMBER', - type: 'string', - length: 20, - }) - public PhoneNumber!: string; - - @Documentation('BirthDate') - @Column({ - name: 'EMPLOYEE_BIRTHDATE', - type: 'date', - }) - public BirthDate!: Date; - - @Documentation('PersonalNumber') - @Column({ - name: 'EMPLOYEE_PERSONALNUMBER', - type: 'string', - length: 10, - }) - public PersonalNumber!: string; - - @Documentation('Nationality') - @Column({ - name: 'EMPLOYEE_NATIONALITY', - type: 'integer', - }) - public Nationality!: number; - - @Documentation('Gender') - @Column({ - name: 'EMPLOYEE_GENDER', - type: 'integer', - }) - public Gender!: number; - - @Documentation('MartialStatus') - @Column({ - name: 'EMPLOYEE_MARTIALSTATUS', - type: 'integer', - }) - public MartialStatus!: number; - - @Documentation('IBAN') - @Column({ - name: 'EMPLOYEE_IBAN', - type: 'string', - length: 34, - }) - public IBAN!: string; - - @Documentation('CreatedAt') - @Column({ - name: 'EMPLOYEE_CREATEDAT', - type: 'timestamp', - nullable: true, - }) - @CreatedAt() - public CreatedAt?: Date; - - @Documentation('CreatedBy') - @Column({ - name: 'EMPLOYEE_CREATEDBY', - type: 'string', - length: 20, - nullable: true, - }) - @CreatedBy() - public CreatedBy?: string; - - @Documentation('UpdatedAt') - @Column({ - name: 'EMPLOYEE_UPDATEDAT', - type: 'timestamp', - nullable: true, - }) - @UpdatedAt() - public UpdatedAt?: Date; - - @Documentation('UpdatedBy') - @Column({ - name: 'EMPLOYEE_UPDATEDBY', - type: 'string', - length: 20, - nullable: true, - }) - @UpdatedBy() - public UpdatedBy?: string; - -} - -(new EmployeeEntity()); diff --git a/codbex-employees/gen/codbex-employees/data/Employees/EmployeeRepository.ts b/codbex-employees/gen/codbex-employees/data/Employees/EmployeeRepository.ts deleted file mode 100644 index dbcb432..0000000 --- a/codbex-employees/gen/codbex-employees/data/Employees/EmployeeRepository.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Repository, EntityEvent, EntityConstructor, Options } from '@aerokit/sdk/db' -import { Component } from '@aerokit/sdk/component' -import { Producer } from '@aerokit/sdk/messaging' -import { Extensions } from '@aerokit/sdk/extensions' -import { EmployeeEntity } from './EmployeeEntity' - -@Component('EmployeeRepository') -export class EmployeeRepository extends Repository { - - constructor() { - super((EmployeeEntity as EntityConstructor)); - } - - public override findById(id: string | number, options?: Options): EmployeeEntity | undefined { - const entity = super.findById(id, options); - if (entity) { - entity.BirthDate = entity.BirthDate ? new Date(entity.BirthDate) : undefined; - entity.CreatedAt = entity.CreatedAt ? new Date(entity.CreatedAt) : undefined; - entity.UpdatedAt = entity.UpdatedAt ? new Date(entity.UpdatedAt) : undefined; - } - return entity; - } - - public override findAll(options?: Options): EmployeeEntity[] { - const entities = super.findAll(options); - entities.forEach(entity => { - entity.BirthDate = entity.BirthDate ? new Date(entity.BirthDate) : undefined; - entity.CreatedAt = entity.CreatedAt ? new Date(entity.CreatedAt) : undefined; - entity.UpdatedAt = entity.UpdatedAt ? new Date(entity.UpdatedAt) : undefined; - }); - return entities; - } - - public override create(entity: EmployeeEntity): string | number { - entity.Name = entity["FirstName"] + " " + entity["LastName"]; - return super.create(entity); - } - - public override update(entity: EmployeeEntity): void { - entity.Name = entity["FirstName"] + " " + entity["LastName"]; - super.update(entity); - } - - public override upsert(entity: EmployeeEntity): string | number { - entity.Name = entity["FirstName"] + " " + entity["LastName"]; - entity.Name = entity["FirstName"] + " " + entity["LastName"]; - return super.upsert(entity); - } - - protected override async triggerEvent(data: EntityEvent): Promise { - const triggerExtensions = await Extensions.loadExtensionModules('codbex-employees-Employees-Employee', ['trigger']); - triggerExtensions.forEach(triggerExtension => { - try { - triggerExtension.trigger(data); - } catch (error) { - console.error(error); - } - }); - Producer.topic('codbex-employees-Employees-Employee').send(JSON.stringify(data)); - } -} diff --git a/codbex-employees/gen/codbex-employees/data/Settings/GenderEntity.ts b/codbex-employees/gen/codbex-employees/data/Settings/GenderEntity.ts deleted file mode 100644 index 3a185c8..0000000 --- a/codbex-employees/gen/codbex-employees/data/Settings/GenderEntity.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Entity, Table, Id, Generated, Column, Documentation, CreatedAt, CreatedBy, UpdatedAt, UpdatedBy} from '@aerokit/sdk/db' - -@Entity('GenderEntity') -@Table('CODBEX_GENDER') -@Documentation('Gender entity mapping') -export class GenderEntity { - - @Id() - @Generated('sequence') - @Documentation('Id') - @Column({ - name: 'GENDER_ID', - type: 'integer', - }) - public Id?: number; - - @Documentation('Name') - @Column({ - name: 'GENDER_NAME', - type: 'string', - length: 7, - nullable: true, - }) - public Name!: string; - -} - -(new GenderEntity()); diff --git a/codbex-employees/gen/codbex-employees/data/Settings/GenderRepository.ts b/codbex-employees/gen/codbex-employees/data/Settings/GenderRepository.ts deleted file mode 100644 index 40a7486..0000000 --- a/codbex-employees/gen/codbex-employees/data/Settings/GenderRepository.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Repository, EntityEvent, EntityConstructor, Options } from '@aerokit/sdk/db' -import { Component } from '@aerokit/sdk/component' -import { Producer } from '@aerokit/sdk/messaging' -import { Extensions } from '@aerokit/sdk/extensions' -import { GenderEntity } from './GenderEntity' - -@Component('GenderRepository') -export class GenderRepository extends Repository { - - constructor() { - super((GenderEntity as EntityConstructor)); - } - - protected override async triggerEvent(data: EntityEvent): Promise { - const triggerExtensions = await Extensions.loadExtensionModules('codbex-employees-Settings-Gender', ['trigger']); - triggerExtensions.forEach(triggerExtension => { - try { - triggerExtension.trigger(data); - } catch (error) { - console.error(error); - } - }); - Producer.topic('codbex-employees-Settings-Gender').send(JSON.stringify(data)); - } -} diff --git a/codbex-employees/gen/codbex-employees/data/Settings/MartialStatusEntity.ts b/codbex-employees/gen/codbex-employees/data/Settings/MartialStatusEntity.ts deleted file mode 100644 index 7215a43..0000000 --- a/codbex-employees/gen/codbex-employees/data/Settings/MartialStatusEntity.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Entity, Table, Id, Generated, Column, Documentation, CreatedAt, CreatedBy, UpdatedAt, UpdatedBy} from '@aerokit/sdk/db' - -@Entity('MartialStatusEntity') -@Table('CODBEX_MARTIALSTATUS') -@Documentation('MartialStatus entity mapping') -export class MartialStatusEntity { - - @Id() - @Generated('sequence') - @Documentation('Id') - @Column({ - name: 'MARTIALSTATUS_ID', - type: 'integer', - }) - public Id?: number; - - @Documentation('Name') - @Column({ - name: 'MARTIALSTATUS_NAME', - type: 'string', - length: 20, - nullable: true, - }) - public Name!: string; - -} - -(new MartialStatusEntity()); diff --git a/codbex-employees/gen/codbex-employees/data/Settings/MartialStatusRepository.ts b/codbex-employees/gen/codbex-employees/data/Settings/MartialStatusRepository.ts deleted file mode 100644 index 160b4cf..0000000 --- a/codbex-employees/gen/codbex-employees/data/Settings/MartialStatusRepository.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Repository, EntityEvent, EntityConstructor, Options } from '@aerokit/sdk/db' -import { Component } from '@aerokit/sdk/component' -import { Producer } from '@aerokit/sdk/messaging' -import { Extensions } from '@aerokit/sdk/extensions' -import { MartialStatusEntity } from './MartialStatusEntity' - -@Component('MartialStatusRepository') -export class MartialStatusRepository extends Repository { - - constructor() { - super((MartialStatusEntity as EntityConstructor)); - } - - protected override async triggerEvent(data: EntityEvent): Promise { - const triggerExtensions = await Extensions.loadExtensionModules('codbex-employees-Settings-MartialStatus', ['trigger']); - triggerExtensions.forEach(triggerExtension => { - try { - triggerExtension.trigger(data); - } catch (error) { - console.error(error); - } - }); - Producer.topic('codbex-employees-Settings-MartialStatus').send(JSON.stringify(data)); - } -} diff --git a/codbex-employees/gen/codbex-employees/odata/codbex-employees.odata b/codbex-employees/gen/codbex-employees/odata/codbex-employees.odata deleted file mode 100644 index f149140..0000000 --- a/codbex-employees/gen/codbex-employees/odata/codbex-employees.odata +++ /dev/null @@ -1,4 +0,0 @@ -{ - "namespace": "", - "entities": [] -} diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/controller.js index ab081e5..656fdab 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/AddressController'; }]) .controller('PageController', ($scope, $http, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); @@ -117,7 +117,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer if (optionsCountryHasMore) { const optionsCountrySearchValues = Array.from(new Set(response.data.map(e => e.Country))); if (optionsCountrySearchValues.length > 0) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Id', operator: 'IN', value: optionsCountrySearchValues } ] @@ -140,7 +140,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer if (optionsCityHasMore) { const optionsCitySearchValues = Array.from(new Set(response.data.map(e => e.City))); if (optionsCitySearchValues.length > 0) { - $http.post('/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts/search', { + $http.post('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController/search', { conditions: [ { propertyName: 'Id', operator: 'IN', value: optionsCitySearchValues } ] @@ -289,9 +289,9 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer let optionsCountryHasMore = true; - $http.get('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/count').then((response) => { + $http.get('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/count').then((response) => { const optionsCountryCount = response.data.count; - $http.get('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts').then((response) => { + $http.get('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController').then((response) => { $scope.optionsCountry = response.data.map(e => ({ value: e.Id, text: e.Name @@ -317,9 +317,9 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); let optionsCityHasMore = true; - $http.get('/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts/count').then((response) => { + $http.get('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController/count').then((response) => { const optionsCityCount = response.data.count; - $http.get('/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts').then((response) => { + $http.get('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController').then((response) => { $scope.optionsCity = response.data.map(e => ({ value: e.Id, text: e.Name diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-filter/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-filter/controller.js index c12f929..248796d 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-filter/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-filter/controller.js @@ -121,7 +121,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle $scope.loadMoreOptionsCountry = () => { const limit = 20; $scope.optionsCountryLoading = true; - $http.get(`/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCountryCounter * limit}`) + $http.get(`/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController?$limit=${limit}&$offset=${++loadMoreOptionsCountryCounter * limit}`) .then((response) => { const optionValues = allValuesCountry.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -171,7 +171,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle } }) if (!cacheHit) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -210,7 +210,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle $scope.loadMoreOptionsCity = () => { const limit = 20; $scope.optionsCityLoading = true; - $http.get(`/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCityCounter * limit}`) + $http.get(`/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController?$limit=${limit}&$offset=${++loadMoreOptionsCityCounter * limit}`) .then((response) => { const optionValues = allValuesCity.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -260,7 +260,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle } }) if (!cacheHit) { - $http.post('/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts/search', { + $http.post('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js index 6ed8be4..1e578e0 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/AddressController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/AddressController'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); @@ -94,7 +94,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); }; - $scope.serviceCountry = '/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts'; + $scope.serviceCountry = '/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController'; const lastSearchValuesCountry = new Set(); const allValuesCountry = []; @@ -105,7 +105,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsCountry = () => { const limit = 20; $scope.optionsCountryLoading = true; - $http.get(`/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCountryCounter * limit}`) + $http.get(`/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController?$limit=${limit}&$offset=${++loadMoreOptionsCountryCounter * limit}`) .then((response) => { const optionValues = allValuesCountry.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -155,7 +155,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -185,7 +185,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }; - $scope.serviceCity = '/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts'; + $scope.serviceCity = '/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController'; const lastSearchValuesCity = new Set(); const allValuesCity = []; @@ -196,7 +196,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsCity = () => { const limit = 20; $scope.optionsCityLoading = true; - $http.get(`/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCityCounter * limit}`) + $http.get(`/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController?$limit=${limit}&$offset=${++loadMoreOptionsCityCounter * limit}`) .then((response) => { const optionValues = allValuesCity.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -246,7 +246,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts/search', { + $http.post('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -286,7 +286,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer if (newValue !== undefined && newValue !== null) { $http.get($scope.serviceCountry + '/' + newValue).then((response) => { let valueFrom = response.data.Id; - $http.post('/services/ts/codbex-cities/gen/codbex-cities/api/Settings/CityController.ts/search', { + $http.post('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController/search', { conditions: [ { propertyName: 'Country', operator: 'EQ', value: valueFrom } ] diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/controller.js index bf0f97b..ef06403 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/ContactController'; }]) .controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/dialog-window/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/dialog-window/controller.js index ec6b1f2..85c884a 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/dialog-window/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Contact/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/ContactController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/ContactController'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/controller.js index 1a780fc..82fd1e3 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/EmployeeController'; }]) .controller('PageController', ($scope, $http, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); @@ -105,7 +105,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer if (optionsNationalityHasMore) { const optionsNationalitySearchValues = Array.from(new Set(response.data.map(e => e.Nationality))); if (optionsNationalitySearchValues.length > 0) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Id', operator: 'IN', value: optionsNationalitySearchValues } ] @@ -128,7 +128,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer if (optionsGenderHasMore) { const optionsGenderSearchValues = Array.from(new Set(response.data.map(e => e.Gender))); if (optionsGenderSearchValues.length > 0) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController/search', { conditions: [ { propertyName: 'Id', operator: 'IN', value: optionsGenderSearchValues } ] @@ -151,7 +151,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer if (optionsMartialStatusHasMore) { const optionsMartialStatusSearchValues = Array.from(new Set(response.data.map(e => e.MartialStatus))); if (optionsMartialStatusSearchValues.length > 0) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController/search', { conditions: [ { propertyName: 'Id', operator: 'IN', value: optionsMartialStatusSearchValues } ] @@ -291,9 +291,9 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer let optionsNationalityHasMore = true; - $http.get('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/count').then((response) => { + $http.get('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/count').then((response) => { const optionsNationalityCount = response.data.count; - $http.get('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts').then((response) => { + $http.get('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController').then((response) => { $scope.optionsNationality = response.data.map(e => ({ value: e.Id, text: e.Name @@ -319,9 +319,9 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); let optionsGenderHasMore = true; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts/count').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController/count').then((response) => { const optionsGenderCount = response.data.count; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController').then((response) => { $scope.optionsGender = response.data.map(e => ({ value: e.Id, text: e.Name @@ -347,9 +347,9 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); let optionsMartialStatusHasMore = true; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts/count').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController/count').then((response) => { const optionsMartialStatusCount = response.data.count; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController').then((response) => { $scope.optionsMartialStatus = response.data.map(e => ({ value: e.Id, text: e.Name diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-filter/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-filter/controller.js index bcc41c7..3addb39 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-filter/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-filter/controller.js @@ -165,7 +165,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle $scope.loadMoreOptionsNationality = () => { const limit = 20; $scope.optionsNationalityLoading = true; - $http.get(`/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts?$limit=${limit}&$offset=${++loadMoreOptionsNationalityCounter * limit}`) + $http.get(`/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController?$limit=${limit}&$offset=${++loadMoreOptionsNationalityCounter * limit}`) .then((response) => { const optionValues = allValuesNationality.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -215,7 +215,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle } }) if (!cacheHit) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -254,7 +254,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle $scope.loadMoreOptionsGender = () => { const limit = 20; $scope.optionsGenderLoading = true; - $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts?$limit=${limit}&$offset=${++loadMoreOptionsGenderCounter * limit}`) + $http.get(`/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController?$limit=${limit}&$offset=${++loadMoreOptionsGenderCounter * limit}`) .then((response) => { const optionValues = allValuesGender.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -304,7 +304,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle } }) if (!cacheHit) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -343,7 +343,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle $scope.loadMoreOptionsMartialStatus = () => { const limit = 20; $scope.optionsMartialStatusLoading = true; - $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts?$limit=${limit}&$offset=${++loadMoreOptionsMartialStatusCounter * limit}`) + $http.get(`/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController?$limit=${limit}&$offset=${++loadMoreOptionsMartialStatusCounter * limit}`) .then((response) => { const optionValues = allValuesMartialStatus.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -393,7 +393,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle } }) if (!cacheHit) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-window/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-window/controller.js index cfdf057..7228c8a 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-window/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/EmployeeController'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); @@ -95,11 +95,11 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); }; - $scope.serviceNationality = '/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts'; + $scope.serviceNationality = '/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController'; $scope.optionsNationality = []; - $http.get('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts').then((response) => { + $http.get('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController').then((response) => { $scope.optionsNationality = response.data.map(e => ({ value: e.Id, text: e.Name @@ -123,7 +123,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsNationality = () => { const limit = 20; $scope.optionsNationalityLoading = true; - $http.get(`/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts?$limit=${limit}&$offset=${++loadMoreOptionsNationalityCounter * limit}`) + $http.get(`/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController?$limit=${limit}&$offset=${++loadMoreOptionsNationalityCounter * limit}`) .then((response) => { const optionValues = allValuesNationality.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -173,7 +173,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -202,11 +202,11 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } } }; - $scope.serviceGender = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts'; + $scope.serviceGender = '/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController'; $scope.optionsGender = []; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController').then((response) => { $scope.optionsGender = response.data.map(e => ({ value: e.Id, text: e.Name @@ -230,7 +230,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsGender = () => { const limit = 20; $scope.optionsGenderLoading = true; - $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts?$limit=${limit}&$offset=${++loadMoreOptionsGenderCounter * limit}`) + $http.get(`/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController?$limit=${limit}&$offset=${++loadMoreOptionsGenderCounter * limit}`) .then((response) => { const optionValues = allValuesGender.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -280,7 +280,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -309,11 +309,11 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } } }; - $scope.serviceMartialStatus = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts'; + $scope.serviceMartialStatus = '/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController'; $scope.optionsMartialStatus = []; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController').then((response) => { $scope.optionsMartialStatus = response.data.map(e => ({ value: e.Id, text: e.Name @@ -337,7 +337,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsMartialStatus = () => { const limit = 20; $scope.optionsMartialStatusLoading = true; - $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts?$limit=${limit}&$offset=${++loadMoreOptionsMartialStatusCounter * limit}`) + $http.get(`/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController?$limit=${limit}&$offset=${++loadMoreOptionsMartialStatusCounter * limit}`) .then((response) => { const optionValues = allValuesMartialStatus.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -387,7 +387,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/main-details/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/main-details/controller.js index 63160d0..2bf2e84 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/main-details/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/main-details/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(["EntityServiceProvider", (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/employees/EmployeeController'; }]) .controller('PageController', ($scope, $http, Extensions, LocaleService, EntityService) => { const Dialogs = new DialogHub(); @@ -102,9 +102,9 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer }); }}); - $scope.serviceNationality = '/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts'; - $scope.serviceGender = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts'; - $scope.serviceMartialStatus = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts'; + $scope.serviceNationality = '/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController'; + $scope.serviceGender = '/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController'; + $scope.serviceMartialStatus = '/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController'; //-----------------Events-------------------// @@ -208,7 +208,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsNationality = () => { const limit = 20; $scope.optionsNationalityLoading = true; - $http.get(`/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts?$limit=${limit}&$offset=${++loadMoreOptionsNationalityCounter * limit}`) + $http.get(`/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController?$limit=${limit}&$offset=${++loadMoreOptionsNationalityCounter * limit}`) .then((response) => { const optionValues = allValuesNationality.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -258,7 +258,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts/search', { + $http.post('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -290,7 +290,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.refreshNationality = () => { $scope.optionsNationality = []; - $http.get('/services/ts/codbex-countries/gen/codbex-countries/api/Settings/CountryController.ts').then((response) => { + $http.get('/services/java/codbex-countries/gen/codbex_countries/api/settings/CountryController').then((response) => { $scope.optionsNationality = response.data.map(e => ({ value: e.Id, text: e.Name @@ -315,7 +315,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsGender = () => { const limit = 20; $scope.optionsGenderLoading = true; - $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts?$limit=${limit}&$offset=${++loadMoreOptionsGenderCounter * limit}`) + $http.get(`/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController?$limit=${limit}&$offset=${++loadMoreOptionsGenderCounter * limit}`) .then((response) => { const optionValues = allValuesGender.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -365,7 +365,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -397,7 +397,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.refreshGender = () => { $scope.optionsGender = []; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController').then((response) => { $scope.optionsGender = response.data.map(e => ({ value: e.Id, text: e.Name @@ -422,7 +422,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.loadMoreOptionsMartialStatus = () => { const limit = 20; $scope.optionsMartialStatusLoading = true; - $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts?$limit=${limit}&$offset=${++loadMoreOptionsMartialStatusCounter * limit}`) + $http.get(`/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController?$limit=${limit}&$offset=${++loadMoreOptionsMartialStatusCounter * limit}`) .then((response) => { const optionValues = allValuesMartialStatus.map(e => e.value); const resultValues = response.data.map(e => ({ @@ -472,7 +472,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer } }) if (!cacheHit) { - $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts/search', { + $http.post('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController/search', { conditions: [ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` } ] @@ -504,7 +504,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer $scope.refreshMartialStatus = () => { $scope.optionsMartialStatus = []; - $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts').then((response) => { + $http.get('/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController').then((response) => { $scope.optionsMartialStatus = response.data.map(e => ({ value: e.Id, text: e.Name diff --git a/codbex-employees/gen/codbex-employees/ui/Settings/Gender/controller.js b/codbex-employees/gen/codbex-employees/ui/Settings/Gender/controller.js index 9006bda..0c670e3 100644 --- a/codbex-employees/gen/codbex-employees/ui/Settings/Gender/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Settings/Gender/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController'; }]) .controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); diff --git a/codbex-employees/gen/codbex-employees/ui/Settings/Gender/dialog-window/controller.js b/codbex-employees/gen/codbex-employees/ui/Settings/Gender/dialog-window/controller.js index 4eac415..fd14ba2 100644 --- a/codbex-employees/gen/codbex-employees/ui/Settings/Gender/dialog-window/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Settings/Gender/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/GenderController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/settings/GenderController'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); diff --git a/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/controller.js b/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/controller.js index a775df2..d518b74 100644 --- a/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController'; }]) .controller('PageController', ($scope, EntityService, Extensions, LocaleService, ButtonStates) => { const Dialogs = new DialogHub(); diff --git a/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/dialog-window/controller.js b/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/dialog-window/controller.js index bab7eca..dfd043b 100644 --- a/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/dialog-window/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Settings/MartialStatus/dialog-window/controller.js @@ -1,6 +1,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntityService']) .config(['EntityServiceProvider', (EntityServiceProvider) => { - EntityServiceProvider.baseUrl = '/services/ts/codbex-employees/gen/codbex-employees/api/Settings/MartialStatusController.ts'; + EntityServiceProvider.baseUrl = '/services/java/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController'; }]) .controller('PageController', ($scope, $http, ViewParameters, LocaleService, EntityService) => { const Dialogs = new DialogHub(); diff --git a/codbex-employees/gen/codbex_employees/api/employees/AddressController.java b/codbex-employees/gen/codbex_employees/api/employees/AddressController.java new file mode 100644 index 0000000..8a04509 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/api/employees/AddressController.java @@ -0,0 +1,179 @@ +package gen.codbex_employees.api.employees; + +import gen.codbex_employees.data.employees.AddressEntity; +import gen.codbex_employees.data.employees.AddressRepository; + +import org.eclipse.dirigible.components.api.security.UserFacade; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Inject; +import org.eclipse.dirigible.engine.java.annotations.http.Body; +import org.eclipse.dirigible.engine.java.annotations.http.Controller; +import org.eclipse.dirigible.engine.java.annotations.http.Delete; +import org.eclipse.dirigible.engine.java.annotations.http.Get; +import org.eclipse.dirigible.engine.java.annotations.http.PathParam; +import org.eclipse.dirigible.engine.java.annotations.http.Post; +import org.eclipse.dirigible.engine.java.annotations.http.Put; +import org.eclipse.dirigible.engine.java.annotations.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-employees - Address Controller") +public class AddressController { + + private static final Set FILTER_FIELDS = Set.of("Id", "Country", "City", "Address", "PostalCode", "Employee", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy"); + + @Inject + private AddressRepository repository; + + @Get + @Documentation("List Address") + public List getAll(@QueryParam("$limit") Integer limit, + @QueryParam("$offset") Integer offset, + @QueryParam("Employee") String Employee) { + int actualLimit = limit != null ? limit.intValue() : 20; + int actualOffset = offset != null ? offset.intValue() : 0; + List result; + if (Employee != null) { + Map params = new LinkedHashMap<>(); + params.put("Employee", Employee); + result = repository.query("from AddressEntity e where e.Employee = :Employee", params); + } else { + result = repository.findAll(actualLimit, actualOffset); + } + return result; + } + + @Get("/count") + @Documentation("Count Address") + public Map count() { + return Map.of("count", repository.count()); + } + + @Post("/count") + @Documentation("Count Address with filter") + public Map countWithFilter(@Body Map filter) { + return Map.of("count", (long) runFilter(filter).size()); + } + + @Post("/search") + @Documentation("Search Address") + public List search(@Body Map filter) { + List result = runFilter(filter); + return result; + } + + @Get("/{id}") + @Documentation("Get Address by id") + public AddressEntity getById(@PathParam("id") Integer id) { + AddressEntity entity = repository.findOne(id) + .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Address not found")); + return entity; + } + + @Post + @Documentation("Create Address") + public AddressEntity create(@Body AddressEntity entity) { + validate(entity); + return repository.save(entity); + } + + @Put("/{id}") + @Documentation("Update Address by id") + public AddressEntity update(@PathParam("id") Integer id, @Body AddressEntity entity) { + entity.Id = id; + validate(entity); + return repository.update(entity); + } + + @Delete("/{id}") + @Documentation("Delete Address by id") + public void deleteById(@PathParam("id") Integer id) { + if (repository.findOne(id).isEmpty()) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Address not found"); + } + repository.deleteById(id); + } + + private List runFilter(Map filter) { + StringBuilder hql = new StringBuilder("from AddressEntity 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(AddressEntity entity) { + 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.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() > 12) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PostalCode' exceeds the maximum length of 12"); + } + 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-employees/gen/codbex_employees/api/employees/ContactController.java b/codbex-employees/gen/codbex_employees/api/employees/ContactController.java new file mode 100644 index 0000000..23ccca6 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/api/employees/ContactController.java @@ -0,0 +1,190 @@ +package gen.codbex_employees.api.employees; + +import gen.codbex_employees.data.employees.ContactEntity; +import gen.codbex_employees.data.employees.ContactRepository; + +import org.eclipse.dirigible.components.api.security.UserFacade; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Inject; +import org.eclipse.dirigible.engine.java.annotations.http.Body; +import org.eclipse.dirigible.engine.java.annotations.http.Controller; +import org.eclipse.dirigible.engine.java.annotations.http.Delete; +import org.eclipse.dirigible.engine.java.annotations.http.Get; +import org.eclipse.dirigible.engine.java.annotations.http.PathParam; +import org.eclipse.dirigible.engine.java.annotations.http.Post; +import org.eclipse.dirigible.engine.java.annotations.http.Put; +import org.eclipse.dirigible.engine.java.annotations.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-employees - Contact Controller") +public class ContactController { + + private static final Set FILTER_FIELDS = Set.of("Id", "PhoneNumber", "Email", "Employee", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy"); + + @Inject + private ContactRepository repository; + + @Get + @Documentation("List Contact") + public List getAll(@QueryParam("$limit") Integer limit, + @QueryParam("$offset") Integer offset, + @QueryParam("Employee") String Employee) { + checkPermissions("read"); + int actualLimit = limit != null ? limit.intValue() : 20; + int actualOffset = offset != null ? offset.intValue() : 0; + List result; + if (Employee != null) { + Map params = new LinkedHashMap<>(); + params.put("Employee", Employee); + result = repository.query("from ContactEntity e where e.Employee = :Employee", params); + } else { + result = repository.findAll(actualLimit, actualOffset); + } + return result; + } + + @Get("/count") + @Documentation("Count Contact") + public Map count() { + checkPermissions("read"); + return Map.of("count", repository.count()); + } + + @Post("/count") + @Documentation("Count Contact with filter") + public Map countWithFilter(@Body Map filter) { + checkPermissions("read"); + return Map.of("count", (long) runFilter(filter).size()); + } + + @Post("/search") + @Documentation("Search Contact") + public List search(@Body Map filter) { + checkPermissions("read"); + List result = runFilter(filter); + return result; + } + + @Get("/{id}") + @Documentation("Get Contact by id") + public ContactEntity getById(@PathParam("id") Integer id) { + checkPermissions("read"); + ContactEntity entity = repository.findOne(id) + .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Contact not found")); + return entity; + } + + @Post + @Documentation("Create Contact") + public ContactEntity create(@Body ContactEntity entity) { + checkPermissions("write"); + validate(entity); + return repository.save(entity); + } + + @Put("/{id}") + @Documentation("Update Contact by id") + public ContactEntity update(@PathParam("id") Integer id, @Body ContactEntity entity) { + checkPermissions("write"); + entity.Id = id; + validate(entity); + return repository.update(entity); + } + + @Delete("/{id}") + @Documentation("Delete Contact by id") + public void deleteById(@PathParam("id") Integer id) { + checkPermissions("write"); + if (repository.findOne(id).isEmpty()) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Contact not found"); + } + repository.deleteById(id); + } + + private List runFilter(Map filter) { + StringBuilder hql = new StringBuilder("from ContactEntity 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-employees.Employees.ContactReadOnly") || UserFacade.isInRole("codbex-employees.Employees.ContactFullAccess"))) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + if ("write".equals(op) && !UserFacade.isInRole("codbex-employees.Employees.ContactFullAccess")) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + } + + private static void validate(ContactEntity entity) { + if (entity.PhoneNumber == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PhoneNumber' property is required"); + } + if (entity.PhoneNumber != null && entity.PhoneNumber.length() > 20) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PhoneNumber' exceeds the maximum length of 20"); + } + if (entity.Email == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required"); + } + if (entity.Email != null && entity.Email.length() > 255) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 255"); + } + 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-employees/gen/codbex_employees/api/employees/EmployeeController.java b/codbex-employees/gen/codbex_employees/api/employees/EmployeeController.java new file mode 100644 index 0000000..8cce30f --- /dev/null +++ b/codbex-employees/gen/codbex_employees/api/employees/EmployeeController.java @@ -0,0 +1,227 @@ +package gen.codbex_employees.api.employees; + +import gen.codbex_employees.data.employees.EmployeeEntity; +import gen.codbex_employees.data.employees.EmployeeRepository; + +import org.eclipse.dirigible.components.api.security.UserFacade; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Inject; +import org.eclipse.dirigible.engine.java.annotations.http.Body; +import org.eclipse.dirigible.engine.java.annotations.http.Controller; +import org.eclipse.dirigible.engine.java.annotations.http.Delete; +import org.eclipse.dirigible.engine.java.annotations.http.Get; +import org.eclipse.dirigible.engine.java.annotations.http.PathParam; +import org.eclipse.dirigible.engine.java.annotations.http.Post; +import org.eclipse.dirigible.engine.java.annotations.http.Put; +import org.eclipse.dirigible.engine.java.annotations.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-employees - Employee Controller") +public class EmployeeController { + + private static final Set FILTER_FIELDS = Set.of("Id", "FirstName", "MiddleName", "LastName", "Name", "Email", "PhoneNumber", "BirthDate", "PersonalNumber", "Nationality", "Gender", "MartialStatus", "IBAN", "CreatedAt", "CreatedBy", "UpdatedAt", "UpdatedBy"); + + @Inject + private EmployeeRepository repository; + + @Get + @Documentation("List Employee") + 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 Employee") + public Map count() { + checkPermissions("read"); + return Map.of("count", repository.count()); + } + + @Post("/count") + @Documentation("Count Employee with filter") + public Map countWithFilter(@Body Map filter) { + checkPermissions("read"); + return Map.of("count", (long) runFilter(filter).size()); + } + + @Post("/search") + @Documentation("Search Employee") + public List search(@Body Map filter) { + checkPermissions("read"); + List result = runFilter(filter); + return result; + } + + @Get("/{id}") + @Documentation("Get Employee by id") + public EmployeeEntity getById(@PathParam("id") Integer id) { + checkPermissions("read"); + EmployeeEntity entity = repository.findOne(id) + .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Employee not found")); + return entity; + } + + @Post + @Documentation("Create Employee") + public EmployeeEntity create(@Body EmployeeEntity entity) { + checkPermissions("write"); + validate(entity); + return repository.save(entity); + } + + @Put("/{id}") + @Documentation("Update Employee by id") + public EmployeeEntity update(@PathParam("id") Integer id, @Body EmployeeEntity entity) { + checkPermissions("write"); + entity.Id = id; + validate(entity); + return repository.update(entity); + } + + @Delete("/{id}") + @Documentation("Delete Employee by id") + public void deleteById(@PathParam("id") Integer id) { + checkPermissions("write"); + if (repository.findOne(id).isEmpty()) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Employee not found"); + } + repository.deleteById(id); + } + + private List runFilter(Map filter) { + StringBuilder hql = new StringBuilder("from EmployeeEntity 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-employees.Employees.EmployeeReadOnly") || UserFacade.isInRole("codbex-employees.Employees.EmployeeFullAccess"))) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + if ("write".equals(op) && !UserFacade.isInRole("codbex-employees.Employees.EmployeeFullAccess")) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + } + + private static void validate(EmployeeEntity entity) { + if (entity.FirstName == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'FirstName' property is required"); + } + if (entity.FirstName != null && entity.FirstName.length() > 50) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'FirstName' exceeds the maximum length of 50"); + } + if (entity.MiddleName != null && entity.MiddleName.length() > 50) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'MiddleName' exceeds the maximum length of 50"); + } + if (entity.LastName == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LastName' property is required"); + } + if (entity.LastName != null && entity.LastName.length() > 50) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'LastName' exceeds the maximum length of 50"); + } + if (entity.Name != null && entity.Name.length() > 70) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 70"); + } + if (entity.Email == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' property is required"); + } + if (entity.Email != null && entity.Email.length() > 40) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Email' exceeds the maximum length of 40"); + } + if (entity.PhoneNumber == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PhoneNumber' property is required"); + } + if (entity.PhoneNumber != null && entity.PhoneNumber.length() > 20) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PhoneNumber' exceeds the maximum length of 20"); + } + if (entity.BirthDate == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'BirthDate' property is required"); + } + if (entity.PersonalNumber == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PersonalNumber' property is required"); + } + if (entity.PersonalNumber != null && entity.PersonalNumber.length() > 10) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'PersonalNumber' exceeds the maximum length of 10"); + } + if (entity.Nationality == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Nationality' property is required"); + } + if (entity.Gender == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Gender' property is required"); + } + if (entity.MartialStatus == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'MartialStatus' property is required"); + } + 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-employees/gen/codbex_employees/api/settings/GenderController.java b/codbex-employees/gen/codbex_employees/api/settings/GenderController.java new file mode 100644 index 0000000..4e1d724 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/api/settings/GenderController.java @@ -0,0 +1,170 @@ +package gen.codbex_employees.api.settings; + +import gen.codbex_employees.data.settings.GenderEntity; +import gen.codbex_employees.data.settings.GenderRepository; + +import org.eclipse.dirigible.components.api.security.UserFacade; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Inject; +import org.eclipse.dirigible.engine.java.annotations.http.Body; +import org.eclipse.dirigible.engine.java.annotations.http.Controller; +import org.eclipse.dirigible.engine.java.annotations.http.Delete; +import org.eclipse.dirigible.engine.java.annotations.http.Get; +import org.eclipse.dirigible.engine.java.annotations.http.PathParam; +import org.eclipse.dirigible.engine.java.annotations.http.Post; +import org.eclipse.dirigible.engine.java.annotations.http.Put; +import org.eclipse.dirigible.engine.java.annotations.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-employees - Gender Controller") +public class GenderController { + + private static final Set FILTER_FIELDS = Set.of("Id", "Name"); + + @Inject + private GenderRepository repository; + + @Get + @Documentation("List Gender") + 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 Gender") + public Map count() { + checkPermissions("read"); + return Map.of("count", repository.count()); + } + + @Post("/count") + @Documentation("Count Gender with filter") + public Map countWithFilter(@Body Map filter) { + checkPermissions("read"); + return Map.of("count", (long) runFilter(filter).size()); + } + + @Post("/search") + @Documentation("Search Gender") + public List search(@Body Map filter) { + checkPermissions("read"); + List result = runFilter(filter); + return result; + } + + @Get("/{id}") + @Documentation("Get Gender by id") + public GenderEntity getById(@PathParam("id") Integer id) { + checkPermissions("read"); + GenderEntity entity = repository.findOne(id) + .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Gender not found")); + return entity; + } + + @Post + @Documentation("Create Gender") + public GenderEntity create(@Body GenderEntity entity) { + checkPermissions("write"); + validate(entity); + return repository.save(entity); + } + + @Put("/{id}") + @Documentation("Update Gender by id") + public GenderEntity update(@PathParam("id") Integer id, @Body GenderEntity entity) { + checkPermissions("write"); + entity.Id = id; + validate(entity); + return repository.update(entity); + } + + @Delete("/{id}") + @Documentation("Delete Gender by id") + public void deleteById(@PathParam("id") Integer id) { + checkPermissions("write"); + if (repository.findOne(id).isEmpty()) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Gender not found"); + } + repository.deleteById(id); + } + + private List runFilter(Map filter) { + StringBuilder hql = new StringBuilder("from GenderEntity 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-employees.EmployeesSettings.GenderReadOnly") || UserFacade.isInRole("codbex-employees.EmployeesSettings.GenderFullAccess"))) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + if ("write".equals(op) && !UserFacade.isInRole("codbex-employees.EmployeesSettings.GenderFullAccess")) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + } + + private static void validate(GenderEntity entity) { + if (entity.Name == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' property is required"); + } + if (entity.Name != null && entity.Name.length() > 7) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 7"); + } + } +} diff --git a/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController.java b/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController.java new file mode 100644 index 0000000..5a8868f --- /dev/null +++ b/codbex-employees/gen/codbex_employees/api/settings/MartialStatusController.java @@ -0,0 +1,170 @@ +package gen.codbex_employees.api.settings; + +import gen.codbex_employees.data.settings.MartialStatusEntity; +import gen.codbex_employees.data.settings.MartialStatusRepository; + +import org.eclipse.dirigible.components.api.security.UserFacade; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Inject; +import org.eclipse.dirigible.engine.java.annotations.http.Body; +import org.eclipse.dirigible.engine.java.annotations.http.Controller; +import org.eclipse.dirigible.engine.java.annotations.http.Delete; +import org.eclipse.dirigible.engine.java.annotations.http.Get; +import org.eclipse.dirigible.engine.java.annotations.http.PathParam; +import org.eclipse.dirigible.engine.java.annotations.http.Post; +import org.eclipse.dirigible.engine.java.annotations.http.Put; +import org.eclipse.dirigible.engine.java.annotations.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-employees - MartialStatus Controller") +public class MartialStatusController { + + private static final Set FILTER_FIELDS = Set.of("Id", "Name"); + + @Inject + private MartialStatusRepository repository; + + @Get + @Documentation("List MartialStatus") + 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 MartialStatus") + public Map count() { + checkPermissions("read"); + return Map.of("count", repository.count()); + } + + @Post("/count") + @Documentation("Count MartialStatus with filter") + public Map countWithFilter(@Body Map filter) { + checkPermissions("read"); + return Map.of("count", (long) runFilter(filter).size()); + } + + @Post("/search") + @Documentation("Search MartialStatus") + public List search(@Body Map filter) { + checkPermissions("read"); + List result = runFilter(filter); + return result; + } + + @Get("/{id}") + @Documentation("Get MartialStatus by id") + public MartialStatusEntity getById(@PathParam("id") Integer id) { + checkPermissions("read"); + MartialStatusEntity entity = repository.findOne(id) + .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "MartialStatus not found")); + return entity; + } + + @Post + @Documentation("Create MartialStatus") + public MartialStatusEntity create(@Body MartialStatusEntity entity) { + checkPermissions("write"); + validate(entity); + return repository.save(entity); + } + + @Put("/{id}") + @Documentation("Update MartialStatus by id") + public MartialStatusEntity update(@PathParam("id") Integer id, @Body MartialStatusEntity entity) { + checkPermissions("write"); + entity.Id = id; + validate(entity); + return repository.update(entity); + } + + @Delete("/{id}") + @Documentation("Delete MartialStatus by id") + public void deleteById(@PathParam("id") Integer id) { + checkPermissions("write"); + if (repository.findOne(id).isEmpty()) { + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "MartialStatus not found"); + } + repository.deleteById(id); + } + + private List runFilter(Map filter) { + StringBuilder hql = new StringBuilder("from MartialStatusEntity 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-employees.EmployeesSettings.MartialStatusReadOnly") || UserFacade.isInRole("codbex-employees.EmployeesSettings.MartialStatusFullAccess"))) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + if ("write".equals(op) && !UserFacade.isInRole("codbex-employees.EmployeesSettings.MartialStatusFullAccess")) { + throw new ResponseStatusException(HttpStatus.FORBIDDEN); + } + } + + private static void validate(MartialStatusEntity entity) { + if (entity.Name == null) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' property is required"); + } + if (entity.Name != null && entity.Name.length() > 20) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The 'Name' exceeds the maximum length of 20"); + } + } +} diff --git a/codbex-employees/gen/codbex-employees/data/Employees/Address.extensionpoint b/codbex-employees/gen/codbex_employees/data/employees/Address.extensionpoint similarity index 98% rename from codbex-employees/gen/codbex-employees/data/Employees/Address.extensionpoint rename to codbex-employees/gen/codbex_employees/data/employees/Address.extensionpoint index 886bf26..16b94f9 100644 --- a/codbex-employees/gen/codbex-employees/data/Employees/Address.extensionpoint +++ b/codbex-employees/gen/codbex_employees/data/employees/Address.extensionpoint @@ -1,4 +1,4 @@ { "name": "codbex-employees-Employees-Address", "description": "Extension Point for the codbex-employees-Employees-Address entity" -} \ No newline at end of file +} diff --git a/codbex-employees/gen/codbex_employees/data/employees/AddressEntity.java b/codbex-employees/gen/codbex_employees/data/employees/AddressEntity.java new file mode 100644 index 0000000..1c21317 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/employees/AddressEntity.java @@ -0,0 +1,66 @@ +package gen.codbex_employees.data.employees; + +import org.eclipse.dirigible.engine.java.annotations.Column; +import org.eclipse.dirigible.engine.java.annotations.CreatedAt; +import org.eclipse.dirigible.engine.java.annotations.CreatedBy; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Entity; +import org.eclipse.dirigible.engine.java.annotations.GeneratedValue; +import org.eclipse.dirigible.engine.java.annotations.GenerationType; +import org.eclipse.dirigible.engine.java.annotations.Id; +import org.eclipse.dirigible.engine.java.annotations.Table; +import org.eclipse.dirigible.engine.java.annotations.UpdatedAt; +import org.eclipse.dirigible.engine.java.annotations.UpdatedBy; + +@Entity +@Table(name = "CODBEX_ADDRESS") +@Documentation("Address entity mapping") +public class AddressEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "ADDRESS_ID") + @Documentation("Id") + public Integer Id; + + @Column(name = "ADDRESS_COUNTRY", nullable = false) + @Documentation("Country") + public Integer Country; + + @Column(name = "ADDRESS_CITY", nullable = false) + @Documentation("City") + public Integer City; + + @Column(name = "ADDRESS_ADDRESS", length = 255, nullable = false) + @Documentation("Address") + public String Address; + + @Column(name = "ADDRESS_POSTALCODE", length = 12, nullable = false) + @Documentation("PostalCode") + public String PostalCode; + + @Column(name = "ADDRESS_EMPLOYEE", nullable = true) + @Documentation("Employee") + public Integer Employee; + + @CreatedAt + @Column(name = "ADDRESS_CREATEDAT", nullable = true) + @Documentation("CreatedAt") + public java.time.Instant CreatedAt; + + @CreatedBy + @Column(name = "ADDRESS_CREATEDBY", length = 20, nullable = true) + @Documentation("CreatedBy") + public String CreatedBy; + + @UpdatedAt + @Column(name = "ADDRESS_UPDATEDAT", nullable = true) + @Documentation("UpdatedAt") + public java.time.Instant UpdatedAt; + + @UpdatedBy + @Column(name = "ADDRESS_UPDATEDBY", length = 20, nullable = true) + @Documentation("UpdatedBy") + public String UpdatedBy; + +} diff --git a/codbex-employees/gen/codbex_employees/data/employees/AddressRepository.java b/codbex-employees/gen/codbex_employees/data/employees/AddressRepository.java new file mode 100644 index 0000000..8cf5d74 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/employees/AddressRepository.java @@ -0,0 +1,12 @@ +package gen.codbex_employees.data.employees; + +import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository; +import org.eclipse.dirigible.engine.java.annotations.Repository; + +@Repository +public class AddressRepository extends JavaRepository { + + public AddressRepository() { + super(AddressEntity.class); + } +} diff --git a/codbex-employees/gen/codbex-employees/data/Employees/Contact.extensionpoint b/codbex-employees/gen/codbex_employees/data/employees/Contact.extensionpoint similarity index 98% rename from codbex-employees/gen/codbex-employees/data/Employees/Contact.extensionpoint rename to codbex-employees/gen/codbex_employees/data/employees/Contact.extensionpoint index 3da3b3e..623d440 100644 --- a/codbex-employees/gen/codbex-employees/data/Employees/Contact.extensionpoint +++ b/codbex-employees/gen/codbex_employees/data/employees/Contact.extensionpoint @@ -1,4 +1,4 @@ { "name": "codbex-employees-Employees-Contact", "description": "Extension Point for the codbex-employees-Employees-Contact entity" -} \ No newline at end of file +} diff --git a/codbex-employees/gen/codbex_employees/data/employees/ContactEntity.java b/codbex-employees/gen/codbex_employees/data/employees/ContactEntity.java new file mode 100644 index 0000000..61b4de9 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/employees/ContactEntity.java @@ -0,0 +1,58 @@ +package gen.codbex_employees.data.employees; + +import org.eclipse.dirigible.engine.java.annotations.Column; +import org.eclipse.dirigible.engine.java.annotations.CreatedAt; +import org.eclipse.dirigible.engine.java.annotations.CreatedBy; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Entity; +import org.eclipse.dirigible.engine.java.annotations.GeneratedValue; +import org.eclipse.dirigible.engine.java.annotations.GenerationType; +import org.eclipse.dirigible.engine.java.annotations.Id; +import org.eclipse.dirigible.engine.java.annotations.Table; +import org.eclipse.dirigible.engine.java.annotations.UpdatedAt; +import org.eclipse.dirigible.engine.java.annotations.UpdatedBy; + +@Entity +@Table(name = "CODBEX_CONTACT") +@Documentation("Contact entity mapping") +public class ContactEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "CONTACT_ID") + @Documentation("Id") + public Integer Id; + + @Column(name = "CONTACT_PHONENUMBER", length = 20, nullable = false) + @Documentation("PhoneNumber") + public String PhoneNumber; + + @Column(name = "CONTACT_EMAIL", length = 255, nullable = false, unique = true) + @Documentation("Email") + public String Email; + + @Column(name = "CONTACT_EMPLOYEE", nullable = true) + @Documentation("Employee") + public Integer Employee; + + @CreatedAt + @Column(name = "CONTACT_CREATEDAT", nullable = true) + @Documentation("CreatedAt") + public java.time.Instant CreatedAt; + + @CreatedBy + @Column(name = "CONTACT_CREATEDBY", length = 20, nullable = true) + @Documentation("CreatedBy") + public String CreatedBy; + + @UpdatedAt + @Column(name = "CONTACT_UPDATEDAT", nullable = true) + @Documentation("UpdatedAt") + public java.time.Instant UpdatedAt; + + @UpdatedBy + @Column(name = "CONTACT_UPDATEDBY", length = 20, nullable = true) + @Documentation("UpdatedBy") + public String UpdatedBy; + +} diff --git a/codbex-employees/gen/codbex_employees/data/employees/ContactRepository.java b/codbex-employees/gen/codbex_employees/data/employees/ContactRepository.java new file mode 100644 index 0000000..b3e4d26 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/employees/ContactRepository.java @@ -0,0 +1,12 @@ +package gen.codbex_employees.data.employees; + +import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository; +import org.eclipse.dirigible.engine.java.annotations.Repository; + +@Repository +public class ContactRepository extends JavaRepository { + + public ContactRepository() { + super(ContactEntity.class); + } +} diff --git a/codbex-employees/gen/codbex-employees/data/Employees/Employee.extensionpoint b/codbex-employees/gen/codbex_employees/data/employees/Employee.extensionpoint similarity index 98% rename from codbex-employees/gen/codbex-employees/data/Employees/Employee.extensionpoint rename to codbex-employees/gen/codbex_employees/data/employees/Employee.extensionpoint index 1fd032c..d482f67 100644 --- a/codbex-employees/gen/codbex-employees/data/Employees/Employee.extensionpoint +++ b/codbex-employees/gen/codbex_employees/data/employees/Employee.extensionpoint @@ -1,4 +1,4 @@ { "name": "codbex-employees-Employees-Employee", "description": "Extension Point for the codbex-employees-Employees-Employee entity" -} \ No newline at end of file +} diff --git a/codbex-employees/gen/codbex_employees/data/employees/EmployeeEntity.java b/codbex-employees/gen/codbex_employees/data/employees/EmployeeEntity.java new file mode 100644 index 0000000..a6133da --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/employees/EmployeeEntity.java @@ -0,0 +1,94 @@ +package gen.codbex_employees.data.employees; + +import org.eclipse.dirigible.engine.java.annotations.Column; +import org.eclipse.dirigible.engine.java.annotations.CreatedAt; +import org.eclipse.dirigible.engine.java.annotations.CreatedBy; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Entity; +import org.eclipse.dirigible.engine.java.annotations.GeneratedValue; +import org.eclipse.dirigible.engine.java.annotations.GenerationType; +import org.eclipse.dirigible.engine.java.annotations.Id; +import org.eclipse.dirigible.engine.java.annotations.Table; +import org.eclipse.dirigible.engine.java.annotations.UpdatedAt; +import org.eclipse.dirigible.engine.java.annotations.UpdatedBy; + +@Entity +@Table(name = "CODBEX_EMPLOYEE") +@Documentation("Employee entity mapping") +public class EmployeeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "EMPLOYEE_ID") + @Documentation("Id") + public Integer Id; + + @Column(name = "EMPLOYEE_FIRSTNAME", length = 50, nullable = false) + @Documentation("FirstName") + public String FirstName; + + @Column(name = "EMPLOYEE_MIDDLENAME", length = 50, nullable = true) + @Documentation("MiddleName") + public String MiddleName; + + @Column(name = "EMPLOYEE_LASTNAME", length = 50, nullable = false) + @Documentation("LastName") + public String LastName; + + @Column(name = "EMPLOYEE_NAME", length = 70, nullable = true) + @Documentation("Name") + public String Name; + + @Column(name = "EMPLOYEE_EMAIL", length = 40, nullable = false, unique = true) + @Documentation("Email") + public String Email; + + @Column(name = "EMPLOYEE_PHONENUMBER", length = 20, nullable = false, unique = true) + @Documentation("PhoneNumber") + public String PhoneNumber; + + @Column(name = "EMPLOYEE_BIRTHDATE", nullable = false) + @Documentation("BirthDate") + public java.time.LocalDate BirthDate; + + @Column(name = "EMPLOYEE_PERSONALNUMBER", length = 10, nullable = false, unique = true) + @Documentation("PersonalNumber") + public String PersonalNumber; + + @Column(name = "EMPLOYEE_NATIONALITY", nullable = false) + @Documentation("Nationality") + public Integer Nationality; + + @Column(name = "EMPLOYEE_GENDER", nullable = false) + @Documentation("Gender") + public Integer Gender; + + @Column(name = "EMPLOYEE_MARTIALSTATUS", nullable = false) + @Documentation("MartialStatus") + public Integer MartialStatus; + + @Column(name = "EMPLOYEE_IBAN", length = 34, nullable = false, unique = true) + @Documentation("IBAN") + public String IBAN; + + @CreatedAt + @Column(name = "EMPLOYEE_CREATEDAT", nullable = true) + @Documentation("CreatedAt") + public java.time.Instant CreatedAt; + + @CreatedBy + @Column(name = "EMPLOYEE_CREATEDBY", length = 20, nullable = true) + @Documentation("CreatedBy") + public String CreatedBy; + + @UpdatedAt + @Column(name = "EMPLOYEE_UPDATEDAT", nullable = true) + @Documentation("UpdatedAt") + public java.time.Instant UpdatedAt; + + @UpdatedBy + @Column(name = "EMPLOYEE_UPDATEDBY", length = 20, nullable = true) + @Documentation("UpdatedBy") + public String UpdatedBy; + +} diff --git a/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java b/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java new file mode 100644 index 0000000..845a16a --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java @@ -0,0 +1,24 @@ +package gen.codbex_employees.data.employees; + +import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository; +import org.eclipse.dirigible.engine.java.annotations.Repository; + +@Repository +public class EmployeeRepository extends JavaRepository { + + public EmployeeRepository() { + super(EmployeeEntity.class); + } + + @Override + public EmployeeEntity save(EmployeeEntity entity) { + entity.Name = entity["FirstName"] + " " + entity["LastName"]; + return super.save(entity); + } + + @Override + public EmployeeEntity update(EmployeeEntity entity) { + entity.Name = entity["FirstName"] + " " + entity["LastName"]; + return super.update(entity); + } +} diff --git a/codbex-employees/gen/codbex-employees/data/Settings/Gender.extensionpoint b/codbex-employees/gen/codbex_employees/data/settings/Gender.extensionpoint similarity index 98% rename from codbex-employees/gen/codbex-employees/data/Settings/Gender.extensionpoint rename to codbex-employees/gen/codbex_employees/data/settings/Gender.extensionpoint index 483921e..4855eb0 100644 --- a/codbex-employees/gen/codbex-employees/data/Settings/Gender.extensionpoint +++ b/codbex-employees/gen/codbex_employees/data/settings/Gender.extensionpoint @@ -1,4 +1,4 @@ { "name": "codbex-employees-Settings-Gender", "description": "Extension Point for the codbex-employees-Settings-Gender entity" -} \ No newline at end of file +} diff --git a/codbex-employees/gen/codbex_employees/data/settings/GenderEntity.java b/codbex-employees/gen/codbex_employees/data/settings/GenderEntity.java new file mode 100644 index 0000000..f4b6279 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/settings/GenderEntity.java @@ -0,0 +1,30 @@ +package gen.codbex_employees.data.settings; + +import org.eclipse.dirigible.engine.java.annotations.Column; +import org.eclipse.dirigible.engine.java.annotations.CreatedAt; +import org.eclipse.dirigible.engine.java.annotations.CreatedBy; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Entity; +import org.eclipse.dirigible.engine.java.annotations.GeneratedValue; +import org.eclipse.dirigible.engine.java.annotations.GenerationType; +import org.eclipse.dirigible.engine.java.annotations.Id; +import org.eclipse.dirigible.engine.java.annotations.Table; +import org.eclipse.dirigible.engine.java.annotations.UpdatedAt; +import org.eclipse.dirigible.engine.java.annotations.UpdatedBy; + +@Entity +@Table(name = "CODBEX_GENDER") +@Documentation("Gender entity mapping") +public class GenderEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "GENDER_ID") + @Documentation("Id") + public Integer Id; + + @Column(name = "GENDER_NAME", length = 7, nullable = true) + @Documentation("Name") + public String Name; + +} diff --git a/codbex-employees/gen/codbex_employees/data/settings/GenderRepository.java b/codbex-employees/gen/codbex_employees/data/settings/GenderRepository.java new file mode 100644 index 0000000..789189c --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/settings/GenderRepository.java @@ -0,0 +1,12 @@ +package gen.codbex_employees.data.settings; + +import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository; +import org.eclipse.dirigible.engine.java.annotations.Repository; + +@Repository +public class GenderRepository extends JavaRepository { + + public GenderRepository() { + super(GenderEntity.class); + } +} diff --git a/codbex-employees/gen/codbex-employees/data/Settings/MartialStatus.extensionpoint b/codbex-employees/gen/codbex_employees/data/settings/MartialStatus.extensionpoint similarity index 98% rename from codbex-employees/gen/codbex-employees/data/Settings/MartialStatus.extensionpoint rename to codbex-employees/gen/codbex_employees/data/settings/MartialStatus.extensionpoint index 104bbf0..475aabd 100644 --- a/codbex-employees/gen/codbex-employees/data/Settings/MartialStatus.extensionpoint +++ b/codbex-employees/gen/codbex_employees/data/settings/MartialStatus.extensionpoint @@ -1,4 +1,4 @@ { "name": "codbex-employees-Settings-MartialStatus", "description": "Extension Point for the codbex-employees-Settings-MartialStatus entity" -} \ No newline at end of file +} diff --git a/codbex-employees/gen/codbex_employees/data/settings/MartialStatusEntity.java b/codbex-employees/gen/codbex_employees/data/settings/MartialStatusEntity.java new file mode 100644 index 0000000..648fe86 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/settings/MartialStatusEntity.java @@ -0,0 +1,30 @@ +package gen.codbex_employees.data.settings; + +import org.eclipse.dirigible.engine.java.annotations.Column; +import org.eclipse.dirigible.engine.java.annotations.CreatedAt; +import org.eclipse.dirigible.engine.java.annotations.CreatedBy; +import org.eclipse.dirigible.engine.java.annotations.Documentation; +import org.eclipse.dirigible.engine.java.annotations.Entity; +import org.eclipse.dirigible.engine.java.annotations.GeneratedValue; +import org.eclipse.dirigible.engine.java.annotations.GenerationType; +import org.eclipse.dirigible.engine.java.annotations.Id; +import org.eclipse.dirigible.engine.java.annotations.Table; +import org.eclipse.dirigible.engine.java.annotations.UpdatedAt; +import org.eclipse.dirigible.engine.java.annotations.UpdatedBy; + +@Entity +@Table(name = "CODBEX_MARTIALSTATUS") +@Documentation("MartialStatus entity mapping") +public class MartialStatusEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "MARTIALSTATUS_ID") + @Documentation("Id") + public Integer Id; + + @Column(name = "MARTIALSTATUS_NAME", length = 20, nullable = true) + @Documentation("Name") + public String Name; + +} diff --git a/codbex-employees/gen/codbex_employees/data/settings/MartialStatusRepository.java b/codbex-employees/gen/codbex_employees/data/settings/MartialStatusRepository.java new file mode 100644 index 0000000..b39bab9 --- /dev/null +++ b/codbex-employees/gen/codbex_employees/data/settings/MartialStatusRepository.java @@ -0,0 +1,12 @@ +package gen.codbex_employees.data.settings; + +import org.eclipse.dirigible.components.data.store.java.repository.JavaRepository; +import org.eclipse.dirigible.engine.java.annotations.Repository; + +@Repository +public class MartialStatusRepository extends JavaRepository { + + public MartialStatusRepository() { + super(MartialStatusEntity.class); + } +} diff --git a/codbex-employees/gen/codbex-employees/roles/default-roles.roles b/codbex-employees/gen/codbex_employees/roles/default-roles.roles similarity index 99% rename from codbex-employees/gen/codbex-employees/roles/default-roles.roles rename to codbex-employees/gen/codbex_employees/roles/default-roles.roles index 10e6f8f..b71abe4 100644 --- a/codbex-employees/gen/codbex-employees/roles/default-roles.roles +++ b/codbex-employees/gen/codbex_employees/roles/default-roles.roles @@ -31,4 +31,4 @@ "name": "codbex-employees.Employees.ContactFullAccess", "description": "A role that grants full access for Contact." } -] \ No newline at end of file +] From acb4167b930bdb4c561fbcc8b2696eef038f4f9e Mon Sep 17 00:00:00 2001 From: NicoleNG18 Date: Tue, 9 Jun 2026 14:45:54 +0300 Subject: [PATCH 2/3] regenerate module with reimported country an city entity --- codbex-employees/codbex-employees.edm | 44 +- codbex-employees/codbex-employees.gen | 750 +++++++++--------- codbex-employees/codbex-employees.model | 378 +++++---- .../Address/dialog-window/controller.js | 29 - .../Employee/Address/dialog-window/index.html | 4 +- .../Employee/dialog-window/index.html | 2 +- .../Employee/main-details/index.html | 2 +- .../en-US/codbex-employees.model.json | 20 +- 8 files changed, 596 insertions(+), 633 deletions(-) diff --git a/codbex-employees/codbex-employees.edm b/codbex-employees/codbex-employees.edm index 20c3dd9..3e0183b 100644 --- a/codbex-employees/codbex-employees.edm +++ b/codbex-employees/codbex-employees.edm @@ -10,7 +10,7 @@ - + @@ -19,18 +19,6 @@ - - - - - - - - - - - - @@ -41,8 +29,6 @@ - - @@ -57,8 +43,8 @@ - - + + @@ -67,14 +53,28 @@ - - - - + + + + + + + + + + + + + + + + + + JobAssignment/services/web/resources/unicons/0-plus.svg103 @@ -83,5 +83,5 @@ - + \ No newline at end of file diff --git a/codbex-employees/codbex-employees.gen b/codbex-employees/codbex-employees.gen index 56577d8..1ec50a7 100644 --- a/codbex-employees/codbex-employees.gen +++ b/codbex-employees/codbex-employees.gen @@ -49,10 +49,10 @@ }, "Settings": { "views": [ - "Country", - "City", "Gender", - "MartialStatus" + "MartialStatus", + "Country", + "City" ], "name": "Settings", "label": "Settings", @@ -372,7 +372,7 @@ "widgetDropDownValue": "Name", "widgetIsMajor": true, "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Employee_Country", "relationshipEntityName": "Country", @@ -903,7 +903,7 @@ "widgetDropDownValue": "Name", "widgetIsMajor": true, "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Employee_Country", "relationshipEntityName": "Country", @@ -1146,7 +1146,7 @@ { "auditType": "NONE", "dataAutoIncrement": true, - "dataName": "COUNTRY_ID", + "dataName": "GENDER_ID", "dataNullable": true, "dataPrimaryKey": true, "dataType": "INTEGER", @@ -1172,22 +1172,22 @@ }, { "auditType": "NONE", - "dataLength": "255", - "dataName": "COUNTRY_NAME", + "dataLength": "7", + "dataName": "GENDER_NAME", "dataNullable": true, "dataType": "VARCHAR", - "dataUnique": true, "description": "", + "isRequiredProperty": true, "name": "Name", "tooltip": "", "widgetIsMajor": true, "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "TEXTBOX", "dataNotNull": false, "dataAutoIncrement": false, "dataPrimaryKey": false, - "isRequiredProperty": false, + "dataUnique": false, "isCalculatedProperty": false, "isReadOnlyProperty": false, "widgetLabel": "Name", @@ -1197,126 +1197,36 @@ "dataTypeTypescript": "string", "dataTypeJavaClass": "String", "minLength": 0, - "maxLength": 20, - "inputRule": "" - }, - { - "auditType": "NONE", - "dataLength": "2", - "dataName": "COUNTRY_CODE2", - "dataNullable": true, - "dataType": "CHAR", - "dataUnique": true, - "description": "", - "name": "Code2", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "fd-col-md--2 fd-col--3", - "widgetType": "TEXTBOX", - "dataNotNull": false, - "dataAutoIncrement": false, - "dataPrimaryKey": false, - "isRequiredProperty": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Code2", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "string", - "dataTypeTypescript": "string", - "dataTypeJavaClass": "String", - "minLength": 0, - "maxLength": 2, - "inputRule": "" - }, - { - "auditType": "NONE", - "dataLength": "3", - "dataName": "COUNTRY_CODE3", - "dataNullable": true, - "dataType": "CHAR", - "dataUnique": true, - "description": "", - "name": "Code3", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "fd-col-md--2 fd-col--3", - "widgetType": "TEXTBOX", - "dataNotNull": false, - "dataAutoIncrement": false, - "dataPrimaryKey": false, - "isRequiredProperty": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Code3", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "string", - "dataTypeTypescript": "string", - "dataTypeJavaClass": "String", - "minLength": 0, - "maxLength": 3, - "inputRule": "" - }, - { - "auditType": "NONE", - "dataLength": "3", - "dataName": "COUNTRY_NUMERIC", - "dataNullable": true, - "dataType": "CHAR", - "dataUnique": true, - "description": "", - "name": "Numeric", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "fd-col-md--2 fd-col--3", - "widgetType": "TEXTBOX", - "dataNotNull": false, - "dataAutoIncrement": false, - "dataPrimaryKey": false, - "isRequiredProperty": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Numeric", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "string", - "dataTypeTypescript": "string", - "dataTypeJavaClass": "String", - "minLength": 0, - "maxLength": 3, + "maxLength": 7, "inputRule": "" } ], - "caption": "Manage entity Country", - "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_COUNTRY\"", - "dataName": "COUNTRY", + "caption": "Manage entity Gender", + "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_GENDER\"", + "dataName": "GENDER", "dataQuery": "", - "description": "Manage entity Country", - "generateDefaultRoles": "false", + "description": "Manage entity Gender", + "feedPassword": "YWRtaW4=", + "feedUsername": "YWRtaW4=", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", - "layoutType": "MANAGE", "menuIndex": "100", - "menuKey": "country", - "menuLabel": "Country", + "menuKey": "gender", + "menuLabel": "Gender", "multilingual": "false", - "name": "Country", + "name": "Gender", "perspectiveHeader": "", - "perspectiveIcon": "/services/web/resources/unicons/globe.svg", - "perspectiveLabel": "Settings", + "perspectiveIcon": "/services/web/resources/unicons/copy.svg", "perspectiveName": "Settings", "perspectiveNavId": "", "perspectiveOrder": "100", "perspectiveRole": "", - "projectionReferencedEntity": "Country", - "projectionReferencedModel": "/workspace/codbex-countries/codbex-countries.model", - "title": "Country", - "tooltip": "Country", - "type": "PROJECTION", + "roleRead": "codbex-employees.EmployeesSettings.GenderReadOnly", + "roleWrite": "codbex-employees.EmployeesSettings.GenderFullAccess", + "title": "Gender", + "tooltip": "Gender", + "type": "SETTING", "dataSource": "DefaultDB", "javaPerspectiveName": "settings", "referencedProjections": [], @@ -1330,7 +1240,7 @@ { "auditType": "NONE", "dataAutoIncrement": true, - "dataName": "CITY_ID", + "dataName": "MARTIALSTATUS_ID", "dataNullable": true, "dataPrimaryKey": true, "dataType": "INTEGER", @@ -1356,8 +1266,8 @@ }, { "auditType": "NONE", - "dataLength": "100", - "dataName": "CITY_NAME", + "dataLength": "20", + "dataName": "MARTIALSTATUS_NAME", "dataNullable": true, "dataType": "VARCHAR", "description": "", @@ -1365,7 +1275,7 @@ "name": "Name", "tooltip": "", "widgetIsMajor": true, - "widgetLength": "100", + "widgetLength": "20", "widgetSize": "", "widgetType": "TEXTBOX", "dataNotNull": false, @@ -1381,83 +1291,50 @@ "dataTypeTypescript": "string", "dataTypeJavaClass": "String", "minLength": 0, - "maxLength": 100, - "inputRule": "" - }, - { - "auditType": "NONE", - "dataName": "CITY_COUNTRY", - "dataNullable": true, - "dataType": "INTEGER", - "description": "", - "isRequiredProperty": true, - "name": "Country", - "relationshipEntityPerspectiveLabel": "Entities", - "relationshipEntityPerspectiveName": "Settings", - "relationshipName": "City_Country", - "tooltip": "", - "widgetDropDownKey": "Id", - "widgetDropDownValue": "Name", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "", - "widgetType": "DROPDOWN", - "dataNotNull": false, - "dataAutoIncrement": false, - "dataPrimaryKey": false, - "dataUnique": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Country", - "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/undefinedController", - "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/undefinedController", - "dataTypeJava": "int", - "dataTypeTypescript": "number", - "dataTypeJavaClass": "Integer", + "maxLength": 20, "inputRule": "" } ], - "caption": "Manage entity City", - "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_CITY\"", - "dataName": "CITY", + "caption": "Manage entity MartialStatus", + "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_MARTIALSTATUS\"", + "dataName": "MARTIALSTATUS", "dataQuery": "", - "description": "Manage entity City", - "generateDefaultRoles": "false", + "description": "Manage entity MartialStatus", + "feedPassword": "YWRtaW4=", + "feedUsername": "YWRtaW4=", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", - "layoutType": "MANAGE", "menuIndex": "100", - "menuKey": "city", - "menuLabel": "City", + "menuKey": "martialstatus", + "menuLabel": "MartialStatus", "multilingual": "false", - "name": "City", + "name": "MartialStatus", "perspectiveHeader": "", - "perspectiveIcon": "/services/web/resources/unicons/building.svg", - "perspectiveLabel": "Settings", + "perspectiveIcon": "/services/web/resources/unicons/copy.svg", "perspectiveName": "Settings", "perspectiveNavId": "", "perspectiveOrder": "100", "perspectiveRole": "", - "projectionReferencedEntity": "City", - "projectionReferencedModel": "/workspace/codbex-cities/codbex-cities.model", - "title": "City", - "tooltip": "City", - "type": "PROJECTION", + "roleRead": "codbex-employees.EmployeesSettings.MartialStatusReadOnly", + "roleWrite": "codbex-employees.EmployeesSettings.MartialStatusFullAccess", + "title": "MartialStatus", + "tooltip": "MartialStatus", + "type": "SETTING", "dataSource": "DefaultDB", "javaPerspectiveName": "settings", "referencedProjections": [], "primaryKeys": [ "Id" ], - "primaryKeysString": "Id", - "hasDropdowns": true + "primaryKeysString": "Id" }, { "properties": [ { "auditType": "NONE", "dataAutoIncrement": true, - "dataName": "GENDER_ID", + "dataName": "CONTACT_ID", "dataNullable": true, "dataPrimaryKey": true, "dataType": "INTEGER", @@ -1483,220 +1360,32 @@ }, { "auditType": "NONE", - "dataLength": "7", - "dataName": "GENDER_NAME", - "dataNullable": true, + "dataLength": "20", + "dataName": "CONTACT_PHONENUMBER", + "dataNullable": false, "dataType": "VARCHAR", "description": "", "isRequiredProperty": true, - "name": "Name", + "name": "PhoneNumber", "tooltip": "", "widgetIsMajor": true, "widgetLength": "20", - "widgetSize": "", - "widgetType": "TEXTBOX", - "dataNotNull": false, + "widgetSize": "fd-col-md--4 fd-col--6", + "widgetType": "TEL", + "dataNotNull": true, "dataAutoIncrement": false, "dataPrimaryKey": false, "dataUnique": false, "isCalculatedProperty": false, "isReadOnlyProperty": false, - "widgetLabel": "Name", + "widgetLabel": "PhoneNumber", "widgetDropdownUrl": "", "widgetDropdownControllerUrl": "", "dataTypeJava": "string", "dataTypeTypescript": "string", "dataTypeJavaClass": "String", "minLength": 0, - "maxLength": 7, - "inputRule": "" - } - ], - "caption": "Manage entity Gender", - "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_GENDER\"", - "dataName": "GENDER", - "dataQuery": "", - "description": "Manage entity Gender", - "feedPassword": "YWRtaW4=", - "feedUsername": "YWRtaW4=", - "generateDefaultRoles": "true", - "generateReport": "false", - "icon": "/services/web/resources/unicons/file.svg", - "menuIndex": "100", - "menuKey": "gender", - "menuLabel": "Gender", - "multilingual": "false", - "name": "Gender", - "perspectiveHeader": "", - "perspectiveIcon": "/services/web/resources/unicons/copy.svg", - "perspectiveName": "Settings", - "perspectiveNavId": "", - "perspectiveOrder": "100", - "perspectiveRole": "", - "roleRead": "codbex-employees.EmployeesSettings.GenderReadOnly", - "roleWrite": "codbex-employees.EmployeesSettings.GenderFullAccess", - "title": "Gender", - "tooltip": "Gender", - "type": "SETTING", - "dataSource": "DefaultDB", - "javaPerspectiveName": "settings", - "referencedProjections": [], - "primaryKeys": [ - "Id" - ], - "primaryKeysString": "Id" - }, - { - "properties": [ - { - "auditType": "NONE", - "dataAutoIncrement": true, - "dataName": "MARTIALSTATUS_ID", - "dataNullable": true, - "dataPrimaryKey": true, - "dataType": "INTEGER", - "description": "", - "name": "Id", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "", - "widgetType": "TEXTBOX", - "dataNotNull": false, - "dataUnique": false, - "isRequiredProperty": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Id", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "int", - "dataTypeTypescript": "number", - "dataTypeJavaClass": "Integer", - "inputRule": "" - }, - { - "auditType": "NONE", - "dataLength": "20", - "dataName": "MARTIALSTATUS_NAME", - "dataNullable": true, - "dataType": "VARCHAR", - "description": "", - "isRequiredProperty": true, - "name": "Name", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "", - "widgetType": "TEXTBOX", - "dataNotNull": false, - "dataAutoIncrement": false, - "dataPrimaryKey": false, - "dataUnique": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Name", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "string", - "dataTypeTypescript": "string", - "dataTypeJavaClass": "String", - "minLength": 0, - "maxLength": 20, - "inputRule": "" - } - ], - "caption": "Manage entity MartialStatus", - "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_MARTIALSTATUS\"", - "dataName": "MARTIALSTATUS", - "dataQuery": "", - "description": "Manage entity MartialStatus", - "feedPassword": "YWRtaW4=", - "feedUsername": "YWRtaW4=", - "generateDefaultRoles": "true", - "generateReport": "false", - "icon": "/services/web/resources/unicons/file.svg", - "menuIndex": "100", - "menuKey": "martialstatus", - "menuLabel": "MartialStatus", - "multilingual": "false", - "name": "MartialStatus", - "perspectiveHeader": "", - "perspectiveIcon": "/services/web/resources/unicons/copy.svg", - "perspectiveName": "Settings", - "perspectiveNavId": "", - "perspectiveOrder": "100", - "perspectiveRole": "", - "roleRead": "codbex-employees.EmployeesSettings.MartialStatusReadOnly", - "roleWrite": "codbex-employees.EmployeesSettings.MartialStatusFullAccess", - "title": "MartialStatus", - "tooltip": "MartialStatus", - "type": "SETTING", - "dataSource": "DefaultDB", - "javaPerspectiveName": "settings", - "referencedProjections": [], - "primaryKeys": [ - "Id" - ], - "primaryKeysString": "Id" - }, - { - "properties": [ - { - "auditType": "NONE", - "dataAutoIncrement": true, - "dataName": "CONTACT_ID", - "dataNullable": true, - "dataPrimaryKey": true, - "dataType": "INTEGER", - "description": "", - "name": "Id", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "", - "widgetType": "TEXTBOX", - "dataNotNull": false, - "dataUnique": false, - "isRequiredProperty": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "Id", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "int", - "dataTypeTypescript": "number", - "dataTypeJavaClass": "Integer", - "inputRule": "" - }, - { - "auditType": "NONE", - "dataLength": "20", - "dataName": "CONTACT_PHONENUMBER", - "dataNullable": false, - "dataType": "VARCHAR", - "description": "", - "isRequiredProperty": true, - "name": "PhoneNumber", - "tooltip": "", - "widgetIsMajor": true, - "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", - "widgetType": "TEL", - "dataNotNull": true, - "dataAutoIncrement": false, - "dataPrimaryKey": false, - "dataUnique": false, - "isCalculatedProperty": false, - "isReadOnlyProperty": false, - "widgetLabel": "PhoneNumber", - "widgetDropdownUrl": "", - "widgetDropdownControllerUrl": "", - "dataTypeJava": "string", - "dataTypeTypescript": "string", - "dataTypeJavaClass": "String", - "minLength": 0, - "maxLength": 20, + "maxLength": 20, "inputRule": "" }, { @@ -1958,7 +1647,7 @@ "widgetDropDownValue": "Name", "widgetIsMajor": true, "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Address_Country", "relationshipEntityName": "Country", @@ -1987,15 +1676,11 @@ "isRequiredProperty": true, "name": "City", "tooltip": "", - "widgetDependsOnEntity": "Country", - "widgetDependsOnFilterBy": "Country", - "widgetDependsOnProperty": "Country", - "widgetDependsOnValueFrom": "Id", "widgetDropDownKey": "Id", "widgetDropDownValue": "Name", "widgetIsMajor": true, "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Address_City", "relationshipEntityName": "City", @@ -2271,6 +1956,317 @@ "masterEntity": "Employee", "masterEntityId": "Employee", "hasDates": true + }, + { + "properties": [ + { + "auditType": "NONE", + "dataAutoIncrement": true, + "dataName": "COUNTRY_ID", + "dataNullable": true, + "dataPrimaryKey": true, + "dataType": "INTEGER", + "description": "", + "name": "Id", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataUnique": false, + "isRequiredProperty": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Id", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "int", + "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", + "inputRule": "" + }, + { + "auditType": "NONE", + "dataLength": "255", + "dataName": "COUNTRY_NAME", + "dataNullable": true, + "dataType": "VARCHAR", + "dataUnique": true, + "description": "", + "name": "Name", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "fd-col-md--4 fd-col--6", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataAutoIncrement": false, + "dataPrimaryKey": false, + "isRequiredProperty": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Name", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "string", + "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", + "minLength": 0, + "maxLength": 20, + "inputRule": "" + }, + { + "auditType": "NONE", + "dataLength": "2", + "dataName": "COUNTRY_CODE2", + "dataNullable": true, + "dataType": "CHAR", + "dataUnique": true, + "description": "", + "name": "Code2", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "fd-col-md--2 fd-col--3", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataAutoIncrement": false, + "dataPrimaryKey": false, + "isRequiredProperty": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Code2", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "string", + "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", + "minLength": 0, + "maxLength": 2, + "inputRule": "" + }, + { + "auditType": "NONE", + "dataLength": "3", + "dataName": "COUNTRY_CODE3", + "dataNullable": true, + "dataType": "CHAR", + "dataUnique": true, + "description": "", + "name": "Code3", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "fd-col-md--2 fd-col--3", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataAutoIncrement": false, + "dataPrimaryKey": false, + "isRequiredProperty": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Code3", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "string", + "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", + "minLength": 0, + "maxLength": 3, + "inputRule": "" + }, + { + "auditType": "NONE", + "dataLength": "3", + "dataName": "COUNTRY_NUMERIC", + "dataNullable": true, + "dataType": "CHAR", + "dataUnique": true, + "description": "", + "name": "Numeric", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "fd-col-md--2 fd-col--3", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataAutoIncrement": false, + "dataPrimaryKey": false, + "isRequiredProperty": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Numeric", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "string", + "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", + "minLength": 0, + "maxLength": 3, + "inputRule": "" + } + ], + "caption": "Manage entity Country", + "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_COUNTRY\"", + "dataName": "COUNTRY", + "dataQuery": "", + "description": "Manage entity Country", + "generateDefaultRoles": "false", + "generateReport": "false", + "icon": "/services/web/resources/unicons/file.svg", + "layoutType": "MANAGE", + "menuIndex": "100", + "menuKey": "country", + "menuLabel": "Country", + "multilingual": "false", + "name": "Country", + "perspectiveHeader": "", + "perspectiveIcon": "globe", + "perspectiveLabel": "Settings", + "perspectiveName": "Settings", + "perspectiveNavId": "", + "perspectiveOrder": "990", + "perspectiveRole": "", + "projectionReferencedEntity": "Country", + "projectionReferencedModel": "/workspace/codbex-countries/codbex-countries.model", + "title": "Country", + "tooltip": "Country", + "type": "PROJECTION", + "dataSource": "DefaultDB", + "javaPerspectiveName": "settings", + "referencedProjections": [], + "primaryKeys": [ + "Id" + ], + "primaryKeysString": "Id" + }, + { + "properties": [ + { + "auditType": "NONE", + "dataAutoIncrement": true, + "dataName": "CITY_ID", + "dataNullable": true, + "dataPrimaryKey": true, + "dataType": "INTEGER", + "description": "", + "name": "Id", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataUnique": false, + "isRequiredProperty": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Id", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "int", + "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", + "inputRule": "" + }, + { + "auditType": "NONE", + "dataLength": "100", + "dataName": "CITY_NAME", + "dataNullable": true, + "dataType": "VARCHAR", + "description": "", + "isRequiredProperty": true, + "name": "Name", + "tooltip": "", + "widgetIsMajor": true, + "widgetLength": "100", + "widgetSize": "", + "widgetType": "TEXTBOX", + "dataNotNull": false, + "dataAutoIncrement": false, + "dataPrimaryKey": false, + "dataUnique": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Name", + "widgetDropdownUrl": "", + "widgetDropdownControllerUrl": "", + "dataTypeJava": "string", + "dataTypeTypescript": "string", + "dataTypeJavaClass": "String", + "minLength": 0, + "maxLength": 100, + "inputRule": "" + }, + { + "auditType": "NONE", + "dataName": "CITY_COUNTRY", + "dataNullable": true, + "dataType": "INTEGER", + "description": "", + "isRequiredProperty": true, + "name": "Country", + "relationshipEntityPerspectiveLabel": "Settings", + "relationshipEntityPerspectiveName": "Settings", + "relationshipName": "City_Country", + "tooltip": "", + "widgetDropDownKey": "Id", + "widgetDropDownValue": "Name", + "widgetIsMajor": true, + "widgetLength": "20", + "widgetSize": "", + "widgetType": "DROPDOWN", + "dataNotNull": false, + "dataAutoIncrement": false, + "dataPrimaryKey": false, + "dataUnique": false, + "isCalculatedProperty": false, + "isReadOnlyProperty": false, + "widgetLabel": "Country", + "widgetDropdownUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/undefinedController", + "widgetDropdownControllerUrl": "/services/java/codbex-employees/gen/codbex_employees/api/settings/undefinedController", + "dataTypeJava": "int", + "dataTypeTypescript": "number", + "dataTypeJavaClass": "Integer", + "inputRule": "" + } + ], + "caption": "Manage entity City", + "dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_CITY\"", + "dataName": "CITY", + "dataQuery": "", + "description": "Manage entity City", + "generateDefaultRoles": "false", + "generateReport": "false", + "icon": "/services/web/resources/unicons/file.svg", + "layoutType": "MANAGE", + "menuIndex": "100", + "menuKey": "city", + "menuLabel": "City", + "multilingual": "false", + "name": "City", + "perspectiveHeader": "", + "perspectiveIcon": "/services/web/resources/unicons/copy.svg", + "perspectiveLabel": "Settings", + "perspectiveName": "Settings", + "perspectiveNavId": "", + "perspectiveOrder": "100", + "perspectiveRole": "", + "projectionReferencedEntity": "City", + "projectionReferencedModel": "/workspace/codbex-cities/codbex-cities.model", + "title": "City", + "tooltip": "City", + "type": "PROJECTION", + "dataSource": "DefaultDB", + "javaPerspectiveName": "settings", + "referencedProjections": [], + "primaryKeys": [ + "Id" + ], + "primaryKeysString": "Id", + "hasDropdowns": true } ] } \ No newline at end of file diff --git a/codbex-employees/codbex-employees.model b/codbex-employees/codbex-employees.model index 79479ef..a97af68 100644 --- a/codbex-employees/codbex-employees.model +++ b/codbex-employees/codbex-employees.model @@ -160,7 +160,7 @@ "widgetDropDownValue": "Name", "widgetIsMajor": "true", "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Employee_Country", "relationshipEntityName": "Country", @@ -310,190 +310,6 @@ "tooltip": "Employee", "type": "PRIMARY" }, - { - "properties": [ - { - "auditType": "NONE", - "dataAutoIncrement": "true", - "dataName": "COUNTRY_ID", - "dataNullable": "true", - "dataPrimaryKey": "true", - "dataType": "INTEGER", - "description": "", - "name": "Id", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "", - "widgetType": "TEXTBOX" - }, - { - "auditType": "NONE", - "dataLength": "255", - "dataName": "COUNTRY_NAME", - "dataNullable": "true", - "dataType": "VARCHAR", - "dataUnique": "true", - "description": "", - "name": "Name", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", - "widgetType": "TEXTBOX" - }, - { - "auditType": "NONE", - "dataLength": "2", - "dataName": "COUNTRY_CODE2", - "dataNullable": "true", - "dataType": "CHAR", - "dataUnique": "true", - "description": "", - "name": "Code2", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "fd-col-md--2 fd-col--3", - "widgetType": "TEXTBOX" - }, - { - "auditType": "NONE", - "dataLength": "3", - "dataName": "COUNTRY_CODE3", - "dataNullable": "true", - "dataType": "CHAR", - "dataUnique": "true", - "description": "", - "name": "Code3", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "fd-col-md--2 fd-col--3", - "widgetType": "TEXTBOX" - }, - { - "auditType": "NONE", - "dataLength": "3", - "dataName": "COUNTRY_NUMERIC", - "dataNullable": "true", - "dataType": "CHAR", - "dataUnique": "true", - "description": "", - "name": "Numeric", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "fd-col-md--2 fd-col--3", - "widgetType": "TEXTBOX" - } - ], - "caption": "Manage entity Country", - "dataCount": "SELECT COUNT(*) AS COUNT FROM \"${tablePrefix}COUNTRY\"", - "dataName": "COUNTRY", - "dataQuery": "", - "description": "Manage entity Country", - "generateDefaultRoles": "false", - "generateReport": "false", - "icon": "/services/web/resources/unicons/file.svg", - "layoutType": "MANAGE", - "menuIndex": "100", - "menuKey": "country", - "menuLabel": "Country", - "multilingual": "false", - "name": "Country", - "perspectiveHeader": "", - "perspectiveIcon": "/services/web/resources/unicons/globe.svg", - "perspectiveLabel": "Settings", - "perspectiveName": "Settings", - "perspectiveNavId": "", - "perspectiveOrder": "100", - "perspectiveRole": "", - "projectionReferencedEntity": "Country", - "projectionReferencedModel": "/workspace/codbex-countries/codbex-countries.model", - "title": "Country", - "tooltip": "Country", - "type": "PROJECTION" - }, - { - "properties": [ - { - "auditType": "NONE", - "dataAutoIncrement": "true", - "dataName": "CITY_ID", - "dataNullable": "true", - "dataPrimaryKey": "true", - "dataType": "INTEGER", - "description": "", - "name": "Id", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "", - "widgetType": "TEXTBOX" - }, - { - "auditType": "NONE", - "dataLength": "100", - "dataName": "CITY_NAME", - "dataNullable": "true", - "dataType": "VARCHAR", - "description": "", - "isRequiredProperty": "true", - "name": "Name", - "tooltip": "", - "widgetIsMajor": "true", - "widgetLength": "100", - "widgetSize": "", - "widgetType": "TEXTBOX" - }, - { - "auditType": "NONE", - "dataName": "CITY_COUNTRY", - "dataNullable": "true", - "dataType": "INTEGER", - "description": "", - "isRequiredProperty": "true", - "name": "Country", - "relationshipEntityPerspectiveLabel": "Entities", - "relationshipEntityPerspectiveName": "Settings", - "relationshipName": "City_Country", - "tooltip": "", - "widgetDropDownKey": "Id", - "widgetDropDownValue": "Name", - "widgetIsMajor": "true", - "widgetLength": "20", - "widgetSize": "", - "widgetType": "DROPDOWN" - } - ], - "caption": "Manage entity City", - "dataCount": "SELECT COUNT(*) AS COUNT FROM \"${tablePrefix}CITY\"", - "dataName": "CITY", - "dataQuery": "", - "description": "Manage entity City", - "generateDefaultRoles": "false", - "generateReport": "false", - "icon": "/services/web/resources/unicons/file.svg", - "layoutType": "MANAGE", - "menuIndex": "100", - "menuKey": "city", - "menuLabel": "City", - "multilingual": "false", - "name": "City", - "perspectiveHeader": "", - "perspectiveIcon": "/services/web/resources/unicons/building.svg", - "perspectiveLabel": "Settings", - "perspectiveName": "Settings", - "perspectiveNavId": "", - "perspectiveOrder": "100", - "perspectiveRole": "", - "projectionReferencedEntity": "City", - "projectionReferencedModel": "/workspace/codbex-cities/codbex-cities.model", - "title": "City", - "tooltip": "City", - "type": "PROJECTION" - }, { "properties": [ { @@ -801,7 +617,7 @@ "widgetDropDownValue": "Name", "widgetIsMajor": "true", "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Address_Country", "relationshipEntityName": "Country", @@ -817,15 +633,11 @@ "isRequiredProperty": "true", "name": "City", "tooltip": "", - "widgetDependsOnEntity": "Country", - "widgetDependsOnFilterBy": "Country", - "widgetDependsOnProperty": "Country", - "widgetDependsOnValueFrom": "Id", "widgetDropDownKey": "Id", "widgetDropDownValue": "Name", "widgetIsMajor": "true", "widgetLength": "20", - "widgetSize": "fd-col-md--4 fd-col--6", + "widgetSize": "", "widgetType": "DROPDOWN", "relationshipName": "Address_City", "relationshipEntityName": "City", @@ -964,6 +776,190 @@ "title": "Address", "tooltip": "Address", "type": "DEPENDENT" + }, + { + "properties": [ + { + "auditType": "NONE", + "dataAutoIncrement": "true", + "dataName": "COUNTRY_ID", + "dataNullable": "true", + "dataPrimaryKey": "true", + "dataType": "INTEGER", + "description": "", + "name": "Id", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "", + "widgetType": "TEXTBOX" + }, + { + "auditType": "NONE", + "dataLength": "255", + "dataName": "COUNTRY_NAME", + "dataNullable": "true", + "dataType": "VARCHAR", + "dataUnique": "true", + "description": "", + "name": "Name", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "fd-col-md--4 fd-col--6", + "widgetType": "TEXTBOX" + }, + { + "auditType": "NONE", + "dataLength": "2", + "dataName": "COUNTRY_CODE2", + "dataNullable": "true", + "dataType": "CHAR", + "dataUnique": "true", + "description": "", + "name": "Code2", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "fd-col-md--2 fd-col--3", + "widgetType": "TEXTBOX" + }, + { + "auditType": "NONE", + "dataLength": "3", + "dataName": "COUNTRY_CODE3", + "dataNullable": "true", + "dataType": "CHAR", + "dataUnique": "true", + "description": "", + "name": "Code3", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "fd-col-md--2 fd-col--3", + "widgetType": "TEXTBOX" + }, + { + "auditType": "NONE", + "dataLength": "3", + "dataName": "COUNTRY_NUMERIC", + "dataNullable": "true", + "dataType": "CHAR", + "dataUnique": "true", + "description": "", + "name": "Numeric", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "fd-col-md--2 fd-col--3", + "widgetType": "TEXTBOX" + } + ], + "caption": "Manage entity Country", + "dataCount": "SELECT COUNT(*) AS COUNT FROM \"${tablePrefix}COUNTRY\"", + "dataName": "COUNTRY", + "dataQuery": "", + "description": "Manage entity Country", + "generateDefaultRoles": "false", + "generateReport": "false", + "icon": "/services/web/resources/unicons/file.svg", + "layoutType": "MANAGE", + "menuIndex": "100", + "menuKey": "country", + "menuLabel": "Country", + "multilingual": "false", + "name": "Country", + "perspectiveHeader": "", + "perspectiveIcon": "globe", + "perspectiveLabel": "Settings", + "perspectiveName": "Settings", + "perspectiveNavId": "", + "perspectiveOrder": "990", + "perspectiveRole": "", + "projectionReferencedEntity": "Country", + "projectionReferencedModel": "/workspace/codbex-countries/codbex-countries.model", + "title": "Country", + "tooltip": "Country", + "type": "PROJECTION" + }, + { + "properties": [ + { + "auditType": "NONE", + "dataAutoIncrement": "true", + "dataName": "CITY_ID", + "dataNullable": "true", + "dataPrimaryKey": "true", + "dataType": "INTEGER", + "description": "", + "name": "Id", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "", + "widgetType": "TEXTBOX" + }, + { + "auditType": "NONE", + "dataLength": "100", + "dataName": "CITY_NAME", + "dataNullable": "true", + "dataType": "VARCHAR", + "description": "", + "isRequiredProperty": "true", + "name": "Name", + "tooltip": "", + "widgetIsMajor": "true", + "widgetLength": "100", + "widgetSize": "", + "widgetType": "TEXTBOX" + }, + { + "auditType": "NONE", + "dataName": "CITY_COUNTRY", + "dataNullable": "true", + "dataType": "INTEGER", + "description": "", + "isRequiredProperty": "true", + "name": "Country", + "relationshipEntityPerspectiveLabel": "Settings", + "relationshipEntityPerspectiveName": "Settings", + "relationshipName": "City_Country", + "tooltip": "", + "widgetDropDownKey": "Id", + "widgetDropDownValue": "Name", + "widgetIsMajor": "true", + "widgetLength": "20", + "widgetSize": "", + "widgetType": "DROPDOWN" + } + ], + "caption": "Manage entity City", + "dataCount": "SELECT COUNT(*) AS COUNT FROM \"${tablePrefix}CITY\"", + "dataName": "CITY", + "dataQuery": "", + "description": "Manage entity City", + "generateDefaultRoles": "false", + "generateReport": "false", + "icon": "/services/web/resources/unicons/file.svg", + "layoutType": "MANAGE", + "menuIndex": "100", + "menuKey": "city", + "menuLabel": "City", + "multilingual": "false", + "name": "City", + "perspectiveHeader": "", + "perspectiveIcon": "/services/web/resources/unicons/copy.svg", + "perspectiveLabel": "Settings", + "perspectiveName": "Settings", + "perspectiveNavId": "", + "perspectiveOrder": "100", + "perspectiveRole": "", + "projectionReferencedEntity": "City", + "projectionReferencedModel": "/workspace/codbex-cities/codbex-cities.model", + "title": "City", + "tooltip": "City", + "type": "PROJECTION" } ], "perspectives": [ diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js index 1e578e0..0b52eb7 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/controller.js @@ -282,35 +282,6 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer return false; } - $scope.$watch('entity.Country', function (newValue, oldValue) { - if (newValue !== undefined && newValue !== null) { - $http.get($scope.serviceCountry + '/' + newValue).then((response) => { - let valueFrom = response.data.Id; - $http.post('/services/java/codbex-cities/gen/codbex_cities/api/settings/CityController/search', { - conditions: [ - { propertyName: 'Country', operator: 'EQ', value: valueFrom } - ] - }).then((response) => { - $scope.optionsCity = response.data.map(e => ({ - value: e.Id, - text: e.Name - })); - if ($scope.action !== 'select' && newValue !== oldValue) { - if ($scope.optionsCity.length == 1) { - $scope.entity.City = $scope.optionsCity[0].value; - } else { - $scope.entity.City = undefined; - } - } - }, (error) => { - console.error(error); - }); - }, (error) => { - console.error(error); - }); - } - }); - $scope.alert = (message) => { if (message) Dialogs.showAlert({ title: description, diff --git a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/index.html b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/index.html index 920e8dd..ae316f1 100644 --- a/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/index.html +++ b/codbex-employees/gen/codbex-employees/ui/Employees/Employee/Address/dialog-window/index.html @@ -20,7 +20,7 @@
{{ 'codbex-employees:codbex-employees-model.t.ADDRESS_COUNTRY' | t }}
-
+
{{ 'codbex-employees:codbex-employees-model.t.ADDRESS_CITY' | t }}
-
+
{{ 'codbex-employees:codbex-employees-model.t.EMPLOYEE_NATIONALITY' | t }}
-
+
{{ 'codbex-employees:codbex-employees-model.t.EMPLOYEE_NATIONALITY' | t }}
-
+
Date: Thu, 11 Jun 2026 15:25:03 +0300 Subject: [PATCH 3/3] migrate calculated properties to java --- codbex-employees/codbex-employees.edm | 4 ++-- codbex-employees/codbex-employees.gen | 8 ++++---- codbex-employees/codbex-employees.model | 4 ++-- .../data/employees/EmployeeRepository.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/codbex-employees/codbex-employees.edm b/codbex-employees/codbex-employees.edm index 3e0183b..58e8642 100644 --- a/codbex-employees/codbex-employees.edm +++ b/codbex-employees/codbex-employees.edm @@ -5,7 +5,7 @@ - + @@ -83,5 +83,5 @@ - + \ No newline at end of file diff --git a/codbex-employees/codbex-employees.gen b/codbex-employees/codbex-employees.gen index 1ec50a7..a1783a9 100644 --- a/codbex-employees/codbex-employees.gen +++ b/codbex-employees/codbex-employees.gen @@ -211,8 +211,8 @@ }, { "auditType": "NONE", - "calculatedPropertyExpressionCreate": "entity[\"FirstName\"] + \" \" + entity[\"LastName\"]", - "calculatedPropertyExpressionUpdate": "entity[\"FirstName\"] + \" \" + entity[\"LastName\"]", + "calculatedPropertyExpressionCreate": "entity.FirstName + \" \" + entity.LastName", + "calculatedPropertyExpressionUpdate": "entity.FirstName + \" \" + entity.LastName;", "dataLength": "70", "dataName": "EMPLOYEE_NAME", "dataNullable": true, @@ -742,8 +742,8 @@ }, { "auditType": "NONE", - "calculatedPropertyExpressionCreate": "entity[\"FirstName\"] + \" \" + entity[\"LastName\"]", - "calculatedPropertyExpressionUpdate": "entity[\"FirstName\"] + \" \" + entity[\"LastName\"]", + "calculatedPropertyExpressionCreate": "entity.FirstName + \" \" + entity.LastName", + "calculatedPropertyExpressionUpdate": "entity.FirstName + \" \" + entity.LastName;", "dataLength": "70", "dataName": "EMPLOYEE_NAME", "dataNullable": true, diff --git a/codbex-employees/codbex-employees.model b/codbex-employees/codbex-employees.model index a97af68..a7bb3bb 100644 --- a/codbex-employees/codbex-employees.model +++ b/codbex-employees/codbex-employees.model @@ -70,8 +70,8 @@ }, { "auditType": "NONE", - "calculatedPropertyExpressionCreate": "entity[\"FirstName\"] + \" \" + entity[\"LastName\"]", - "calculatedPropertyExpressionUpdate": "entity[\"FirstName\"] + \" \" + entity[\"LastName\"]", + "calculatedPropertyExpressionCreate": "entity.FirstName + \" \" + entity.LastName", + "calculatedPropertyExpressionUpdate": "entity.FirstName + \" \" + entity.LastName;", "dataLength": "70", "dataName": "EMPLOYEE_NAME", "dataNullable": "true", diff --git a/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java b/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java index 845a16a..b3777ce 100644 --- a/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java +++ b/codbex-employees/gen/codbex_employees/data/employees/EmployeeRepository.java @@ -12,13 +12,13 @@ public EmployeeRepository() { @Override public EmployeeEntity save(EmployeeEntity entity) { - entity.Name = entity["FirstName"] + " " + entity["LastName"]; + entity.Name = entity.FirstName + " " + entity.LastName; return super.save(entity); } @Override public EmployeeEntity update(EmployeeEntity entity) { - entity.Name = entity["FirstName"] + " " + entity["LastName"]; + entity.Name = entity.FirstName + " " + entity.LastName;; return super.update(entity); } }