Skip to main content

Trainee example

This appendix contains the files required to prepare the Trainee example that is used to explain the configuration of a FilterExtensionSet.

Extending the changelog.xml Files

In the project tree under alias > Data_alias, create a new folder named trainee. Then create the following changelog file inside that folder.

.alias/Data_alias/trainee/changelog.xml

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<include relativeToChangelogFile="true" file="create_trainee.xml"/>
</databaseChangeLog>

Adding a Reference to the New changelog.xml

Next, add a reference to the new changelog file in the main changelog.xml:

.alias/Data_alias/changelog.xml

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<include relativeToChangelogFile="true" file="../Loghistory_alias/changelog.xml"/>

(...)

<include relativeToChangelogFile="true" file="../Demodata_Data_alias/changelog.xml"/>
<include relativeToChangelogFile="true" file="trainee/changelog.xml"/>
</databaseChangeLog>

Creating the Database Table

In the trainee folder, add the following file and name it create_trainee.xml.

.alias/Data_alias/trainee/create_trainee.xml

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<changeSet author="p.dietl" id="a4d54535-7193-4148-b6b7-58624b5e05fd">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="trainee" />
</not>
</preConditions>
<createTable tableName="trainee">
<column name="TRAINEEID" type="CHAR(36)">
<constraints nullable="false" primaryKey="true" />
</column>
<column name="FIRSTNAME" type="VARCHAR(30)" />
<column name="LASTNAME" type="VARCHAR(30)" />
<column defaultValueComputed="NULL" name="BIRTHDAY" type="date" />
<column name="GENDER" type="VARCHAR(36)" />
<column defaultValueComputed="NULL" name="GRADEENGLISH" type="INT" />
<column defaultValueComputed="NULL" name="GRADEGERMAN" type="INT" />
<column defaultValueComputed="NULL" name="GRADEMATH" type="INT" />
<column defaultValueComputed="NULL" name="PICTURE" type="LONGBLOB" />
<column name="TYEAR" type="VARCHAR(50)" />
</createTable>
</changeSet>
<changeSet author="p.dietl" id="a4d54535-7193-4148-b6b7-58624b5e05f7">
<insert tableName="trainee">
<column name="TRAINEEID" value="17c57879-31f0-4ec3-b510-8efa414b6127" />
<column name="FIRSTNAME" value="John" />
<column name="LASTNAME" value="Smith" />
<column name="BIRTHDAY" valueDate="1996-05-23" />
<column name="GENDER" value="m" />
<column name="GRADEGERMAN" valueNumeric="3" />
<column name="GRADEMATH" valueNumeric="2" />
<column name="TYEAR" value="1" />
</insert>
<insert tableName="trainee">
<column name="TRAINEEID" value="19588327-6191-4a63-be40-0ea617690f0f" />
<column name="FIRSTNAME" value="Luke" />
<column name="LASTNAME" value="Taylor" />
<column name="BIRTHDAY" valueDate="2009-01-26" />
<column name="GENDER" value="m" />
<column name="GRADEGERMAN" valueNumeric="4" />
<column name="GRADEMATH" valueNumeric="4" />
<column name="PICTURE" />
<column name="TYEAR" value="2" />
</insert>
<insert tableName="trainee">
<column name="TRAINEEID" value="633d69a4-a64b-4356-a870-b55fb1cef10b" />
<column name="FIRSTNAME" value="Anne" />
<column name="LASTNAME" value="Miller" />
<column name="BIRTHDAY" valueDate="2010-04-13" />
<column name="GENDER" value="f" />
<column name="GRADEENGLISH" valueNumeric="2" />
<column name="GRADEMATH" valueNumeric="4" />
<column name="TYEAR" value="3" />
</insert>
<insert tableName="trainee">
<column name="TRAINEEID" value="6539126d-4a59-413e-a468-4bc36b5ae7f5" />
<column name="FIRSTNAME" value="Thomas" />
<column name="LASTNAME" value="Hiller" />
<column name="BIRTHDAY" valueDate="2008-10-28" />
<column name="GENDER" value="m" />
<column name="GRADEENGLISH" valueNumeric="2" />
<column name="GRADEMATH" valueNumeric="1" />
<column name="PICTURE" />
<column name="TYEAR" value="2" />
</insert>
</changeSet>
</databaseChangeLog>

Executing a Liquibase Update

Execute a Liquibase update based on the main changelog.xml. After a short time, the new database table trainee should be visible in the ADITO Designer database editor.

Creating the Entity

In the project tree, navigate to the entity folder and create a new Entity named Trainee_entity. Open the Source tab of the new Entity and replace its content with the following .aod code:

.entity/Trainee_entity

