ProviderPipeline
A search can be carried out via the DataProviders
in primedocs and the data is then presented to the user.
This procedure is sufficient for endpoints where all data is already transmitted via a single search query.
In the event that a search query returns essential but not all data, the ProviderPipeline
can be used.
The ProviderPipeline
makes it possible to store a separate DataProvider for the search. If the user selects the corresponding data record, further details are reloaded via an additional DataProvider
.
Searching
& Loading
The ProviderPipeline
behaves like a normal DataProvider
, but is divided into two “phases”:
<ProviderPipeline DisplayName="Zefix">
<Searching>
...
</Searching>
<Loading>
...
</Loading>
</ProviderPipeline>
Within Searching
and Loading
, all DataProviders
except the ExistingListDataProvider
(and the ProviderPipeline
itself) can be configured. It is also permitted to use a different DataProvider
in the Searching
step than in the Loading
step.
Search parameters & Data loading
SearchParameters
must be specified for the search in the Searching
step.
The search result must be based on the schema of the Object
or the ObjectCollection
.
The fields of the search result can then be accessed in the Loading
step, e.g. to load further details with an ID.
No further SearchParameters
may be defined in the Loading
step.
Example
In the example, company data is queried via the Zefix service.
The name and identification number are provided as search results. If the user selects the search results, the address data is automatically loaded.
<ProviderPipeline DisplayName="Zefix">
<Searching>
<HttpDataProvider>
<SearchParameters>
<Text Id="Query" Label="Query" />
</SearchParameters>
<Configuration>
<Step>
<Request Method="Post">
<Url>https://www.zefix.admin.ch/ZefixPublicREST/api/v1/company/search</Url>
<Header Name="Authorization" Value="Basic [ZEFIX-AUTH-KEY]" />
<Header Name="Content-Type" Value="application/json" />
<Header Name="accept" Value="application/json" />
<Body>{
"name": "{Query}",
"activeOnly": true
}</Body>
</Request>
<Response>
<Data JsonPath="$.[*]">
<Mapping>
<Map Source="uid" Target="uid" />
<Map Source="name" Target="name" />
</Mapping>
</Data>
</Response>
</Step>
</Configuration>
</HttpDataProvider>
</Searching>
<Loading>
<HttpDataProvider>
<Configuration>
<Step>
<Request Method="Get">
<Url>https://www.zefix.admin.ch/ZefixPublicREST/api/v1/company/uid/{uid}</Url>
<Header Name="Authorization" Value="Basic [ZEFIX-AUTH-KEY]" />
<Header Name="Content-Type" Value="application/json" />
<Header Name="accept" Value="application/json" />
</Request>
<Response>
<Data JsonPath="$.[*]">
<Mapping>
<Map Source="uid" Target="uid" />
<Map Source="name" Target="name" />
<Map Source="address.street" Target="street" />
<Map Source="address.houseNumber" Target="houseNumber" />
<Map Source="address.city" Target="city" />
<Map Source="address.swissZipCode" Target="swissZipCode" />
</Mapping>
</Data>
</Response>
</Step>
</Configuration>
</HttpDataProvider>
</Loading>
</ProviderPipeline>
PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland