Package sk.iway.iwcm.components.forms
Class FormsDuplicationService
java.lang.Object
sk.iway.iwcm.components.forms.FormsDuplicationService
Duplicates multistep forms together with their settings, steps, items, and item conditions.
The service preserves relationships between copied records by mapping original step and item IDs
to their newly generated IDs. Duplication is performed in a single transaction.
-
Constructor Summary
ConstructorsConstructorDescriptionFormsDuplicationService(FormsRepository formsRepository, FormSettingsRepository formSettingsRepository, FormStepsRepository formStepsRepository, FormItemsRepository formItemsRepository, FormItemsConditionsRepository formItemsConditionsRepository) -
Method Summary
Modifier and TypeMethodDescriptionduplicateMultistepForm(FormsEntity duplicate, Long originalId, int domainId) Creates a copy of a multistep form and all records that define its structure and behavior.
-
Constructor Details
-
FormsDuplicationService
@Autowired public FormsDuplicationService(FormsRepository formsRepository, FormSettingsRepository formSettingsRepository, FormStepsRepository formStepsRepository, FormItemsRepository formItemsRepository, FormItemsConditionsRepository formItemsConditionsRepository)
-
-
Method Details
-
duplicateMultistepForm
@Transactional(transactionManager="webjet2022TransactionManager") public FormsEntity duplicateMultistepForm(FormsEntity duplicate, Long originalId, int domainId) Creates a copy of a multistep form and all records that define its structure and behavior. The supplied form provides the new form name and may provide replacement settings. Serialized form data is copied from the persisted original, while counters and database identifiers are reset.- Parameters:
duplicate- form entity to populate and persist as the copyoriginalId- database identifier of the form to copydomainId- domain in which the original is resolved and the copy is created- Returns:
- persisted form entity representing the copy
- Throws:
IllegalStateException- if the input is incomplete, the original is not a multistep form, or copied relationships cannot be reconstructed
-