Class BTUserTypeDuplicate

java.lang.Object
overit.geocall.bl.BusinessTask<UserTypeDuplicateEvent>
overit.geocall.basic.bl.usertype.task.BTUserTypeDuplicate
All Implemented Interfaces:
Serializable, Tool

@Event(UserTypeDuplicateEvent.class) @Permission("foundation.base.usertype.edit") public class BTUserTypeDuplicate extends BusinessTask<UserTypeDuplicateEvent>
Business task that handles the duplication of user types.

This task creates a new user type based on an existing one, copying all associated configurations including permission grants and authentication policies. The new user type will have the same properties as the original (except for the ID), along with all permissions and authentication settings.

Duplication Process:

  1. Creates a new user type with the provided properties (ID is cleared to create a new entity)
  2. Copies all permission grants from the original user type to the new one
  3. Copies the authentication policy from the original user type to the new one
  4. Invalidates the user types cache to ensure the new type is immediately available

Input: BOUserTypeDuplicate containing:

  • boUserType - The new user type with desired code and description
  • originalUserTypeId - The ID of the user type to copy permissions and policies from

Output: BOUserTypeDuplicate containing the newly created user type and the original user type ID.

Required Permission: foundation.base.usertype.edit

Use Case: Administrators frequently need to create new user types with similar permission sets and authentication policies. This task streamlines the process by allowing administrators to duplicate an existing user type and only modify the code and description, while all permissions and policies are automatically copied.

Since:
12.0
See Also:
  • Constructor Details

    • BTUserTypeDuplicate

      public BTUserTypeDuplicate()
  • Method Details

    • body

      protected void body(UserTypeDuplicateEvent userTypeDuplicateEvent, PoolKit pk) throws DAException, DAValidateException
      Executes the user type duplication process.

      This method performs the following steps:

      1. Extracts the new user type and original user type ID from the event input
      2. Validates that the user type code does not already exist in the database
      3. Creates the new user type (ID is cleared during creation to generate a new entity)
      4. Loads all permission grants from the original user type
      5. Applies the loaded grants to the newly created user type
      6. Loads the authentication policy from the original user type
      7. Applies the loaded authentication policy to the newly created user type
      8. Invalidates the user types cache to ensure consistency
      9. Writes the result to the event journal
      Specified by:
      body in class BusinessTask<UserTypeDuplicateEvent>
      Parameters:
      userTypeDuplicateEvent - the event containing the user type duplication request with the new user type properties and the original user type ID
      pk - the pool kit for database operations
      Throws:
      DAException - if a database error occurs during the duplication process
      DAValidateException - if validation fails (e.g., duplicate code, invalid properties)