Get collection of resources Version 8 (Java)

Action group: Orchestrator  Subgroup: Resource queues


Description

The action searches for resources according to the specified conditions and returns all matching resources. If no matching resources are found, the action waits for them to appear for a specified timeout.

  1. The action sends a request to find resources that have parameters that match those specified in the action.
  2. The resource will be searched according to the following rules:

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Resource queueThe name of the resource queue in which to look for resources.Robin.String
Yes
TagsA collection of strings where each element is a separate resource tag. The search will be among those resources that have at least one of the listed tags.Robin.Collection
No
StatusThe status the resources must have.Robin.String
Yes
Min. priorityThe lowest priority value that the resource can have. Together with the value from the «Max. priority» is the search range by priority.Robin.Numeric
No
Max. priorityThe highest priority value that the resource can have. Together with the value from the «Min. priority» is the search range by priority.Robin.Numeric
No
Min. date of creationThe smallest value of the creation date of the resource. Together with the value from the «Max. creation date» is the search range for creation date.Robin.DateTime
No
Max. date of creationThe largest value of the creation date of the resource. Together with the value from the «Min. creation date» is the search range for creation date.Robin.DateTime
No
Min. date of updateThe smallest value of the last update date of the resource. Together with the value from the «Max. date of creation» is the range of the search by the date of the update.Robin.DateTime
No
Max. date of updateThe largest value of the last update date of the resource. Together with the value from the «Min. date of creation» is the range of the search by the date of the update.Robin.DateTime
No
Sorting typeThe sort type of the found resources. The action sorts the found resources before writing them to the resulting collection.Robin.String
No
Deny readingIf the value is «true», the action will lock the found resources for reading and hide them in the queue. Other robots will not be able to find hidden resources when searching by condition.Robin.BooleantrueNo
Deny writingIf the value is «true», the action will lock the found resources for writing to other robots.Robin.BooleantrueNo
Finish processingIf the value is «true», the action will get the value and parameters of the resources and then change their status to «Processed». With this status, resources will be hidden for robots, even when searching by their ID.Robin.BooleantrueNo
Number of resourcesThe amount of resources the action should return. Taken into account together with the parameter «Quantity rule».Robin.Numeric
Yes
Quantity ruleA rule that specifies how to interpret the value from the field «Number of resources» . If «All» is selected, the action ignores the specified number of resources and returns all matching resources.Robin.String
Yes
Timeout, msWaiting time for the required number of resources to appear in the queue, matching the search conditions. If «-1» is specified, the action will wait indefinitely. Specified in milliseconds.Robin.Numeric
No
Results
ResultA collection in which each element is a dictionary containing the data of one of the found resources: value («Value» key), identifier («Id» key), tags («Tags» key), status («Status» key), priority («Priority» key), creation date ( «CreationDate» key) and update date («UpdateDate» key).Robin.Collection

Special conditions of use

  1. The action can block a resource for reading or writing if the corresponding input parameters are activated. When a resource is locked, this robot instance becomes the owner of the set lock type. Being the owner of a lock means that only the same robot instance can release such a lock. And 2 different launches of the same robot (2 different instances) are considered as different owners.
  2. The user has more authority than robots, so they can remove/set the lock regardless of who owns it.

Example of use

Task

There is a process where there is a queue with resources, it is necessary to get no more than 5 resources with the status "New", and also to get the date of creation of the 2nd count resource from the collection. 

Solution

Use the "Get collection of resources", "Get value by index", "Get value", "Message in log" actions.

Implementation

  1. Move the "Get collection of resources" action to the workspace and set its parameters:
    1. Specify the resource queue name where to look for the resources in the "Resource queue" field.
    2. Specify the status that all resources should have in the "Status" field. In this case, it is "New".
    3. Specify the number of resources the action is to return in the "Number of resources" field. In this case, it is 5.
    4. Specify the desired rule indicating how to correctly interpret the value from the "Number of Resources" field in the "Quantity rule" field. In this case, select "Less or equal".

  2. Move the "Get value by index" action to the workspace and set its parameters.
    1. Specify the result of the action "Get collection of resources" in the "Collection" field.
    2. Specify the order number of the position from which you want to extract values in the "Index" field. In this case, it is 1. (According to the task we need to pull out the 2nd resource, but since the count in the collection starts from 0, we specify the value 1 accordingly)

  3. Move the "Get value" action to the workspace and set its parameters.
    1. Specify the "Get value by index" action result in the "Dictionary" field. The result of this action in this case will be a dictionary with the data of the found resource.
    2. Specify the key that is used to search the dictionary in the "Key" field. In this case, the key will be the value "CreationDate" because the task requires that the creation date of the resource be taken away.
  4. Move the "Message in log" action to the workspace and set its parameters.
    1. Specify the text to be displayed in the message log file in the "Message" field. In this case, specify the "Get value" action result. This is the creation date of the resource.
  5. Click "Start" in the top panel to start the robot.

Result

The program robot completed successfully.

A collection was retrieved, from which the 2nd resource with the status "New" was selected, and the creation date of this resource was logged.