/** * Generates a virtual IsActiveDecoration for the presentation layer that is * calculated from {@link Action#isActive()} and * {@link Action#getActionStatus()}. * * @param action * the action combined IsActiveDecoration is calculated from * @return IsActiveDecoration combined decoration for the presentation * layer. */ private static IsActiveDecoration buildIsActiveDecoration(final Action action) { final Action.Status status = action.getStatus(); if (status == Action.Status.SCHEDULED) { return IsActiveDecoration.SCHEDULED; } else if (status == Action.Status.ERROR) { return IsActiveDecoration.IN_ACTIVE_ERROR; } return action.isActive() ? IsActiveDecoration.ACTIVE : IsActiveDecoration.IN_ACTIVE; }
/** * Generates a virtual IsActiveDecoration for the presentation layer that is * calculated from {@link Action#isActive()} and * {@link Action#getActionStatus()}. * * @param action * the action combined IsActiveDecoration is calculated from * @return IsActiveDecoration combined decoration for the presentation * layer. */ private static IsActiveDecoration buildIsActiveDecoration(final Action action) { final Action.Status status = action.getStatus(); if (status == Action.Status.SCHEDULED) { return IsActiveDecoration.SCHEDULED; } else if (status == Action.Status.ERROR) { return IsActiveDecoration.IN_ACTIVE_ERROR; } return action.isActive() ? IsActiveDecoration.ACTIVE : IsActiveDecoration.IN_ACTIVE; }
private Status handleCancelRejectedState(final Message message, final Action action) { if (action.isCancelingOrCanceled()) { return Status.CANCEL_REJECTED; } logAndThrowMessageError(message, "Cancel rejected message is not allowed, if action is on state: " + action.getStatus()); return null; }
: new DdiActionHistory(action.getStatus().name(), actionHistoryMsgs);
: new DdiActionHistory(action.getStatus().name(), actionHistoryMsgs);
/** * Creates a list of {@link ProxyAction}s for presentation layer from slice * of {@link Action}s. * * @param actionBeans * slice of {@link Action}s * @return list of {@link ProxyAction}s */ private static List<ProxyAction> createProxyActions(final Slice<Action> actionBeans) { final List<ProxyAction> proxyActions = new ArrayList<>(); for (final Action action : actionBeans) { final ProxyAction proxyAction = new ProxyAction(); final String dsNameVersion = action.getDistributionSet().getName() + ":" + action.getDistributionSet().getVersion(); proxyAction.setActive(action.isActive()); proxyAction.setIsActiveDecoration(buildIsActiveDecoration(action)); proxyAction.setDsNameVersion(dsNameVersion); proxyAction.setAction(action); proxyAction.setId(action.getId()); proxyAction.setLastModifiedAt(action.getLastModifiedAt()); proxyAction.setRolloutName(action.getRollout() != null ? action.getRollout().getName() : ""); proxyAction.setStatus(action.getStatus()); proxyAction.setMaintenanceWindow( action.hasMaintenanceSchedule() ? buildMaintenanceWindowDisplayText(action) : ""); proxyActions.add(proxyAction); } return proxyActions; }
/** * Creates a list of {@link ProxyAction}s for presentation layer from slice * of {@link Action}s. * * @param actionBeans * slice of {@link Action}s * @return list of {@link ProxyAction}s */ private static List<ProxyAction> createProxyActions(final Slice<Action> actionBeans) { final List<ProxyAction> proxyActions = new ArrayList<>(); for (final Action action : actionBeans) { final ProxyAction proxyAction = new ProxyAction(); final String dsNameVersion = action.getDistributionSet().getName() + ":" + action.getDistributionSet().getVersion(); proxyAction.setActive(action.isActive()); proxyAction.setIsActiveDecoration(buildIsActiveDecoration(action)); proxyAction.setDsNameVersion(dsNameVersion); proxyAction.setAction(action); proxyAction.setId(action.getId()); proxyAction.setLastModifiedAt(action.getLastModifiedAt()); proxyAction.setRolloutName(action.getRollout() != null ? action.getRollout().getName() : ""); proxyAction.setStatus(action.getStatus()); proxyAction.setMaintenanceWindow( action.hasMaintenanceSchedule() ? buildMaintenanceWindowDisplayText(action) : ""); proxyActions.add(proxyAction); } return proxyActions; }