All product information in wiki.bizagi.com is only valid for Bizagi BPM Suite 9.1.X.
For newer Bizagi BPM Suite versions (10.X and up) please visit the User Guide.
 

GetEntitiesUsingSchema

From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS

Jump to: navigation, search

<keywords content="keywords"> getEntitiesUsingSchema, getentitiesusingschema, getEntitiesUsingSchemaAsString, getentitiesusingschemaasstring, get Entities Using Schema, get entities using schema, SOA Layer, soa layer, EntityManagerSOA, entitymanagersoa, Entity Manager SOA, entity manager soa </keywords>

Contents

getEntitiesUsingSchema

This is a method from the EntityManagerSOA, useful for getting information saved in an entity (or entities) of a Bizagi database. This document also applies to the method getEntitiesUsingSchemaAsString.

Description

It receives an XMLDocument which specifies the entity in which the search will be performed, a filter to get a particular set of records from the table and a schema (XSD), also in XmlDocument format, indicating exactly the required data. The response is also returned in XmlDocument format. Another version of this method, called getEntitiesUsingSchemaAsString, instead of using XmlDocument format, receives and returns XML strings.

Input Data

This is the schema of the expected XML (copy it from here):


Parameter 1 - EntityData Node

EntityName: Is the name (not display name) of the desired entity. If this element is included the next one must not be.

EntityID: Is used instead of the previous method, do not include both. It is the id or key (in the database for the table ENTITY) of the entity that is to be consulted. It is easier to use this element when used in conjunction with other SOA methods, for example, the ones from the web service RenderSOA, which are used to replicate Bizagi forms in a user interface of an external system that return the ids of entities related to the metadata of the forms.

Filters: Set the filter for the consulted entity. The filter format is like a WHERE statement of a basic SQL query.

Example

This XML is used to retrieve all records from the Applicant entity with BuroScore less than 100.



Notice that the filter in this case is enclosed in a CDATA segment with the purpose of been available to use comparison operators, such as less than (<), greater than (>) and different from (<>), without problems, as these are special characters in XML.

The filter is optional; if it is not specified then all records in the entity are retrieved.

Some filter examples are:

<Filters> 
	<![CDATA[ (DocumentType = 1 OR City = 2) AND Approved = true ]]> 
</Filters> 


<Filters> 
	<![CDATA[ Option  = 'Automatic' ]]> 
</Filters> 


<Filters> 
	<![CDATA[ date1 >= '06/05/2008' ]]> 
</Filters> 

When comparing dates in filters, it is necessary to use the database's format.

Valid Operators

Operators that may be used in a filter are:

Character

Description

=

Equal to

<

Less than

>

Greater than

<>

Different from

!=

Different from

<=

Less than or Equal to

>=

Greater than or Equal to

Disabled Records

Normally, a query using the getEntitiesUsingSchema or getEntitiesUsingSchemaAsString methods, would not return disabled records from parameter entities. Records in parameter entities cannot be deleted (and it is recommended not to do so) but they may be disabled, so even if they are still in the database, these records will not be visible through the web application. If this information is required in the response, it can be obtained by adding the element FilterDisabled to the requested XML and setting its value to false. This is an example of such XML, using the Products entity and getting all records with ProductType equal to 3:


Parameter 2 - XSD

In this schema the data to be consulted is specified. It may include attributes of the entity and also use the existing relationships to obtain data from other entities. The following example shows how it is possible to obtain only three attributes from the Applicant entity.



Output Data

The response XML will show the records that match the search. Unlike the getEntities method, if an attribute included in the schema has no value (null or empty), it will still be displayed in the response. In the following example this behavior is shown for the DocumentNumber attribute.

Example

For the sample input XML this will be the response:



When the entity has a one-to-many relationship of a Collection type, the XML attribute key will show the id (key) of the record in the database. For one-to-many relationships that are not Collections, Bizagi will include in the response, in addition to the XML attribute key, an XML attribute called entityName with the name of the related entity.

Notes

  • When using this method, keep in mind that the data is physically stored into Bizagi entities once an activity has been fulfilled. This means that the information saved in an activity (using the Save button) or subprocess, may not be stored in the entities.



Go to SOA Layer <comments />