Class BTUserTypeDuplicate
- All Implemented Interfaces:
Serializable,Tool
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:
- Creates a new user type with the provided properties (ID is cleared to create a new entity)
- Copies all permission grants from the original user type to the new one
- Copies the authentication policy from the original user type to the new one
- 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 descriptionoriginalUserTypeId- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbody(UserTypeDuplicateEvent userTypeDuplicateEvent, PoolKit pk) Executes the user type duplication process.Methods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
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:
- Extracts the new user type and original user type ID from the event input
- Validates that the user type code does not already exist in the database
- Creates the new user type (ID is cleared during creation to generate a new entity)
- Loads all permission grants from the original user type
- Applies the loaded grants to the newly created user type
- Loads the authentication policy from the original user type
- Applies the loaded authentication policy to the newly created user type
- Invalidates the user types cache to ensure consistency
- Writes the result to the event journal
- Specified by:
bodyin classBusinessTask<UserTypeDuplicateEvent>- Parameters:
userTypeDuplicateEvent- the event containing the user type duplication request with the new user type properties and the original user type IDpk- the pool kit for database operations- Throws:
DAException- if a database error occurs during the duplication processDAValidateException- if validation fails (e.g., duplicate code, invalid properties)
-