Vues
Il s’agit de reproduire exactement la même logique que les abonnements SQL, mais en se basant sur le système de filtrage des vues.
La classe d’abonnement à utiliser est com.axemble.vdp.mapping.extensions.ViewMappingExtension
.
This subscription type enables to populate the fields values of process document with data coming from Process document such as the process instances or the Data Universe data.
The request is fully based on the views. The syntax is similar to the views definition but may be simplified if the generated view exactly corresponds to the request. In that case, you just need to reference the view, either by its ID, or by its « protocolURI » property.
Configuration XML
Ce type d’abonnement va intégrer une configuration XML spécifique qui sera la définition XML de notre filtre de vue. La syntaxe XML de cette définition est exactement la même que celle qui est utilisée dans les vues, dans les flux distants, …
<definition catalog="MyDatabase" catalogType="4" name="DEFAULT" type="resource">
<filters>
<fieldgroup operator="AND">
<field name="sys_ResourceDefinition" value="MATABLE"/>
</fieldgroup>
</filters>
<view>
<column name="Column_2"/>
</view>
</definition>
Les notions de “field-list” et “field-value” sont les mêmes que celles manipulées dans les abonnements SQL. Elles ne seront pas représentées ici.
Dans les exemples ci-dessous, la syntaxe est un peu différente dans la balise “action” des autres abonnements dans le sens où l’on se passe de l’attribut “field-id”; on passe directement le nom du champ abonné dans les attributs “field-list” ou “field-value”.
Dans le cas d’un abonnement avec copie de la valeur dans le champ abonné, ce champ doit bien sûr être de type “ressource externe”.
Example of « onLoad » type subscription
Here is a subscription definition example based on views and processed on the document loading.
When the document is loaded, the “onLoad” type subscription will be processed. The “view” attribute enables to specify on each generated view the request must be based on. The “action-key” attribute enables to define which column of the view will be used to populate the field of the action tag. By default, if this attribute is empty, the subscription will fill in the « Field_1 » field list with the first column of the view.
<subscription name="onLoad" subscription-class="com.axemble.vdoc.sdk.mapping.extensions.ViewMappingExtension" view="-bidzawpqyday3cew6fxys">
<action field-list="Field_1" prop-id="" throw-events="false" action-key="" />
</subscription>
Example of « onChange » type subscription
Here is subscription definition example processed on the field value change:
<subscription field-id="Field_1" name="onChange" prop-id=" " subscription-class="com.axemble.vdoc.sdk.mapping.extensions.ViewMappingExtension">
<definition catalog="CustomerSupport" catalogType="4" name="DEFAULT" type="resource">
<filters>
<fieldgroup operator="AND">
<field name="sys_ResourceTemplate" value="Test"/>
<field name="Column_1" value="$Document.Value('Field_1')"/>
</fieldgroup>
</filters>
<view>
<column name="Column_2"/>
</view>
</definition>
<action field-list="Field_2"/>
</subscription>
The second view subscription example will run on altering the value of the “Field_1” field. The « Field_2 » will get the value of the « column_2 ». The definition tag enables to define a view dynamically. The syntax is the same as the one used for the generated views.
Tags
Subscription
The “subscription” element defines the subscription input in XML of the resource template.
Element | Description |
---|---|
field-id | Modified document field and trigger of the “onChange” event. |
name | Name of occurred event |
prop-id | Not available |
subscription-class | Extension class: com.axemble.vdoc.sdk.mapping.extensions.ViewMappingExtension |
On-stage
The “on-stage” element defines the input of a step on which the subscription will be run.
Element | Description |
---|---|
name | System name of the concerned step. The keyword sys_CreationWizard enables to indicate that the treatment will be processed only on the action of process document creation. |
Definition
The “definition” element defines the dynamic view that will be processed. The syntax is the same as the generated views.
Action
The “action” element defines the input of an action to be performed after an event is triggered. Used in the XML resource template.
Element | Description |
---|---|
field-id | System name of the subscribed field |
prop-id | Not available |
update-mode | |
field-list / field-value | Request field that will be used to update the document field based on whether it is of list type (field-list) or not (field-value). |
The actions
Actions define all the document fields that will be updated when subscription is run. Actions can only be defined at the XML document level of the resource template. It is possible to define 1 to n actions.
The filters
Filters on steps can be placed to restrict subscriptions running on some steps. If no step has been specified, the subscription will be valid at all steps of the document. Filters are defined at the XML document level of the resource template. The on-stage tags can be present from 0 to n times.
Functions
Available formulas
Pas de formules disponibles ici.
Exemples
On va ici renseigner la liste des “clients” (“ListeDesClients”) avec des données en provenance d’une table des réservoirs de données. Cette table se nomme “Clients” et se situe dans le réservoir de données nommé “MyDataBase”.
On va en plus ajouter un “bind” avec le champ “TypeDeClient” (champ du processus) qui permettra de filtrer les clients remontés en fonction d’un champ existant du processus.
On récupérera la liste des “NomDuClient” dans la table “Clients”.
- Propriétés de la table clients : NomDuClient, TypeDeClient
- Champs du processus : TypeClient, ListeDesClients
<subscription field-id="TypeClient" name="onChange" subscription-class="com.axemble.vdoc.sdk.mapping.extensions.ViewMappingExtension">
<definition catalog="MyDataBase" catalogType="4" name="DEFAULT" type="resource">
<filters>
<fieldgroup operator="AND">
<field name="sys_ResourceDefinition" value="Clients"/>
<field name="TypeDeClient" value="${iResource.values.TypeClient}"/>
</fieldgroup>
</filters>
<view>
<column name="NomDuClient"/>
</view>
</definition>
<action field-list="ListeDesClients"/>
</subscription>
L’utilisation de la formule “$Document” est une des possibilités avancées de la description XML des vues.
Source :