Page History
Div | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
Bridge 7
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
...
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Listing all Persistent State Owners
...
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. Attribute orderBy holds sorting specifications.
Anchor | ||||
---|---|---|---|---|
|
Building a Simple Query
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.
...
Multiexcerpt | |||||
---|---|---|---|---|---|
| |||||
|
Info |
---|
Querying does only work on persistent state attributes that have been marked as <<SearchKey>>. Also, if you apply this stereotype to a persistent state attribute later on, all previous persistent state objects are disregarded if searching with this key. |
Building a Complex Query
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:
Code Block |
---|
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.
Sorting the Query Results
You can sort the results that are returnedby persistent state attributes and/or by persistent state meta data (creation timestamp and update timestamp).
Sorting | Attribute(s) of SelectObjectsQuery | Description | ||
---|---|---|---|---|
Only by persistent state meta data |
| Provide a sorting direction with the sortByCreation and sortByUpdate attributes of SelectObjectsQuery (ASC, DESC). | ||
By persistent state attributes |
| Create an array of objects of typeAttributeSortCondition and provide it with the orderBy attribute of SelectObjectsQuery.
| ||
By a mixture of persistent state attributes and meta data |
| The array orderBy can hold objects of AttributeSortCondition and MetaAttributeSortCondition as they both derive from SortCondition (see class diagram above). Provide the meta attribute to sort by with an object of type MetaAttributeSortCondition.
|
Deleting Persistent State Objects
...
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 |
Parameter Types
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.
| |||||||||
AttributeSortConditon | name | String | Name of the persistent state attribute to sort by.
| a valid persistent state attribute name with stereotype <<SearchKey>> | |||||||
direction | String | Sort direction as defined on SortCondition.
| ASC | Ascending sorting (default). | |||||||
DESC | Descending sorting. | ||||||||||
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>>. |
| ||||||||||||
MetaAttributeSortCondition | name | String | Name of the persistent state meta attribute to sort by. | creation | Sort by creation date. | |||||||
update | Sort by update date. | |||||||||||
direction | String | Sort direction as defined on SortCondition.
| ASC | Ascending sorting (default). | ||||||||
DESC | Descending sorting. | |||||||||||
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. | |||||||||||
QueryCondition | Parent abstract class of SimpleQueryCondition, AndQueryCondition, or OrQueryCondition.
| |||||||||||
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). | ||||||||||
skip | Integer | Skip the number of objects provided with skip. Together with limit, this allows to implement pagination.
| ||||||||||
orderBy | Array of SortCondition | Provide sort conditions (list of persistent state attributes and direction). This array is translated into an
| ||||||||||
SortCondition | direction | String | Sort direction. | ASC | Ascending sorting (default). | |||||||
DESC | Descending sorting. | |||||||||||
StateCounters | name | String | Name of the state. | |||||||||
count | Integer | Count of objects in this state. | ||||||||||
stalledCount | Integer | Count of stalled objects in this state. |