@Override default Long getEntityId() { return getTarget().getId(); } }
/** * Constructor. * * @param rolloutGroup * the rollout group for this key * @param target * the target for this key */ public RolloutTargetGroupId(final RolloutGroup rolloutGroup, final Target target) { this.rolloutGroup = rolloutGroup.getId(); this.target = target.getId(); }
/** * Constructor. * * @param rolloutGroup * the rollout group for this key * @param target * the target for this key */ public RolloutTargetGroupId(final RolloutGroup rolloutGroup, final Target target) { this.rolloutGroup = rolloutGroup.getId(); this.target = target.getId(); }
/** * Set target as member of this grid (as all presented grid-data is related * to this target) and recalculate grid-data for this target. * * @param selectedTarget * reference of target */ public void populateSelectedTarget(final Target selectedTarget) { this.selectedTarget = selectedTarget; getDetailsSupport() .populateMasterDataAndRecalculateContainer(selectedTarget != null ? selectedTarget.getId() : null); }
/** * Set target as member of this grid (as all presented grid-data is related * to this target) and recalculate grid-data for this target. * * @param selectedTarget * reference of target */ public void populateSelectedTarget(final Target selectedTarget) { this.selectedTarget = selectedTarget; getDetailsSupport() .populateMasterDataAndRecalculateContainer(selectedTarget != null ? selectedTarget.getId() : null); }
private void assertActionsPerTargetQuota(final Target target, final int requested) { final int quota = quotaManagement.getMaxActionsPerTarget(); QuotaHelper.assertAssignmentQuota(target.getId(), requested, quota, Action.class, Target.class, actionRepository::countByTargetId); }
/** * Constructor. * * @param target * the target */ public TargetIdName(final Target target) { this(target.getId(), target.getControllerId(), target.getName()); }
private void assertActionsPerTargetQuota(final Target target, final int requested) { final int quota = quotaManagement.getMaxActionsPerTarget(); QuotaHelper.assertAssignmentQuota(target.getId(), requested, quota, Action.class, Target.class, actionRepository::countByTargetId); }
/** * Constructor. * * @param target * the target */ public TargetIdName(final Target target) { this(target.getId(), target.getControllerId(), target.getName()); }
/** * Enforces the quota defining the maximum number of {@link Action}s per * {@link Target}. * * @param target * The target * @param requested * number of actions to check */ private void assertActionsPerTargetQuota(final Target target, final int requested) { final int quota = quotaManagement.getMaxActionsPerTarget(); QuotaHelper.assertAssignmentQuota(target.getId(), requested, quota, Action.class, Target.class, actionRepository::countByTargetId); }
/** * Enforces the quota defining the maximum number of {@link Action}s per * {@link Target}. * * @param target * The target * @param requested * number of actions to check */ private void assertActionsPerTargetQuota(final Target target, final int requested) { final int quota = quotaManagement.getMaxActionsPerTarget(); QuotaHelper.assertAssignmentQuota(target.getId(), requested, quota, Action.class, Target.class, actionRepository::countByTargetId); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void deleteByControllerID(final String controllerID) { final Target target = getByControllerIdAndThrowIfNotFound(controllerID); targetRepository.deleteById(target.getId()); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void deleteByControllerID(final String controllerID) { final Target target = getByControllerIdAndThrowIfNotFound(controllerID); targetRepository.delete(target.getId()); }
/** * Update the colors of Assigned and installed distribution set in Target * Pinning. */ private void updateDistributionTableStyle() { managementUIState.getDistributionTableFilters().getPinnedTarget().ifPresent(pinnedTarget -> { if (pinnedTarget.getTargetId().equals(selectedTarget.getId())) { eventBus.publish(this, PinUnpinEvent.PIN_TARGET); } }); if (!managementUIState.getDistributionTableFilters().getPinnedTarget().isPresent()) { return; } }
private void addNewTarget() { final String newControllerId = controllerIDTextField.getValue(); final String newName = nameTextField.getValue(); final String newDesc = descTextArea.getValue(); final Target newTarget = targetManagement.create( entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc)); eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget)); uINotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newTarget.getName() })); targetTable.setValue(Sets.newHashSet(newTarget.getId())); }
private void addNewTarget() { final String newControllerId = controllerIDTextField.getValue(); final String newName = nameTextField.getValue(); final String newDesc = descTextArea.getValue(); final Target newTarget = targetManagement.create( entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc)); eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget)); uINotification.displaySuccess(i18n.getMessage("message.save.success", newTarget.getName())); targetTable.setValue(Sets.newHashSet(newTarget.getId())); }
private DmfArtifact convertArtifact(final Target target, final Artifact localArtifact) { final DmfArtifact artifact = new DmfArtifact(); artifact.setUrls(artifactUrlHandler .getUrls(new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(), systemManagement.getTenantMetadata().getId(), target.getControllerId(), target.getId(), new SoftwareData(localArtifact.getSoftwareModule().getId(), localArtifact.getFilename(), localArtifact.getId(), localArtifact.getSha1Hash())), ApiType.DMF) .stream().collect(Collectors.toMap(ArtifactUrl::getProtocol, ArtifactUrl::getRef))); artifact.setFilename(localArtifact.getFilename()); artifact.setHashes(new DmfArtifactHash(localArtifact.getSha1Hash(), localArtifact.getMd5Hash())); artifact.setSize(localArtifact.getSize()); return artifact; }
@SuppressWarnings("unchecked") private void updateVisibleItemOnEvent(final Target target) { final Long targetId = target.getId(); final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource(); final Item item = targetContainer.getItem(targetId); item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(target.getUpdateStatus()); item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(target.getName()); item.getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP) .setValue(HawkbitCommonUtil.getPollStatusToolTip(target.getPollStatus(), getI18n())); }
@SuppressWarnings("unchecked") private void updateVisibleItemOnEvent(final Target target) { final Long targetId = target.getId(); final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource(); final Item item = targetContainer.getItem(targetId); item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(target.getUpdateStatus()); item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(target.getName()); item.getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP) .setValue(HawkbitCommonUtil.getPollStatusToolTip(target.getPollStatus(), getI18n())); }
private static DdiArtifact createArtifact(final Target target, final ArtifactUrlHandler artifactUrlHandler, final Artifact artifact, final SystemManagement systemManagement, final HttpRequest request) { final DdiArtifact file = new DdiArtifact(); file.setHashes(new DdiArtifactHash(artifact.getSha1Hash(), artifact.getMd5Hash())); file.setFilename(artifact.getFilename()); file.setSize(artifact.getSize()); artifactUrlHandler .getUrls(new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(), systemManagement.getTenantMetadata().getId(), target.getControllerId(), target.getId(), new SoftwareData(artifact.getSoftwareModule().getId(), artifact.getFilename(), artifact.getId(), artifact.getSha1Hash())), ApiType.DDI, request.getURI()) .forEach(entry -> file.add(new Link(entry.getRef()).withRel(entry.getRel()))); return file; }