@Override public ResponseEntity<MgmtAction> updateAction(@PathVariable("targetId") final String targetId, @PathVariable("actionId") final Long actionId, @RequestBody final MgmtActionRequestBodyPut actionUpdate) { Action action = deploymentManagement.findAction(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); if (!action.getTarget().getControllerId().equals(targetId)) { LOG.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, action.getId(), targetId); return ResponseEntity.notFound().build(); } if (!MgmtActionType.FORCED.equals(actionUpdate.getForceType())) { throw new ValidationException("Resource supports only switch to FORCED."); } action = deploymentManagement.forceTargetAction(actionId); return ResponseEntity.ok(MgmtTargetMapper.toResponseWithLinks(targetId, action)); }
/** * Show confirmation window and if ok then only, force the action. * * @param actionId * as Id if the action needs to be forced. */ private void confirmAndForceAction(final Long actionId) { /* Display the confirmation */ final ConfirmationDialog confirmDialog = new ConfirmationDialog( i18n.getMessage("caption.force.action.confirmbox"), i18n.getMessage("message.force.action.confirm"), i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), ok -> { if (!ok) { return; } deploymentManagement.forceTargetAction(actionId); populateAndUpdateTargetDetails(selectedTarget); notification.displaySuccess(i18n.getMessage("message.force.action.success")); }, UIComponentIdProvider.CONFIRMATION_POPUP_ID); UI.getCurrent().addWindow(confirmDialog.getWindow()); confirmDialog.getWindow().bringToFront(); }
/** * Show confirmation window and if ok then only, force the action. * * @param actionId * as Id if the action needs to be forced. */ private void confirmAndForceAction(final Long actionId) { /* Display the confirmation */ final ConfirmationDialog confirmDialog = new ConfirmationDialog( i18n.getMessage("caption.force.action.confirmbox"), i18n.getMessage("message.force.action.confirm"), i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), ok -> { if (!ok) { return; } deploymentManagement.forceTargetAction(actionId); populateAndUpdateTargetDetails(selectedTarget); notification.displaySuccess(i18n.getMessage("message.force.action.success")); }); UI.getCurrent().addWindow(confirmDialog.getWindow()); confirmDialog.getWindow().bringToFront(); }