Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Working with Variables | About Variable Constraints
 
About Variable Constraints
 
Considerations for Object Constraints
Applying Constraints to a Variable
Customizing a String Content Type
Viewing the Constraints Applied to Variables
In pipeline, document, and input/output validation, the blueprint used for data validation requires constraints to be applied to its variables. Constraints are the restrictions on the structure or content of variables. You can apply the following types of constraints to variables:
*Structural constraints specify the existence and structure of variables at run time. For example, if the flow service in which you are validating the pipeline processes a purchase order, you might want to check that values for the purchaseOrderNumber, accountNumber, and customerName variables exist at run time.
For document and document list variables, you can also specify the structure of the variable; that is, you can specify what variables can be contained in the document (IData object) or document list (IData[ ] object) at run time. For example, you could specify that the lineItem document variable must contain the child variables itemNumber, quantity, size, color, and unitPrice. You could also specify that the lineItem document can optionally contain the child variable specialInstructions.
*Content constraints describe the data type for a variable and the possible values for the variable at run time. You can apply content constraints to String, String list, String table, Object, and Object list variables.
When you specify a content constraint for a String, String list or String table variable, you can also apply a constraining facet to the content. A constraining facet places limitations on the content (data type). For example, for a String variable named itemQuantity, you might apply a content constraint that requires the value to be an integer. You could then apply constraining facets that limit the content of itemQuantity to a value between 1 and 100.
You can use simple types from an IS schema as content constraints for String, String list, or String table variables.
For pipeline and document validation, the IS document type used as the blueprint needs to have constraints applied to its variables. For input/output validation, constraints need to be applied to the declared input and output parameters of the service being validated. For more information about data validation, see Performing Data Validation.
Note:
When you create an IS document type from an XML Schema or a DTD, the constraints applied to the elements and attributes in the original document are preserved in the new IS document type. For more information about creating IS document types, see Creating an IS Document Type.