@Override public List<Target> getAssignedEntity() { if (CollectionUtils.isEmpty(assignedTargets)) { return Collections.emptyList(); } return targetManagement.getByControllerID(assignedTargets); }
private Target findTargetWithExceptionIfNotFound(final String targetId) { return targetManagement.getByControllerID(targetId) .orElseThrow(() -> new EntityNotFoundException(Target.class, targetId)); }
private boolean isDuplicate() { final String newControlllerId = controllerIDTextField.getValue(); final Optional<Target> existingTarget = targetManagement.getByControllerID(newControlllerId.trim()); if (existingTarget.isPresent()) { uINotification.displayValidationError(i18n.getMessage("message.target.duplicate.check", newControlllerId)); return true; } else { return false; } }
private boolean isDuplicate() { final String newControlllerId = controllerIDTextField.getValue(); final Optional<Target> existingTarget = targetManagement.getByControllerID(newControlllerId.trim()); if (existingTarget.isPresent()) { uINotification.displayValidationError(i18n.getMessage("message.target.duplicate.check", newControlllerId)); return true; } else { return false; } }
/** * Method to send a message to a RabbitMQ Exchange after the Distribution * set has been assign to a Target. * * @param assignedEvent * the object to be send. */ @EventListener(classes = TargetAssignDistributionSetEvent.class) protected void targetAssignDistributionSet(final TargetAssignDistributionSetEvent assignedEvent) { if (isNotFromSelf(assignedEvent)) { return; } LOG.debug("targetAssignDistributionSet retrieved. I will forward it to DMF broker."); distributionSetManagement.get(assignedEvent.getDistributionSetId()).ifPresent(set -> { final Map<SoftwareModule, List<SoftwareModuleMetadata>> modules = Maps .newHashMapWithExpectedSize(set.getModules().size()); set.getModules() .forEach( module -> modules.put(module, softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible( PageRequest.of(0, RepositoryConstants.MAX_META_DATA_COUNT), module.getId()) .getContent())); targetManagement.getByControllerID(assignedEvent.getActions().keySet()) .forEach(target -> sendUpdateMessageToTarget(assignedEvent.getTenant(), target, assignedEvent.getActions().get(target.getControllerId()), modules, assignedEvent.isMaintenanceWindowAvailable())); }); }
/** * Returns Target Update window based on the selected Entity Id in the * target table. * * @param controllerId * the target controller id * @return window or {@code null} if target is not exists. */ public Window getWindow(final String controllerId) { final Optional<Target> target = targetManagement.getByControllerID(controllerId); if (!target.isPresent()) { uINotification.displayWarning(i18n.getMessage("target.not.exists", controllerId)); return null; } populateValuesOfTarget(target.get()); createNewWindow(); window.setCaption(i18n.getMessage("caption.update", i18n.getMessage("caption.target"))); window.addStyleName("target-update-window"); return window; }
/** * Returns Target Update window based on the selected Entity Id in the * target table. * * @param controllerId * the target controller id * @return window or {@code null} if target is not exists. */ public Window getWindow(final String controllerId) { final Optional<Target> target = targetManagement.getByControllerID(controllerId); if (!target.isPresent()) { uINotification.displayWarning(i18n.getMessage("target.not.exists", controllerId)); return null; } populateValuesOfTarget(target.get()); createNewWindow(); window.setCaption(i18n.getMessage("caption.update", i18n.getMessage("caption.target"))); window.addStyleName("target-update-window"); return window; }