Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:documentation:bulk_actions:dev:bulk_actions [2020/01/23 13:17] tomiskar [How can I add new bulk action?] |
devel:documentation:bulk_actions:dev:bulk_actions [2020/10/15 05:38] (current) husniko [How can I add support for bulk action?] |
||
---|---|---|---|
Line 3: | Line 3: | ||
{{tag> bulk action operation}} | {{tag> bulk action operation}} | ||
+ | Bulk actions were introduced to IdM in order to make actions, applied to items in a table, more efficient and safe. Higher efficiency means that there is sent to BE only a list of IDs of affected items or items can also be selected by filter. Filter is accompanied with the list of IDs of items excluded from that action. Safety is reached by adding a validation feature which is, if implemented for particular action, evaluated before bulk action itself and is intended for notification of users that there may occur some conflicts which may prevent from successful action completion. | ||
===== How it works? ===== | ===== How it works? ===== | ||
- | Action types: | + | Ways of item selection: |
- | * **With items are selected** - To backend is from frontend send whole filter definition or set of ids. When user check checkbox for select all entities is setup constat. The constant define that is selected all entities (constant can be found in basic table - Basic.Table.SELECT_ALL). When is this constant active user also can remove some entities from this select. The removed entities is saved to new set - removed entities and to backend is send in another property (removeIdentifiers). | + | |
- | * **Without items are selected** - action can be executed without items are selected on frontend - can be used on the whole agenda for import / export feature or simply for all data in agenda. | + | |
- | Action type is defined | + | * **Individual item selection** - When user checks individual items in a table such items are chosen to be processed |
- | After specified controller receive new bulk action (rest post method). Controller transform given map< | + | * **All items selection** - In case of using the checkbox which marks all items as selected, selection is controlled by filter. |
- | Abstract parent for identity | + | * **Applying action without item specification** - The last supported option is to apply bulk action to the whole agenda without any item specification. All items are included. This option |
- | After every success or failed process for identity will be created log item with result model. This log items are saved into processed items. This is same table as for schedulable task, but without removing or check existing items. It is used only for log results from process items. There isn't any another | + | Every agenda |
- | It is necessary | + | Available bulk actions are shown with respect currently logged user authorities - required authority can be specified in bulk action '' |
+ | |||
+ | After that controller receives a new bulk action request (rest post method), it transforms given map< | ||
+ | |||
+ | After processing entity (regardless whether successful or not) a new log with result is created. These log items are saved into processed items in the same table as schedulable tasks are but without removing or checking that item exists. | ||
+ | It is necessary | ||
===== Prevalidate ===== | ===== Prevalidate ===== | ||
{{tag> bulk operation action prevalidation validation validate }} | {{tag> bulk operation action prevalidation validation validate }} | ||
- | In some cases, we need obtain additional | + | In some cases, we need to obtain additional |
- | Prevalidate feature was developed exactly for this case. Every bulk operations has method `prevalidate`, returns | + | Prevalidate feature was developed exactly for this purpose. Every bulk operation implements |
- | < | + | < |
<note tip> | <note tip> | ||
Line 79: | Line 83: | ||
</ | </ | ||
+ | |||
+ | ===== Configuration ===== | ||
+ | {{tag> configuration }} | ||
+ | |||
+ | @since 10.6.0 | ||
+ | |||
+ | Bulk action order, icon, level and other properties can be configured by [[..: | ||
+ | |||
+ | Available bulk action can be shown in bulk action agenda available from menu - Settings - Modules - Bulk actions | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <note tip>All configurable properties (e.g. order) are shown in frontend agenda. Bulk Action can be disabled (or enabled) directly from this agenda (other configurable properties will be added in future).</ | ||
===== How can I add new bulk action? ===== | ===== How can I add new bulk action? ===== | ||
- | <note tip>Now is possible add new bulk action | + | === New bulk action |
+ | For easy start of creating a new bulk action you need just extend the abstract class '' | ||
- | For easy start with creating new bulk action | + | * **getName** - name of bulk action, it will be used as key in localization |
+ | * **getAuthoritiesForEntity** - required permissions for processing of entities | ||
+ | * **getOrder** - order in selectbox in agenda | ||
+ | * **getService** - the service, items of which are processed by bulk action | ||
+ | * **processEntities** - iterates over all selected items and is supposed to provide check of permissions and processing invocation | ||
+ | * **processDto** - is called by processEntities method and implements processing of every single item | ||
+ | * **getLevel** - level for bulk action button (success by default) | ||
+ | * **isDeleteAction** - false by default. Action deletes records (for FE only). Action will be in bottom menu section, | ||
+ | * **isQuickButton** - false by default. Render action as quick button (for FE only). The first available actions are rendered as buttons, if icon is defined. This configuration enforces rendering action as quick button (order is ignored). | ||
- | * **processIdentity** - process one identity, | ||
- | * **getName** - name of bulk action, this will be used for key in localization, | ||
- | * **getPermissionForIdentity** - required permission for process one identity, | ||
- | * **getOrder** - order in selecbox in identity agenda. | ||
- | * **getLevel** - level for bulk action button (success by default). | ||
- | If you want use some settings | + | If one wants to use some settings |
- | <note tip>For all bulk actions | + | <note tip>Bulk actions |
- | After you implement | + | After implementation of all BE parts enabling support of the required bulk action, it is also necessary |
+ | Form attribute localization parts are placed | ||
+ | |||
+ | < | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
===== How can I add support for bulk action? ===== | ===== How can I add support for bulk action? ===== | ||
- | When we need add new agenda that will be support bulk actions | + | In order to add support |
- | - implements two method' | + | - in BE controller |
- | * **getAvailableBulkActions** - return | + | * **getAvailableBulkActions** - returns |
- | * **bulkAction** - process | + | * **bulkAction** - processes |
- | * **prevalidateBulkAction** - prevalidate | + | * **prevalidateBulkAction** - invokes |
- | - into frontend | + | - in FE service |
- | * **supportsBulkAction**=true | + | * **supportsBulkAction** - has to return |
+ | * **showRowSelection** - this '' | ||
- | Now you can start use bulk actions. | + | Now you can start using bulk actions. |