From 20106971a22ff65a708faccbfbbbb4dffa5e9b66 Mon Sep 17 00:00:00 2001 From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local> Date: Thu, 28 Mar 2019 16:25:47 +0100 Subject: [PATCH] Employee_entity --- entity/Employee_entity/Employee_entity.aod | 80 +++++++++++++++++++ .../confirm_password/onValidation.js | 6 ++ .../isactive/possibleItemsProcess.js | 7 ++ .../entityfields/isactive/valueProcess.js | 6 ++ .../entityfields/password/onValidation.js | 6 ++ .../setpassword/onActionProcess.js | 4 + .../entityfields/title/onValidation.js | 8 ++ .../recordcontainers/jdito/contentProcess.js | 24 ++++++ .../recordcontainers/jdito/onDelete.js | 4 + .../recordcontainers/jdito/onInsert.js | 13 +++ .../recordcontainers/jdito/onUpdate.js | 15 ++++ .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 4 + neonContext/Employee/Employee.aod | 33 ++++++++ .../EmployeeEdit_view/EmployeeEdit_view.aod | 39 +++++++++ .../EmployeeFilter_view.aod | 34 ++++++++ .../EmployeeMain_view/EmployeeMain_view.aod | 18 +++++ .../EmployeePassword_view.aod | 27 +++++++ .../EmployeePreview_view.aod | 17 ++++ 18 files changed, 345 insertions(+) create mode 100644 entity/Employee_entity/Employee_entity.aod create mode 100644 entity/Employee_entity/entityfields/confirm_password/onValidation.js create mode 100644 entity/Employee_entity/entityfields/isactive/possibleItemsProcess.js create mode 100644 entity/Employee_entity/entityfields/isactive/valueProcess.js create mode 100644 entity/Employee_entity/entityfields/password/onValidation.js create mode 100644 entity/Employee_entity/entityfields/setpassword/onActionProcess.js create mode 100644 entity/Employee_entity/entityfields/title/onValidation.js create mode 100644 entity/Employee_entity/recordcontainers/jdito/contentProcess.js create mode 100644 entity/Employee_entity/recordcontainers/jdito/onDelete.js create mode 100644 entity/Employee_entity/recordcontainers/jdito/onInsert.js create mode 100644 entity/Employee_entity/recordcontainers/jdito/onUpdate.js create mode 100644 neonContext/Employee/Employee.aod create mode 100644 neonView/EmployeeEdit_view/EmployeeEdit_view.aod create mode 100644 neonView/EmployeeFilter_view/EmployeeFilter_view.aod create mode 100644 neonView/EmployeeMain_view/EmployeeMain_view.aod create mode 100644 neonView/EmployeePassword_view/EmployeePassword_view.aod create mode 100644 neonView/EmployeePreview_view/EmployeePreview_view.aod diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod new file mode 100644 index 00000000000..1ed33a9fdb4 --- /dev/null +++ b/entity/Employee_entity/Employee_entity.aod @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.0"> + <name>Employee_entity</name> + <title>Employee</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <iconId>VAADIN:GROUP</iconId> + <recordContainer>jdito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>TITLE</name> + <title>Title</title> + <mandatory v="true" /> + <onValidation>%aditoprj%/entity/Employee_entity/entityfields/title/onValidation.js</onValidation> + </entityField> + <entityField> + <name>CONTACT_ID</name> + </entityField> + <entityField> + <name>FIRSTNAME</name> + <title>Firstname</title> + </entityField> + <entityField> + <name>LASTNAME</name> + <title>Lastname</title> + </entityField> + <entityField> + <name>ISACTIVE</name> + <title>Active</title> + <contentType>BOOLEAN</contentType> + <possibleItemsProcess>%aditoprj%/entity/Employee_entity/entityfields/isactive/possibleItemsProcess.js</possibleItemsProcess> + <valueProcess>%aditoprj%/entity/Employee_entity/entityfields/isactive/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>EMAIL_ADDRESS</name> + <title>Email address</title> + </entityField> + <entityField> + <name>PASSWORD</name> + <title>Password</title> + <contentType>PASSWORD</contentType> + <onValidation>%aditoprj%/entity/Employee_entity/entityfields/password/onValidation.js</onValidation> + </entityField> + <entityField> + <name>CONFIRM_PASSWORD</name> + <title>Confirm password</title> + <contentType>PASSWORD</contentType> + <onValidation>%aditoprj%/entity/Employee_entity/entityfields/confirm_password/onValidation.js</onValidation> + </entityField> + <entityActionField> + <name>setPassword</name> + <fieldType>ACTION</fieldType> + <title>Set Password</title> + <onActionProcess>%aditoprj%/entity/Employee_entity/entityfields/setpassword/onActionProcess.js</onActionProcess> + </entityActionField> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jdito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/Employee_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <onInsert>%aditoprj%/entity/Employee_entity/recordcontainers/jdito/onInsert.js</onInsert> + <onUpdate>%aditoprj%/entity/Employee_entity/recordcontainers/jdito/onUpdate.js</onUpdate> + <onDelete>%aditoprj%/entity/Employee_entity/recordcontainers/jdito/onDelete.js</onDelete> + <recordFields> + <element>UID.value</element> + <element>TITLE.value</element> + <element>ISACTIVE.value</element> + <element>FIRSTNAME.value</element> + <element>LASTNAME.value</element> + <element>EMAIL_ADDRESS.value</element> + </recordFields> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/Employee_entity/entityfields/confirm_password/onValidation.js b/entity/Employee_entity/entityfields/confirm_password/onValidation.js new file mode 100644 index 00000000000..1ade64458c9 --- /dev/null +++ b/entity/Employee_entity/entityfields/confirm_password/onValidation.js @@ -0,0 +1,6 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +if (vars.get("$field.PASSWORD") != vars.get("$field.CONFIRM_PASSWORD")) + result.string(translate.text("Password and confirmation must be the same!")); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/isactive/possibleItemsProcess.js b/entity/Employee_entity/entityfields/isactive/possibleItemsProcess.js new file mode 100644 index 00000000000..7ae1ab2b4f2 --- /dev/null +++ b/entity/Employee_entity/entityfields/isactive/possibleItemsProcess.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.result"); + +result.object({ + "true" : translate.text("Yes"), + "false" : translate.text("No") +}); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/isactive/valueProcess.js b/entity/Employee_entity/entityfields/isactive/valueProcess.js new file mode 100644 index 00000000000..d6c42ccf6d7 --- /dev/null +++ b/entity/Employee_entity/entityfields/isactive/valueProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) + result.string("true"); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/password/onValidation.js b/entity/Employee_entity/entityfields/password/onValidation.js new file mode 100644 index 00000000000..1ade64458c9 --- /dev/null +++ b/entity/Employee_entity/entityfields/password/onValidation.js @@ -0,0 +1,6 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +if (vars.get("$field.PASSWORD") != vars.get("$field.CONFIRM_PASSWORD")) + result.string(translate.text("Password and confirmation must be the same!")); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/setpassword/onActionProcess.js b/entity/Employee_entity/entityfields/setpassword/onActionProcess.js new file mode 100644 index 00000000000..72a4b78bd17 --- /dev/null +++ b/entity/Employee_entity/entityfields/setpassword/onActionProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.neon"); + +neon.openContext("Employee", "EmployeePassword_view", [vars.get("$field.TITLE")], neon.OPERATINGSTATE_EDIT, null); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/title/onValidation.js b/entity/Employee_entity/entityfields/title/onValidation.js new file mode 100644 index 00000000000..86daa11792b --- /dev/null +++ b/entity/Employee_entity/entityfields/title/onValidation.js @@ -0,0 +1,8 @@ +import("system.translate"); +import("system.neon"); +import("system.vars"); +import("system.result"); +import("system.tools"); + +if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.TITLE") && tools.existUsers(vars.get("$field.TITLE"))) + result.string(translate.text("The title already exists!")); diff --git a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 00000000000..8a479d6601b --- /dev/null +++ b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,24 @@ +import("system.vars"); +import("system.result"); +import("system.tools"); +import("Util_lib"); + +var users; +if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) + users = vars.get("$local.idvalues"); +else + users = tools.getStoredUsers().map(function (row) {return row[1];}); +users = users.map(function (user) +{ + user = tools.getUser(user); + return [ + user.title, + user.title, + user.params.isActive, + user.params.firstname, + user.params.lastname, + user.params.email + ]; +}); + +result.object(users); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onDelete.js b/entity/Employee_entity/recordcontainers/jdito/onDelete.js new file mode 100644 index 00000000000..e10dd07e518 --- /dev/null +++ b/entity/Employee_entity/recordcontainers/jdito/onDelete.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.tools"); + +tools.deleteUser(vars.get("$field.TITLE")); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onInsert.js b/entity/Employee_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 00000000000..a82eeac785c --- /dev/null +++ b/entity/Employee_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,13 @@ +import("system.vars"); +import("system.tools"); + +var user = {}; +var parameters = []; //this has to be an array +parameters[tools.FIRSTNAME] = vars.get("$field.FIRSTNAME"); +parameters[tools.LASTNAME] = vars.get("$field.LASTNAME"); +parameters[tools.EMAIL] = vars.get("$field.EMAIL_ADDRESS"); + +user[tools.TITLE] = vars.get("$field.TITLE"); +user[tools.PARAMS] = params; + +tools.insertUser(user); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js new file mode 100644 index 00000000000..2208551717d --- /dev/null +++ b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js @@ -0,0 +1,15 @@ +import("system.vars"); +import("system.tools"); + +var user = tools.getUser(vars.get("$field.TITLE")); + +user.params[tools.FIRSTNAME] = vars.get("$field.FIRSTNAME"); +user.params[tools.LASTNAME] = vars.get("$field.LASTNAME"); +user.params[tools.EMAIL] = vars.get("$field.EMAIL_ADDRESS"); + +if (vars.get("$field.PASSWORD") && vars.get("$field.PASSWORD") == vars.get("$field.CONFIRM_PASSWORD")) +{ + user[tools.PASSWORD] = vars.get("$field.PASSWORD"); +} + +tools.updateUser(user); \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 3644aa55f82..f8e2253344b 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -130,6 +130,10 @@ <key>Medium</key> <value>Medium</value> </entry> + <entry> + <key>The title already exists!</key> + <value>Der Titel existiert bereits!</value> + </entry> <entry> <key>Internet</key> <value>Internet</value> diff --git a/neonContext/Employee/Employee.aod b/neonContext/Employee/Employee.aod new file mode 100644 index 00000000000..e9eced12536 --- /dev/null +++ b/neonContext/Employee/Employee.aod @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>Employee</name> + <title>Employee</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <mainview>EmployeeMain_view</mainview> + <filterview>EmployeeFilter_view</filterview> + <editview>EmployeeEdit_view</editview> + <preview>EmployeePreview_view</preview> + <entity>Employee_entity</entity> + <references> + <neonViewReference> + <name>51816f14-17da-4c96-80d8-f3b5280863b8</name> + <view>EmployeeFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>91c2bbc7-89fb-4688-881e-6fa21e96b211</name> + <view>EmployeeEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>6a36e3cf-5918-4c60-94d9-a3a7ed50ffce</name> + <view>EmployeePreview_view</view> + </neonViewReference> + <neonViewReference> + <name>215e8e26-662f-45f6-9c61-c0b0b1129e66</name> + <view>EmployeeMain_view</view> + </neonViewReference> + <neonViewReference> + <name>a01b0910-cd32-4fa7-a739-0b9eb19debc2</name> + <view>EmployeePassword_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/EmployeeEdit_view/EmployeeEdit_view.aod b/neonView/EmployeeEdit_view/EmployeeEdit_view.aod new file mode 100644 index 00000000000..cb955b069aa --- /dev/null +++ b/neonView/EmployeeEdit_view/EmployeeEdit_view.aod @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.0"> + <name>EmployeeEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Generic</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>aff1892e-9fca-45cd-bcd6-d2b857e2cb7b</name> + <entityField>TITLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>9170856b-45c2-4d8a-864d-4db36bfe4a8c</name> + <entityField>ISACTIVE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7d36467f-8b79-4647-b8e5-5759bdbf37a7</name> + <entityField>FIRSTNAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>00a2dedb-67f5-4662-b053-bf841b30e365</name> + <entityField>LASTNAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>6155e6b7-ee2c-45b4-87f5-9e506ffc5775</name> + <entityField>EMAIL_ADDRESS</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/EmployeeFilter_view/EmployeeFilter_view.aod b/neonView/EmployeeFilter_view/EmployeeFilter_view.aod new file mode 100644 index 00000000000..42acff8f127 --- /dev/null +++ b/neonView/EmployeeFilter_view/EmployeeFilter_view.aod @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.0"> + <name>EmployeeFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Employees</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>3e3552f9-9591-45ae-a0bb-a85210c2b382</name> + <entityField>TITLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>307dfdad-a0b2-436f-b8a1-9825821dba0c</name> + <entityField>ISACTIVE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>18b974f1-81ea-4ca0-83bf-a1505f763446</name> + <entityField>FIRSTNAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>27c4199c-157a-4c3e-a851-01aa1d82dfd2</name> + <entityField>LASTNAME</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/EmployeeMain_view/EmployeeMain_view.aod b/neonView/EmployeeMain_view/EmployeeMain_view.aod new file mode 100644 index 00000000000..0cceb2165e1 --- /dev/null +++ b/neonView/EmployeeMain_view/EmployeeMain_view.aod @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.0"> + <name>EmployeeMain_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <masterSlaveLayout> + <name>layout</name> + <master>f9ae631b-48ad-4d7c-a3a1-6cb00230e5c7</master> + </masterSlaveLayout> + </layout> + <children> + <neonViewReference> + <name>f9ae631b-48ad-4d7c-a3a1-6cb00230e5c7</name> + <entityField>#ENTITY</entityField> + <view>EmployeePreview_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/EmployeePassword_view/EmployeePassword_view.aod b/neonView/EmployeePassword_view/EmployeePassword_view.aod new file mode 100644 index 00000000000..0731140bd02 --- /dev/null +++ b/neonView/EmployeePassword_view/EmployeePassword_view.aod @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.0"> + <name>EmployeePassword_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Password</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>632294e8-f9ec-4bd1-afe4-87e3b5fc84c4</name> + <entityField>PASSWORD</entityField> + </entityFieldLink> + <entityFieldLink> + <name>66a7726a-c226-4d74-95a4-ea88950920bf</name> + <entityField>CONFIRM_PASSWORD</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/EmployeePreview_view/EmployeePreview_view.aod b/neonView/EmployeePreview_view/EmployeePreview_view.aod new file mode 100644 index 00000000000..d18d815697a --- /dev/null +++ b/neonView/EmployeePreview_view/EmployeePreview_view.aod @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.0"> + <name>EmployeePreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <cardViewTemplate> + <name>Card</name> + <titleField>TITLE</titleField> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + </children> +</neonView> -- GitLab