Class FormStepsRestController
java.lang.Object
sk.iway.iwcm.system.datatable.DatatableRestControllerV2<FormStepEntity,Long>
sk.iway.iwcm.components.multistep_form.rest.FormStepsRestController
@RestController
@RequestMapping("/admin/rest/form-steps")
@PreAuthorize("@WebjetSecurityService.hasPermission(\'cmp_form\')")
public class FormStepsRestController
extends DatatableRestControllerV2<FormStepEntity,Long>
Manages form steps in the administration data table.
The controller restricts operations to the current domain and accessible form, maintains duplicated step items, and refreshes the generated form pattern and step positions after structural changes.
-
Constructor Summary
ConstructorsConstructorDescriptionFormStepsRestController(FormStepsRepository formStepsRepository, FormItemsRepository formItemsRepository, MultistepFormsService multistepFormsService, FormsServiceImpl formsService) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSpecSearch(Map<String, String> params, List<jakarta.persistence.criteria.Predicate> predicates, jakarta.persistence.criteria.Root<FormStepEntity> root, jakarta.persistence.criteria.CriteriaBuilder builder) Restricts data-table searches to the requested form.voidafterDelete(FormStepEntity entity, long id) Removes the deleted step's items and regenerates form metadata.voidafterDuplicate(FormStepEntity entity, Long originalId) Assigns staged form items to the duplicated step and regenerates form metadata.voidafterSave(FormStepEntity entity, FormStepEntity saved) Clears cached validation fields and regenerates metadata after saving a step outside duplication.voidbeforeDuplicate(FormStepEntity entity) Validates the duplicate source and stages copies of its form items.voidbeforeSave(FormStepEntity entity) Applies the current domain and temporary position values before persistence.booleancheckItemPerms(FormStepEntity entity, Long id) Checks that a step belongs to the current domain and an accessible form.protected booleancheckRowReorderScope(jakarta.servlet.http.HttpServletRequest request, List<FormStepEntity> entities) Verifies that every reordered step belongs to the requested accessible form and domain.org.springframework.data.domain.Page<FormStepEntity>getAllItems(org.springframework.data.domain.Pageable pageable) Ziska z databazy vsetky zaznamyorg.springframework.http.ResponseEntity<String>getFormStepHtml(String formName, Long stepId, String language, jakarta.servlet.http.HttpServletRequest request) Renders one form step for administration preview.getOneItem(long id) Loads a step for editing or initializes a new step for the requested form.org.springframework.http.ResponseEntity<Boolean>rowReorder(jakarta.servlet.http.HttpServletRequest request, RowReorderDto rowReorderDto) Reorders steps and recalculates their form positions after a successful update.Methods inherited from class sk.iway.iwcm.system.datatable.DatatableRestControllerV2
action, add, addNotify, addNotify, addSpecSort, afterImportChunk, allowGeneratedIdOnCreate, beforeDelete, beforeDuplicate, checkAccessAllowed, copyEntityIntoOriginal, delete, deleteItem, edit, editItem, findByColumns, findItemBy, getAll, getAllItemsIncludeSpecSearch, getCleanKey, getCleanValue, getCustomFieldsSearchDto, getDomainId, getImportedColumns, getImportMode, getInvalidImportedRows, getLastImportedRow, getOne, getOptions, getParamsMap, getProp, getRepo, getRequest, getSearchConditions, getSearchProperties, getSum, getUpdateByColumn, getUser, handleEditor, hasNotify, initBinder, insertItem, isDuplicate, isExporting, isForceReload, isImporting, isSkipWrongData, jpaToBoolean, preImportDataEdit, processAction, processFromEntity, processFromEntity, processFromEntity, processFromEntity, processToEntity, searchItem, setForceReload, setRedirect, setRequest, setValidator, sumItems, throwConstraintViolation, throwError, throwError, throwError, throwError, throwError, throwError, validateEditor, validateEditorForCustomFields
-
Constructor Details
-
FormStepsRestController
@Autowired public FormStepsRestController(FormStepsRepository formStepsRepository, FormItemsRepository formItemsRepository, MultistepFormsService multistepFormsService, FormsServiceImpl formsService)
-
-
Method Details
-
getAllItems
public org.springframework.data.domain.Page<FormStepEntity> getAllItems(org.springframework.data.domain.Pageable pageable) Description copied from class:DatatableRestControllerV2Ziska z databazy vsetky zaznamy- Overrides:
getAllItemsin classDatatableRestControllerV2<FormStepEntity,Long> - Returns:
-
addSpecSearch
public void addSpecSearch(Map<String, String> params, List<jakarta.persistence.criteria.Predicate> predicates, jakarta.persistence.criteria.Root<FormStepEntity> root, jakarta.persistence.criteria.CriteriaBuilder builder) Restricts data-table searches to the requested form.- Overrides:
addSpecSearchin classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
params- request search parameterspredicates- mutable query predicatesroot- query root for form stepsbuilder- criteria builder used to create the predicate
-
getOneItem
Loads a step for editing or initializes a new step for the requested form.The original identifier is copied so the duplicate action can locate its source.
- Overrides:
getOneItemin classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
id- step identifier, or-1for a new step- Returns:
- step prepared for the data-table editor
-
afterSave
Clears cached validation fields and regenerates metadata after saving a step outside duplication.- Overrides:
afterSavein classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
entity- submitted step valuessaved- persisted step entity
-
beforeSave
Applies the current domain and temporary position values before persistence.- Overrides:
beforeSavein classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
entity- step being saved
-
checkItemPerms
Checks that a step belongs to the current domain and an accessible form.For existing records, the stored form name is authoritative so a request cannot move a step to a form outside the user's permissions.
- Overrides:
checkItemPermsin classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
entity- submitted or stored step entityid- step identifier, ornullfor a new step- Returns:
truewhen the current user may operate on the step
-
afterDelete
Removes the deleted step's items and regenerates form metadata.- Overrides:
afterDeletein classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
entity- deleted step entityid- deleted step identifier
-
beforeDuplicate
Validates the duplicate source and stages copies of its form items.- Overrides:
beforeDuplicatein classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
entity- duplicate step submitted by the data table
-
afterDuplicate
Assigns staged form items to the duplicated step and regenerates form metadata.- Overrides:
afterDuplicatein classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
entity- persisted duplicate steporiginalId- source step identifier
-
getFormStepHtml
@GetMapping(value="/get-step", params={"form-name","step-id","language"}, produces="text/html") public org.springframework.http.ResponseEntity<String> getFormStepHtml(@RequestParam("form-name") String formName, @RequestParam("step-id") Long stepId, @RequestParam("language") String language, jakarta.servlet.http.HttpServletRequest request) Renders one form step for administration preview.- Parameters:
formName- logical form namestepId- step identifierlanguage- requested rendering languagerequest- current administration request- Returns:
- rendered HTML, or an empty bad-request response when rendering fails
-
getCssTemplates
@GetMapping(value="/css-templates", produces="application/json") public List<LabelValue> getCssTemplates() -
rowReorder
@PostMapping(value="/row-reorder", consumes="application/json") public org.springframework.http.ResponseEntity<Boolean> rowReorder(jakarta.servlet.http.HttpServletRequest request, @RequestBody RowReorderDto rowReorderDto) Reorders steps and recalculates their form positions after a successful update.- Overrides:
rowReorderin classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
request- current administration requestrowReorderDto- requested data-table row order- Returns:
- result of the data-table reorder operation
-
checkRowReorderScope
protected boolean checkRowReorderScope(jakarta.servlet.http.HttpServletRequest request, List<FormStepEntity> entities) Verifies that every reordered step belongs to the requested accessible form and domain.- Overrides:
checkRowReorderScopein classDatatableRestControllerV2<FormStepEntity,Long> - Parameters:
request- current administration requestentities- steps included in the reorder operation- Returns:
truewhen the complete reorder set is within the permitted scope
-