Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devel:documentation:bulk_actions:dev:bulk_actions [2020/02/11 13:22]
svandav [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 16: Line 16:
 Every agenda is allowed to have more implemented bulk actions for different purposes. It is possible to combine all selection strategies. First two selection strategies are controlled by another method ''showWithSelection'' with default returning value set to ''true''. Every agenda is allowed to have more implemented bulk actions for different purposes. It is possible to combine all selection strategies. First two selection strategies are controlled by another method ''showWithSelection'' with default returning value set to ''true''.
  
 +Available bulk actions are shown with respect currently logged user authorities - required authority can be specified in bulk action ''getAuthoritiesForEntity'' method.
  
 After that controller receives a new bulk action request (rest post method), it transforms given map<String, Object> to filter and executes new bulk action as new long running task. Abstract parent of all bulk action classes ''AbstractBulkAction'' provides basic validation method for form attributes and functionality of sending notification message. It also ensures processing of the set filter or received set of IDs. In case of using filter, IDs to process are obtained by findIds method invocation with given filter. From this moment the set of IDs cannot be changed. All bulk actions has implementation of ''processEntities'' method. This method processes supplied entities and returns operation result. If this method throws an exception it is caught by parent method and a new failure log record is created. After that controller receives a new bulk action request (rest post method), it transforms given map<String, Object> to filter and executes new bulk action as new long running task. Abstract parent of all bulk action classes ''AbstractBulkAction'' provides basic validation method for form attributes and functionality of sending notification message. It also ensures processing of the set filter or received set of IDs. In case of using filter, IDs to process are obtained by findIds method invocation with given filter. From this moment the set of IDs cannot be changed. All bulk actions has implementation of ''processEntities'' method. This method processes supplied entities and returns operation result. If this method throws an exception it is caught by parent method and a new failure log record is created.
Line 82: Line 83:
  
 </code> </code>
 +
 +===== Configuration =====
 +{{tag> configuration }}
 +
 +@since 10.6.0
 +
 +Bulk action order, icon, level and other properties can be configured by [[..:..:application_configuration:dev:backend#bulk_actions|application setting]].
 +
 +Available bulk action can be shown in bulk action agenda available from menu - Settings - Modules - Bulk actions
 +
 +{{ :devel:documentation:bulk_actions:dev:bulk-action-agenda.png?600 |}}
 +
 +<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).</note>
  
  
Line 96: Line 110:
   * **processDto** - is called by processEntities method and implements processing of every single item   * **processDto** - is called by processEntities method and implements processing of every single item
   * **getLevel** - level for bulk action button (success ​by default)   * **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, is action is included in menu.
 +  * **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).
  
  
Line 102: Line 118:
 <note tip>Bulk actions don't use persistent form definition kept in **IdmFormAttributeDto**. This definition is created ad hoc by calling **getFormAttributes** method.</note> <note tip>Bulk actions don't use persistent form definition kept in **IdmFormAttributeDto**. This definition is created ad hoc by calling **getFormAttributes** method.</note>
  
-After implementation of all BE parts enabling support of the required bulk action, it is also necessary to add its localization. It needs to be put into section following this path **eav.bulk-action.<my-new-bulk-action>** in both localization files.+After implementation of all BE parts enabling support of the required bulk action, it is also necessary to add its localization. It needs to be put into section following this path **eav.bulk-action.<my-new-bulk-action>** in all localization files.
 Form attribute localization parts are placed into **eav.bulk-action.<my-new-bulk-action>.attributes** section. Form attribute localization parts are placed into **eav.bulk-action.<my-new-bulk-action>.attributes** section.
  
Line 129: Line 145:
   - in FE service class (for inspiration see IdentityService)   - in FE service class (for inspiration see IdentityService)
     * **supportsBulkAction** - has to return true     * **supportsBulkAction** - has to return true
 +    * **showRowSelection** - this ''Advanced.Table'' property needs to be set true without any permission conditions (permissions are resolved on BE)
  
  
 Now you can start using bulk actions. Now you can start using bulk actions.
  
  • by svandav