Skip to content
Snippets Groups Projects
Commit 7000cb6d authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

First version of Address/Communication validation webservice

parent 3e402491
No related branches found
No related tags found
No related merge requests found
Showing
with 340 additions and 2 deletions
<?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.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.1">
<name>AddressValidation_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<titleProcess>%aditoprj%/entity/AddressValidation_entity/titleProcess.js</titleProcess>
<recordContainer>jdito</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
</entityProvider>
<entityField>
<name>UID</name>
<title>Address</title>
</entityField>
<entityProvider>
<name>ZipValidaton</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>1b2e3be5-b3be-42c5-a55f-b892fdfbf21f</name>
<entityName>Communication_entity</entityName>
<fieldName>AddressValidator</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>fcfcbebe-260a-4773-a874-9791b4887ae2</name>
<entityName>Address_entity</entityName>
<fieldName>ZipValidation</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>Type_param</name>
<valueProcess>%aditoprj%/entity/AddressValidation_entity/entityfields/zipvalidaton/children/type_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityParameter>
<name>Type_param</name>
<expose v="true" />
<mandatory v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
<name>Country_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>COUNTRY</name>
<title>Country</title>
</entityField>
<entityField>
<name>ZIP</name>
<title>Zip</title>
</entityField>
<entityField>
<name>CITY</name>
<title>City</title>
</entityField>
<entityField>
<name>DISTRICT</name>
<title>District</title>
</entityField>
<entityField>
<name>REGION</name>
<title>Region</title>
</entityField>
<entityField>
<name>STATE</name>
<title>State</title>
</entityField>
<entityField>
<name>VALUE</name>
</entityField>
<entityProvider>
<name>CityValidation</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>27114db7-8562-43b2-87d8-fa605bbf2319</name>
<entityName>Address_entity</entityName>
<fieldName>CityValidation</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>Type_param</name>
<valueProcess>%aditoprj%/entity/AddressValidation_entity/entityfields/cityvalidation/children/type_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jdito</name>
<contentProcess>%aditoprj%/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
<recordFields>
<element>UID.value</element>
<element>UID.displayValue</element>
<element>ZIP.value</element>
<element>CITY.value</element>
<element>COUNTRY.value</element>
<element>DISTRICT.value</element>
<element>REGION.value</element>
<element>STATE.value</element>
<element>VALUE.value</element>
</recordFields>
</jDitoRecordContainer>
</recordContainers>
</entity>
import("AddressValidation_lib");
import("system.result");
result.string(AddressValidationType.get().TYPE_CITY.key);
\ No newline at end of file
import("AddressValidation_lib");
import("system.result");
result.string(AddressValidationType.get().TYPE_CITY.key);
\ No newline at end of file
result.object(tr)
\ No newline at end of file
import("AddressValidation_lib");
import("system.result");
result.string(AddressValidationType.get().TYPE_ZIP.key);
\ No newline at end of file
import("AddressValidation_lib");
import("system.result");
result.string(AddressValidationType.get().TYPE_ZIP.key);
\ No newline at end of file
import("system.result");
import("system.logging");
import("AddressValidation_lib");
import("system.vars");
var type = "";
if (vars.exists("$param.Type_param") && vars.get("$param.Type_param"))
type = vars.get("$param.Type_param");
var country = "";
if (vars.exists("$param.Country_param") && vars.get("$param.Country_param"))
country = vars.get("$param.Country_param");
var filter = "";
var sysFilter = vars.get("$sys.filter");
if(sysFilter.filter != null) {
filter = JSON.parse(sysFilter.filter).childs[0].value;
}
var foundAddresses = AddressValidationUtils.validate(filter, type, country);
if (filter)
foundAddresses.push([filter, filter, filter, "", "", "", "", "", filter]);
result.object(foundAddresses);
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.VALUE"));
\ No newline at end of file
......@@ -37,7 +37,13 @@
<entityField>
<name>CITY</name>
<title>City</title>
<consumer>CityValidation</consumer>
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/city/mandatoryProcess.js</mandatoryProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/city/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/city/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
</onValueChangeTypes>
</entityField>
<entityField>
<name>COUNTRY</name>
......@@ -68,8 +74,14 @@
<entityField>
<name>ZIP</name>
<title>postcode</title>
<consumer>ZipValidation</consumer>
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/zip/mandatoryProcess.js</mandatoryProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/zip/displayValueProcess.js</displayValueProcess>
<onValidation>%aditoprj%/entity/Address_entity/entityfields/zip/onValidation.js</onValidation>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/zip/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
</onValueChangeTypes>
</entityField>
<entityProvider>
<name>OrganisationAddresses</name>
......@@ -288,6 +300,30 @@
<contentTypeProcess>%aditoprj%/entity/Address_entity/entityfields/is_standard_icon/contentTypeProcess.js</contentTypeProcess>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/is_standard_icon/valueProcess.js</valueProcess>
</entityField>
<entityConsumer>
<name>ZipValidation</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AddressValidation_entity</entityName>
<fieldName>ZipValidaton</fieldName>
</dependency>
<children>
<entityParameter>
<name>Country_param</name>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/zipvalidation/children/country_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>CityValidation</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AddressValidation_entity</entityName>
<fieldName>CityValidation</fieldName>
</dependency>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
// needed for instant display name change if value set by neon.setFieldValue
result.string(vars.get("$this.value"))
\ No newline at end of file
import("AddressValidation_lib");
AddressValidationUtils.setFields();
\ No newline at end of file
import("system.vars");
import("system.result");
// needed for instant display name change if value set by neon.setFieldValue
result.string(vars.get("$this.value"))
\ No newline at end of file
import("AddressValidation_lib");
AddressValidationUtils.setFields();
\ No newline at end of file
import("system.result");
import("system.vars");
result.string(vars.get("$field.COUNTRY"))
\ No newline at end of file
......@@ -14,6 +14,11 @@
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/Communication_entity/entityfields/addr/valueProcess.js</valueProcess>
<onValidation>%aditoprj%/entity/Communication_entity/entityfields/addr/onValidation.js</onValidation>
<onValueChange>%aditoprj%/entity/Communication_entity/entityfields/addr/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
<element>PROCESS</element>
</onValueChangeTypes>
</entityField>
<entityField>
<name>COMMUNICATIONID</name>
......@@ -203,6 +208,15 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<name>DATE_EDIT</name>
<valueProcess>%aditoprj%/entity/Communication_entity/entityfields/date_edit/valueProcess.js</valueProcess>
</entityField>
<entityConsumer>
<name>AddressValidator</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>AddressValidation_entity</entityName>
<fieldName>ZipValidaton</fieldName>
</dependency>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.util");
import("system.net");
import("system.vars");
import("Keyword_lib");
import("KeywordRegistry_basic");
import("system.neon");
import("PostalAddress_lib");
var addr = vars.get("$this.value");
if (addr)
{
var commMedium = vars.get("$field.MEDIUM_ID");
var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(commMedium, $KeywordRegistry.communicationMedium());
var commCategory = keywordAttributes.contentType || "TEXT";
switch (commCategory)
{
case "TELEPHONE": // Phone
if(addr.length > 5) // https://services.aditosoftware.local/services/rest/ws_checkPhoneNumber?Number=017666862716&Country=DE
{
var url = "https://services.aditosoftware.local/services/rest/ws_checkPhoneNumber";
var actionType = "GET";
var ret = JSON.parse(net.callRestWebserviceBasicAuth(url, actionType, {Number:addr, Country:vars.get("$param.ContactsMainCountry_param")}, null, null, "text/plain", "text/plain", util.DATA_TEXT, util.DATA_TEXT, "Admin", "a", true));
if (ret.hasHttpSuccessStatusCode)
{
neon.setFieldValue("$field.ADDR", ret.body);
}
else
{
// error handling
}
}
break;
default:
}
}
\ No newline at end of file
......@@ -5,7 +5,6 @@ import("system.tools");
import("Util_lib");
import("Contact_lib");
import("JditoFilter_lib");
var users;
if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
users = [tools.getUser(vars.get("$local.idvalues"), tools.PROFILE_FULL)];
......@@ -43,4 +42,4 @@ users = JditoFilterUtils.filterRecords(["UID", "TITLE", "TITLE_ORIGINAL", "ISACT
ArrayUtils.sort2d(users, 0, true, false); //sort by username
result.object(users);
\ No newline at end of file
result.object(users);
<?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>AddressValidation</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<lookupview>AddressValidationLookup_view</lookupview>
<entity>AddressValidation_entity</entity>
<references>
<neonViewReference>
<name>a093b522-3dc9-4c77-85f1-46ed07bd4be7</name>
<view>AddressValidationLookup_view</view>
</neonViewReference>
</references>
</neonContext>
......@@ -42,6 +42,18 @@
<name>6af52273-25bf-4286-83cc-217aea94ad09</name>
<entityField>ADDRIDENTIFIER</entityField>
</neonTableColumn>
<neonTableColumn>
<name>af515eed-da89-49dc-ba3a-30958bd4fedd</name>
<entityField>DISTRICT</entityField>
</neonTableColumn>
<neonTableColumn>
<name>29dbb3f5-6f80-4100-aed3-334ac0b9cc48</name>
<entityField>REGION</entityField>
</neonTableColumn>
<neonTableColumn>
<name>aafc58cf-7dbb-42cb-b04c-d0869e58d09a</name>
<entityField>STATE</entityField>
</neonTableColumn>
</columns>
</titledListViewTemplate>
</children>
......
<?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.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
<name>AddressValidationLookup_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>DataTable</name>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>a8787cc8-57a2-4cd5-903e-da14924a9052</name>
<entityField>ZIP</entityField>
</neonTableColumn>
<neonTableColumn>
<name>fb715731-9162-405e-b2e2-6c20921f026f</name>
<entityField>CITY</entityField>
</neonTableColumn>
<neonTableColumn>
<name>d32d92bf-db7d-443f-b911-6731ea89cf3b</name>
<entityField>COUNTRY</entityField>
</neonTableColumn>
<neonTableColumn>
<name>4035d833-ece7-4562-8acf-51c7a01b8497</name>
<entityField>DISTRICT</entityField>
</neonTableColumn>
<neonTableColumn>
<name>05bb9d3b-0e90-4a1a-bfe8-03b7dab6ed01</name>
<entityField>REGION</entityField>
</neonTableColumn>
<neonTableColumn>
<name>22779be5-4111-49c2-8821-0ec02cca40bb</name>
<entityField>STATE</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment