Bridge 7 The Persistent State Control Adapter gives access to persistent state metadata directly from within a service (self context). The same data can be retrieved using the xUML Runtime API.
|
What a <<PersistentStateControl>> action does can be controlled via tagged value action. Currently the following actions are supported:
listOwners lists all owners that are maintaining persistent state objects of the current service.
For more information on how to manage ownership of persistent state objects, refer to Persistent State Ownership .
Name | Type | Direction | Mandatory | Description |
---|---|---|---|---|
owners | Array of Owner | out | The adapter returns an array of owner details. |
getOwnerName returns the name of the current owner (self).
For more information on how to manage ownership of persistent state objects, refer to Persistent State Ownership .
Name | Type | Direction | Mandatory | Description |
---|---|---|---|---|
ownerName | String | out | The adapter returns the name of the current owner as a String. |
listClasses returns an array list of all available persistent state classes of the current service (self). By specifying includeObjectCount = true, you can get the actual object count per class.
Name | Type | Direction | Mandatory | Description | Allowed Values | |
---|---|---|---|---|---|---|
includeObjectCount | Boolean | in | Specify whether to include an object count per class to the response. | true | Include an object count per class. | |
false | Do not include an object count per class (default). | |||||
classes | Array of ClassInfo | out | The adapter returns a list of classes as an Array of ClassInfo. |
getClassCounters returns an array list of all available persistent state classes of the current service (self) and their actual counters. Refer to type ClassCounters for more details on which counters are available.
Name | Type | Direction | Mandatory | Description |
---|---|---|---|---|
counters | Array of ClassCounters | out | The adapter returns the object counters per class as an Array. Refer to type ClassCounters for more details on the counters. |
getClassMetadata returns the metadata of a given class. The action returns an array list of all attributes and their types.
Name | Type | Direction | Mandatory | Description | ||
---|---|---|---|---|---|---|
class | String | in | Specify the name of the class to get metadata of. You can provide the value dynamically or via tagged value class on the adapter action. | |||
classMetadata | ClassMetadata | out | The adapter returns a ClassMetadata object, listing all attributes and their metadata, and the primary and search keys.
|
With action queryObjects you can query the persistent state database for objects of a given class. Queries can use simple query conditions and complex query conditions (and/or).
Using queryObjects, the persistent state database can be search by the search keys that are defined on the persistent state class. |
Queries are steered by parameter selectQuery that, on the one hand, specifies global search data like searching by object dates and search order, and, on the other hand, can hold complex search queries.
Name | Type | Direction | Mandatory | Description | Allowed Values | |
---|---|---|---|---|---|---|
selectQuery | SelectObjectsQuery | in | Provide a search query. | . | ||
includeObjectData | Boolean | in | Specify whether to include object data of the matching objects to the response. | true | Return object data of the found objects. | |
false | Only return the objects metadata (default). | |||||
objectEntries | Array of ObjectEntry | out | The adapter returns an array of objects and some basic object metadata per object. |
Attribute condition of type SelectObjectsQuery holds the custom search query itself.
By using only one condition of type SimpleQueryCondition you can build a simple query. Find below a the activity diagram of a simple query that returns all purchase orders with 2 or more open items.
selectQuery.conditions holds the query condition. It consists of
Valid operators are:
Operator | Description |
---|---|
= | Equal. |
!= | Not equal. |
< | Less than. |
<= | Less or equal. |
> | Greater than. |
>= | Greater or equal. |
~ | Like (SQL). |
!~ | Not like (SQL). |
null | Null. |
!null | Not null. |
|
Using type ComplexQueryCondition, you can build a complex query of multiple simple queries. They can be joined together by a disjunction (or) or a conjunction (and).
Assuming you have myCondition1
and myCondition2
of type SimpleQueryCondition, you can join them to an and query with an andQuery
of type AndQueryCondition like:
create selectQuery; create myCondition1; create myCondition2; create andQuery; set selectQuery.sortByUpdate = "DESC"; set myCondition1.attribute = "openItems"; set myCondition1.operator = ">="; set myCondition1.value = openItems; set myCondition2.attribute = "customerID"; set myCondition2.operator = "="; set myCondition2.value = "4711"; append myCondition1 to andQuery.condition; append myCondition2 to andQuery.condition; set selectQuery.condition = andQuery; |
In this case, one of the to conditions could also be a complex condition instead of a simple one. Like that you can build very complex combinations of and and or queries.
deleteObject deletes the object identified by class and objectId.
Deleting objects directly via deleteObject is not best practice and can lead to odd side effects. Best practice is to model this in the state machine. |
Name | Type | Direction | Mandatory | Description | Example |
---|---|---|---|---|---|
class | String | in | Specify the name of the class to delete objects from. | PurchaseOrder | |
objectId | String | in | Specify the id of the object to delete. | 000100058a79cb967f6e00000079 |
Class | Attribute | Type | Description | Allowed Values | |
---|---|---|---|---|---|
AndQueryCondition | conditionType | String | Type of the condition. | conjunction | Marks the condition as conjunction (and) of simple queries (default and not changeable). |
condition | Array of QueryCondition | List of simple queries that are related by and. | |||
ClassAttributeMetadata | name | String | Name of the persistent state attribute. | ||
type | String | Type of the persistent state attribute, e.g.
| |||
ClassCounters | name | String | Name of the persistent state class. | ||
count | Integer | Object count. | |||
stalledCount | Integer | Count of objects that are stalled. | |||
states | Array of StateCounters | List of states including count of objects in this state. | |||
ClassInfo | name | String | Name of the persistent state class. | ||
count | Integer | Object count. | |||
ClassMetadata | name | String | Name of the persistent state class. | ||
attributes | Array of ClassAttributeMetadata | List of class attributes and their metadata. | |||
primaryKeys | Array of String | List of attributes that are marked as primary key with stereotype <<PrimaryKey>>. | |||
searchKeys | Array of String | List of attributes that are marked as search key with stereotype <<SearchKey>>. | |||
QueryCondition | Parent abstract class of SimpleQueryCondition, AndQueryCondition, or OrQueryCondition. | ||||
ObjectEntry | id | String | Unique identifier of the persistent state object. | ||
name | String | Name of the persistent state object. | |||
creation | DateTime | Creation date of the object. | |||
lastUpdate | DateTime | Date object has been last updated. | |||
states | Array of String | List of states the object is in. | |||
object | Any | Copy of the persistent state object. object contains the same content as would be returned by getObjectCopy of the Persistent State Adapter. | |||
OrQueryCondition | conditionType | String | Type of the condition. | disjunction | Marks the condition as disjunction (or) of simple queries (default and not changeable). |
condition | Array of QueryCondition | List of simple queries that are related by or. | |||
Owner | id | String | Owner id. For more information on how to manage ownership of persistent state objects, refer to Persistent State Ownership . | ||
compositeName | String | Composite name from the xUML model. | |||
host | String | Name of the host that runs the owner. | |||
lastStartup | DateTime | Last recorded service startup. | |||
lastShutdown | DateTime | Last recorded service shutdown. | |||
ownedObjects | Integer | Count of owned objects. | |||
isSelf | Boolean | True, if the current service is the owner. | true | The current service is the owner. | |
false | The current service is not the owner. | ||||
SimpleQueryCondition | conditionType | String | Type of the condition. | simple | Marks the condition as simple query condition (default and not changeable). |
attribute | String | Name of the search key attribute to use for comparison. | valid name of an existent persistent state class attribute that has stereotype <<SearchKey>> | ||
operator | String | Operator for the comparison of attribute and value. | = | Equal. | |
!= | Not equal. | ||||
< | Less than. | ||||
<= | Less or equal. | ||||
> | Greater than. | ||||
>= | Greater or equal. | ||||
~ | Like (SQL). | ||||
!~ | Not like (SQL). | ||||
null | Null. | ||||
!null | Not null. | ||||
value | Any | Value to compare the attribute against. | Only base types allowed. The value must match the type of the specified attribute. | ||
SelectObjectsQuery | classifier | String | Name of the persistent state class to query. | ||
creationFrom | DateTime | Creation date from. | |||
creationTo | DateTime | Creation date to. | |||
sortByCreation | String | Sort by creation date (ASC/DESC). Relates to sortByUpdate.
| ASC | Sort by creation date in ascending order. | |
DESC | Sort by creation date in descending order. | ||||
updateFrom | DateTime | Update date from. | |||
updateTo | DateTime | Update date to. | |||
sortByUpdate | String | Sort by update date (ASC/DESC). Relates to sortByCreation. | ASC | Sort by date of last update in ascending order. | |
DESC | Sort by date of last update in descending order. | ||||
limit | Integer | Limit the count of returned objects. Default is 1000. | Default is 1000 objects. | ||
state | Array of String | List of states. A persistent state object must be in one of the states to be part of the result set (disjunction). | |||
condition | QueryCondition | Query condition as described further above (see Querying Persistent State Objects of a Given Class). | |||
StateCounters | name | String | Name of the state. | ||
count | Integer | Count of objects in this state. | |||
stalledCount | Integer | Count of stalled objects in this state. |