private Action getUpdateActionStatus(final Status status, final ActionStatusCreate actionStatus) { if (Status.CANCELED.equals(status)) { return controllerManagement.addCancelActionStatus(actionStatus); } return controllerManagement.addUpdateActionStatus(actionStatus); }
private Action sendUpdateActionStatusToTarget(final Status status, final Action updActA, final Collection<String> msgs) { return controllerManagament.addUpdateActionStatus( entityFactory.actionStatus().create(updActA.getId()).status(status).messages(msgs)); }
private Action sendUpdateActionStatusToTarget(final Status status, final Action updActA, final Collection<String> msgs) { return controllerManagament.addUpdateActionStatus( entityFactory.actionStatus().create(updActA.getId()).status(status).messages(msgs)); }
@Override public ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId, @PathVariable("actionId") @NotEmpty final Long actionId) { LOG.debug("provideBasedeploymentActionFeedback for target [{},{}]: {}", controllerId, actionId, feedback); final Target target = controllerManagement.getByControllerId(controllerId) .orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId)); if (!actionId.equals(feedback.getId())) { LOG.warn( "provideBasedeploymentActionFeedback: action in payload ({}) was not identical to action in path ({}).", feedback.getId(), actionId); return ResponseEntity.notFound().build(); } final Action action = findActionWithExceptionIfNotFound(actionId); if (!action.getTarget().getId().equals(target.getId())) { LOG.warn(GIVEN_ACTION_IS_NOT_ASSIGNED_TO_GIVEN_TARGET, action.getId(), target.getId()); return ResponseEntity.notFound().build(); } if (!action.isActive()) { LOG.warn("Updating action {} with feedback {} not possible since action not active anymore.", action.getId(), feedback.getId()); return new ResponseEntity<>(HttpStatus.GONE); } controllerManagement.addUpdateActionStatus(generateUpdateStatus(feedback, controllerId, feedback.getId())); return ResponseEntity.ok().build(); }
@Override public ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback, @PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId, @PathVariable("actionId") @NotEmpty final Long actionId) { LOG.debug("provideBasedeploymentActionFeedback for target [{},{}]: {}", controllerId, actionId, feedback); final Target target = controllerManagement.getByControllerId(controllerId) .orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId)); if (!actionId.equals(feedback.getId())) { LOG.warn( "provideBasedeploymentActionFeedback: action in payload ({}) was not identical to action in path ({}).", feedback.getId(), actionId); return ResponseEntity.notFound().build(); } final Action action = findActionWithExceptionIfNotFound(actionId); if (!action.getTarget().getId().equals(target.getId())) { LOG.warn(GIVEN_ACTION_IS_NOT_ASSIGNED_TO_GIVEN_TARGET, action.getId(), target.getId()); return ResponseEntity.notFound().build(); } if (!action.isActive()) { LOG.warn("Updating action {} with feedback {} not possible since action not active anymore.", action.getId(), feedback.getId()); return new ResponseEntity<>(HttpStatus.GONE); } controllerManagement.addUpdateActionStatus(generateUpdateStatus(feedback, controllerId, feedback.getId())); return ResponseEntity.ok().build(); }
protected Action prepareFinishedUpdate(final String controllerId, final String distributionSet, final boolean isRequiredMigrationStep) { final DistributionSet ds = testdataFactory.createDistributionSet(distributionSet, isRequiredMigrationStep); Target savedTarget = testdataFactory.createTarget(controllerId); savedTarget = assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getAssignedEntity().iterator() .next(); Action savedAction = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId()) .getContent().get(0); savedAction = controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.RUNNING)); return controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.FINISHED)); }
protected Action prepareFinishedUpdate(final String controllerId, final String distributionSet, final boolean isRequiredMigrationStep) { final DistributionSet ds = testdataFactory.createDistributionSet(distributionSet, isRequiredMigrationStep); Target savedTarget = testdataFactory.createTarget(controllerId); savedTarget = assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getAssignedEntity().iterator() .next(); Action savedAction = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId()) .getContent().get(0); savedAction = controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.RUNNING)); return controllerManagement.addUpdateActionStatus( entityFactory.actionStatus().create(savedAction.getId()).status(Action.Status.FINISHED)); }
private void feedbackToByInSync(final DistributionSet savedSet) { final Action action = deploymentManagement.findActionsByDistributionSet(PAGE, savedSet.getId()).getContent() .get(0); controllerManagement .addUpdateActionStatus(entityFactory.actionStatus().create(action.getId()).status(Status.FINISHED)); }