<?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.4.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.4.0">
<name>Trainee_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>VAADIN:GAMEPAD</icon>
<contentTitleProcess>%aditoprj%/entity/Trainee_entity/contentTitleProcess.js</contentTitleProcess>
<iconId>VAADIN:ABACUS</iconId>
<recordContainer>db</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
</entityProvider>
<entityProvider>
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityField>
<name>TRAINEEID</name>
<title>Traineeid</title>
<groupable v="false" />
</entityField>
<entityField>
<name>GENDER</name>
<title>Gender</title>
<groupable v="false" />
<dropDownProcess>%aditoprj%/entity/Trainee_entity/entityfields/gender/dropDownProcess.js</dropDownProcess>
</entityField>
<entityField>
<name>FIRSTNAME</name>
<title>Firstname</title>
<groupable v="false" />
<mandatory v="true" />
</entityField>
<entityField>
<name>LASTNAME</name>
<title>Lastname</title>
<groupable v="false" />
<mandatory v="true" />
</entityField>
<entityField>
<name>BIRTHDAY</name>
<title>Birthday</title>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
<groupable v="false" />
</entityField>
<entityField>
<name>GRADEENGLISH</name>
<title>English</title>
<colorProcess>%aditoprj%/entity/Trainee_entity/entityfields/gradeenglish/colorProcess.js</colorProcess>
<contentType>NUMBER</contentType>
<maxIntegerDigits v="1" />
<maxFractionDigits v="2" />
<groupable v="false" />
</entityField>
<entityField>
<name>GRADEGERMAN</name>
<title>German</title>
<colorProcess>%aditoprj%/entity/Trainee_entity/entityfields/gradegerman/colorProcess.js</colorProcess>
<contentType>NUMBER</contentType>
<groupable v="false" />
</entityField>
<entityField>
<name>GRADEMATH</name>
<title>Math</title>
<colorProcess>%aditoprj%/entity/Trainee_entity/entityfields/grademath/colorProcess.js</colorProcess>
<contentType>NUMBER</contentType>
<groupable v="false" />
</entityField>
<entityField>
<name>fullName</name>
<title>Full Name</title>
<groupable v="false" />
<valueProcess>%aditoprj%/entity/Trainee_entity/entityfields/fullname/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>gradeAverage</name>
<title>Average Grade</title>
<colorProcess>%aditoprj%/entity/Trainee_entity/entityfields/gradeaverage/colorProcess.js</colorProcess>
<contentType>NUMBER</contentType>
<groupable v="false" />
<valueProcess>%aditoprj%/entity/Trainee_entity/entityfields/gradeaverage/valueProcess.js</valueProcess>
</entityField>
<entityActionField>
<name>showOverallAverage</name>
<title>Show Overall Average</title>
<onActionProcess>%aditoprj%/entity/Trainee_entity/entityfields/showoverallaverage/onActionProcess.js</onActionProcess>
<iconId>VAADIN:ABACUS</iconId>
</entityActionField>
<entityField>
<name>icon</name>
<contentType>IMAGE</contentType>
<groupable v="false" />
<valueProcess>%aditoprj%/entity/Trainee_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>age</name>
<title>Age</title>
<groupable v="false" />
<valueProcess>%aditoprj%/entity/Trainee_entity/entityfields/age/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>PICTURE</name>
<title>Picture</title>
<contentType>IMAGE</contentType>
<groupable v="false" />
<displayValueProcess>%aditoprj%/entity/Trainee_entity/entityfields/picture/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>TYEAR</name>
<title>Year of training</title>
<groupable v="false" />
<dropDownProcess>%aditoprj%/entity/Trainee_entity/entityfields/tyear/dropDownProcess.js</dropDownProcess>
</entityField>
<entityConsumer>
<name>KeywordGenders</name>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/Trainee_entity/entityfields/keywordgenders/children/containername_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<recordFieldMappings>
<dbRecordFieldMapping>
<name>BIRTHDAY.value</name>
<recordfield>TRAINEE.BIRTHDAY</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>FIRSTNAME.value</name>
<recordfield>TRAINEE.FIRSTNAME</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>GENDER.value</name>
<recordfield>TRAINEE.GENDER</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>GRADEENGLISH.value</name>
<recordfield>TRAINEE.GRADEENGLISH</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>GRADEGERMAN.value</name>
<recordfield>TRAINEE.GRADEGERMAN</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>GRADEMATH.value</name>
<recordfield>TRAINEE.GRADEMATH</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>LASTNAME.value</name>
<recordfield>TRAINEE.LASTNAME</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>TRAINEEID.value</name>
<recordfield>TRAINEE.TRAINEEID</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>PICTURE.value</name>
<recordfield>TRAINEE.PICTURE</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>TYEAR.value</name>
<recordfield>TRAINEE.TYEAR</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>fullName.value</name>
<expression>%aditoprj%/entity/Trainee_entity/recordcontainers/db/recordfieldmappings/fullname.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
<linkInformation>
<linkInformation>
<name>TRAINEE</name>
<tableName>TRAINEE</tableName>
<primaryKey>TRAINEEID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
</linkInformation>
<filterExtensions>
<filterExtensionSet>
<name>example_filterSet</name>
<filterFieldsProcess>%aditoprj%/entity/Trainee_entity/recordcontainers/db/filterextensions/example_filterset/filterFieldsProcess.js</filterFieldsProcess>
<filterValuesProcess>%aditoprj%/entity/Trainee_entity/recordcontainers/db/filterextensions/example_filterset/filterValuesProcess.js</filterValuesProcess>
<filterConditionProcess>%aditoprj%/entity/Trainee_entity/recordcontainers/db/filterextensions/example_filterset/filterConditionProcess.js</filterConditionProcess>
<isGroupable v="true" />
<groupQueryProcess>%aditoprj%/entity/Trainee_entity/recordcontainers/db/filterextensions/example_filterset/groupQueryProcess.js</groupQueryProcess>
<filtertype>BASIC</filtertype>
</filterExtensionSet>
</filterExtensions>
</dbRecordContainer>
</recordContainers>
</entity>

