GetCaseDataUsingSchema
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords"> getCaseDataUsingSchema, getcasedatausingschema, getCaseDataUsingSchemaAsString, getcasedatausingschemaasstring, getCaseDataUsingSchemaLite, getcasedatausingschemalite, getCaseDataUsingSchemaLiteAsString, getcasedatausingschemaliteasstring, get Case Data Using Schema, get case data using schema, SOA Layer, soa layer, EntityManagerSOA, entitymanagersoa, Entity Manager SOA, entity manager soa </keywords>
Contents |
getCaseDataUsingSchema
A method from the EntityManagerSOA web service, used to seek information about a case in Bizagi, given the case identification number and a schema specifying the desired data. This document also applies to the methods: getCaseDataUsingSchemaAsString, getCaseDataUsingSchemaLite and getCaseDataUsingSchemaLiteAsString
Description
This method receives two parameters, an integer corresponding to the idCase of the case that is to be consulted and a schema (XSD). This schema must be consistent with the structure of Bizagi’s entity-relationship model.
In response, the method will return an XML with the query’s result. The method getCaseDataUsingSchemaAsString works in the same way but it receives and returns a string XML, instead of an XmlDocument which is the data type used by getCaseDataUsingSchema. Additionally there are another two methods, getCaseDataUsingSchemaLite and getCaseDataUsingSchemaLiteAsString. These methods have the same functionality as the previous ones with only one difference, for attributes of File type, the content of the file is not retrieved. For the methods getCaseDataUsingSchema and getCaseDataUsingSchemaAsString the content of a file is included in the XML as a sequence of characters from a Base64 byte array (as is recommended for XML).
Input Data
Parameter 1 (Integer Type)
idCase: Corresponds to the internal identification number (id in the database) of the Bizagi case.
Parameter 2 (Integer Type)
idWorkitem: Optional. Retrieves information which has been saved in a given Activity (in the scope), but not necessarily has been persisted yet.
Parameter 3 (XmlDocument or String Type)
xsd: Schema with the data to be extracted. An easy way to create this schema is to use the Xml Schemas option for the entity with the highest hierarchy in the data model (e.g. the application entity).
Example
For a project with the following data model:
This will be an example of a schema sent as second parameter (copy it form here):
This schema starts with the name of the attribute in the Application entity related to the Process entity. From here on, the schema is constructed including all desired attributes (using its Name not the Display Name) and using the relationships to go to other entities. Relationships of Collection type are included differently; since these are one-to-many relationships, starting from the "one entity" (Request), first is the relationship’s name (Applicants) then the name of the "many entity" (Applicant), and finally, it is possible to include attributes of this entity.
Output Data
The output is an XmlDocument with the requested information included in the schema, like this (copy it form here):
Notice that even though the attributes DocumentNumber and idDocumentType were included in the sample input schema, these do not appear in the response. The reason for this is that, for the consulted case, there is no information in these attributes (the attributes values are null), so Bizagi does not include them in the response by default. If it is desired to include them in the response XML, even without information, include in XSD nillable="true". For example:
This must be done also for the element idDocumentType and its sub-element Name. After this is done the new response will be:
When the response includes a one-to-many relationship as a Collection, in this example the element "idRequest" has several "Applicant" elements, each element of the Collection (Applicant) will include an XML attribute named "key", which indicates the id (or key) of this record in the database.
On the other hand, if the one-to-many relationship is not a Collection (like the idDocumentType in this example), Bizagi will include in its response for this element, the name of the related entity in a XML attribute named "EntityName", together with the XML attribute "key" with the record’s id. Here is an example of this if the "idDocumentType" attribute has information in the database:
Notes
- The attribute nillable works to consult data of a case with an XSD. It is not implemented to consult data of an entity with an XSD (it will not work for the method getEntitiesUsingSchema).
- This will retrieve the existing information in a case, but not the information saved in certain ongoing activities. That is to say, if the activity has not been finished, the newly entered information may be saved but still has not been committed in the database, so it will not be included in the response of this method until the activity is advanced (Next is clicked).
- The XSD must start with the name of the attribute in the Application entity related to the Process entity.
Go to SOA Layer <comments />