private void createScheduledAction(final Collection<Target> targets, final DistributionSet distributionSet,
            final ActionType actionType, final Long forcedTime, final Rollout rollout,
            final RolloutGroup rolloutGroup) {
        // cancel all current scheduled actions for this target. E.g. an action
        // is already scheduled and a next action is created then cancel the
        // current scheduled action to cancel. E.g. a new scheduled action is
        // created.
        final List<Long> targetIds = targets.stream().map(Target::getId).collect(Collectors.toList());
        deploymentManagement.cancelInactiveScheduledActionsForTargets(targetIds);
        targets.forEach(target -> {

            assertActionsPerTargetQuota(target, 1);

            final JpaAction action = new JpaAction();
            action.setTarget(target);
            action.setActive(false);
            action.setDistributionSet(distributionSet);
            action.setActionType(actionType);
            action.setForcedTime(forcedTime);
            action.setStatus(Status.SCHEDULED);
            action.setRollout(rollout);
            action.setRolloutGroup(rolloutGroup);
            actionRepository.save(action);
        });
    }
private void createScheduledAction ( final Collection < Target > targets , final DistributionSet distributionSet , final ActionType actionType , final Long forcedTime , final Rollout rollout , final RolloutGroup rolloutGroup ) { final List < Long > targetIds = targets . stream ( ) . map ( Target :: getId ) . collect ( Collectors . toList ( ) ) ; deploymentManagement . cancelInactiveScheduledActionsForTargets ( targetIds ) ; targets . forEach ( target -> { assertActionsPerTargetQuota ( target , 1 ) ; final JpaAction action = new JpaAction ( ) ; action . setTarget ( target ) ; action . setActive ( false ) ; action . setDistributionSet ( distributionSet ) ; action . setActionType ( actionType ) ; action . setForcedTime ( forcedTime ) ; action . setStatus ( Status . SCHEDULED ) ; action . setRollout ( rollout ) ; action . setRolloutGroup ( rolloutGroup ) ; actionRepository . save ( action ) ; } ) ; }
Creates an action entry into the action repository. In case of existing
scheduled actions the scheduled actions gets canceled. A scheduled action
is created in-active.