Creating Context and FilterView

In the project tree, navigate to folder "context" and create a new Context named "Trainee". Set the new Context's property "entity" to "Trainee_entity".

Create a new View for the "Trainee" context and name it TraineeFilter_view. Open the new View's tab "Source" and replace its content by the following .aod code:

.context/Trainee/TraineeFilter_view

<?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.2.3" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.2.3">
<name>TraineeFilter_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<filterable v="true" />
<layout>
<groupLayout />
</layout>
<children>
<tableViewTemplate>
<name>table</name>
<columns>
<neonTableColumn>
<name>c37bea5c-c392-4d15-9fe6-cb78fde71f44</name>
<entityField>PICTURE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>304b0639-465d-4bc3-99af-cbeae503061f</name>
<entityField>icon</entityField>
</neonTableColumn>
<neonTableColumn>
<name>693f9d93-a5af-469c-92d2-40bf803d4335</name>
<entityField>fullName</entityField>
</neonTableColumn>
<neonTableColumn>
<name>11bc9624-2e5e-46fa-aa0c-c589e1e828be</name>
<entityField>BIRTHDAY</entityField>
</neonTableColumn>
<neonTableColumn>
<name>29846123-c312-4ec8-9a1d-b60b6084254a</name>
<entityField>age</entityField>
</neonTableColumn>
<neonTableColumn>
<name>4eae11fc-78e6-449b-b78e-0261b4085921</name>
<entityField>GENDER</entityField>
</neonTableColumn>
<neonTableColumn>
<name>81beca91-5f97-44f6-b081-2a6bb913ab6d</name>
<entityField>TYEAR</entityField>
</neonTableColumn>
<neonTableColumn>
<name>a99c5447-ef47-4d5e-bd77-6346fbceeee6</name>
<entityField>GRADEENGLISH</entityField>
</neonTableColumn>
<neonTableColumn>
<name>e78f0f90-b82c-455e-85be-091fdeb46290</name>
<entityField>GRADEGERMAN</entityField>
</neonTableColumn>
<neonTableColumn>
<name>b152e8f8-aa70-4b56-9084-d86418227bde</name>
<entityField>GRADEMATH</entityField>
</neonTableColumn>
<neonTableColumn>
<name>70908d27-330e-4574-986e-c645466627ad</name>
<entityField>gradeAverage</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
<treeTableViewTemplate>
<name>treetable</name>
<columns>
<neonTreeTableColumn>
<name>ad9d3a2c-d14a-4337-86b0-7dfdc9dbc319</name>
<entityField>PICTURE</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>4e9dad95-ecc0-4bdd-8d4e-43c73ddc3680</name>
<entityField>icon</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>22b9cc6d-df6b-4028-9571-c3791f813d31</name>
<entityField>fullName</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>a857676b-b6ed-4bdf-aaec-c354176831a7</name>
<entityField>BIRTHDAY</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>6763a5cd-7fa3-4ee7-93b6-0dcfaf8fee94</name>
<entityField>age</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>091e3e63-fe3c-4855-bd47-c3efe97323dd</name>
<entityField>GENDER</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>b7356bb8-d671-4755-84e7-41b4196af971</name>
<entityField>TYEAR</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>d033c989-85a3-4346-b2ff-c9fc465c852d</name>
<entityField>GRADEENGLISH</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>c06f06cb-8f8a-4804-a315-d060f61af8d7</name>
<entityField>GRADEGERMAN</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>f9c9e994-ceed-4451-bb55-2209b974bedc</name>
<entityField>GRADEMATH</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>9ad174dd-6913-47df-9981-7f2ec05e6342</name>
<entityField>gradeAverage</entityField>
</neonTreeTableColumn>
</columns>
</treeTableViewTemplate>
</children>
</neonView>

Next, set the "Trainee" Context's property "filterView" to "TraineeFilter_view".

Adding the Context to the Global Menu

In the project tree, open the menu editor (application > ____SYSTEM_APPLICATION_NEON) and add the new Context "trainee" to the Global Menu. (Optionally, create a new menu group for it, titled, e.g., "Trainee Management".)

Deploy, logout, and login to the web client. Open the new Context "Trainee". You can now continue with chapter FilterExtensionSet.