{@link Specification} for retrieving {@link Target}s by assigned
distribution set.

@param distributionSetId
the ID of the distribution set which must be assigned
@return the {@link Target} {@link Specification}
164236
public static Specification<JpaTarget> hasInstalledDistributionSet(final Long distributionSetId) {
        return (targetRoot, query, cb) -> cb.equal(
                targetRoot.get(JpaTarget_.installedDistributionSet).get(JpaDistributionSet_.id), distributionSetId);
    }
360294
public Set<Long> forWhomSiteIsDead(long hsid) {
        ImmutableSet.Builder<Long> isb = ImmutableSet.builder();
        Set<Long> deadBy = m_dead.get(hsid);
        if (   !deadBy.isEmpty()
            && m_survivors.contains(hsid)
            && m_strategy == ArbitrationStrategy.MATCHING_CARDINALITY) {
            isb.addAll(Sets.filter(deadBy, amongSurvivors));
        }
        return isb.build();
    }
645871
public Iterator targetMappings() {
        // System.out.println("TargetMappings called");
        // return vHostTable.values().iterator(); 316624
        Collection vHosts = vHostTable.values(); // 316624
        List l = new ArrayList(); // 316624
        l.addAll(vHosts); // 316624
        return l.listIterator(); // 316624
    }
369825
@VisibleForTesting
  static Distribution createDistribution(io.opencensus.metrics.export.Distribution distribution) {
    Distribution.Builder builder =
        Distribution.newBuilder()
            .setBucketOptions(createBucketOptions(distribution.getBucketOptions()))
            .setCount(distribution.getCount())
            .setMean(
                distribution.getCount() == 0 ? 0 : distribution.getSum() / distribution.getCount())
            .setSumOfSquaredDeviation(distribution.getSumOfSquaredDeviations());
    setBucketCountsAndExemplars(distribution.getBuckets(), builder);
    return builder.build();
  }
368612
@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.getActions().get(target.getControllerId()),
                            target, modules));

        });
    }
801848
public static Specification<JpaDistributionSetType> isDeleted(final Boolean isDeleted) {
        return (targetRoot, query, cb) -> cb.equal(targetRoot.<Boolean> get(JpaDistributionSetType_.deleted),
                isDeleted);
    }
63318
public java.util.List<String> getTargetIds() {
        if (targetIds == null) {
            targetIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return targetIds;
    }
309960
public static Specification<JpaDistributionSet> isCompleted(final Boolean isCompleted) {
        return (targetRoot, query, cb) -> cb.equal(targetRoot.<Boolean> get(JpaDistributionSet_.complete), isCompleted);

    }
5480
@Override
    protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
        Page<DistributionSet> distBeans;
        final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
        if (startIndex == 0 && firstPageDistributionSets != null) {
            distBeans = firstPageDistributionSets;
        } else if (pinnedTarget != null) {
            final DistributionSetFilterBuilder distributionSetFilterBuilder = new DistributionSetFilterBuilder()
                    .setIsDeleted(false).setIsComplete(true).setSearchText(searchText)
                    .setSelectDSWithNoTag(noTagClicked).setTagNames(distributionTags);

            distBeans = getDistributionSetManagement().findByFilterAndAssignedInstalledDsOrderedByLinkTarget(
                    new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilterBuilder,
                    pinnedTarget.getControllerId());
        } else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
            // if no search filters available
            distBeans = getDistributionSetManagement()
                    .findByCompleted(new OffsetBasedPageRequest(startIndex, count, sort), true);
        } else {
            final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
                    .setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
                    .setTagNames(distributionTags).build();
            distBeans = getDistributionSetManagement().findByDistributionSetFilter(
                    new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilter);
        }

        for (final DistributionSet distributionSet : distBeans) {
            final ProxyDistribution proxyDistribution = new ProxyDistribution();
            proxyDistribution.setName(distributionSet.getName());
            proxyDistribution.setDescription(distributionSet.getDescription());
            proxyDistribution.setId(distributionSet.getId());
            proxyDistribution.setDistId(distributionSet.getId());
            proxyDistribution.setVersion(distributionSet.getVersion());
            proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
            proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
            proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
            proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
            proxyDistribution.setNameVersion(
                    HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
            proxyDistributions.add(proxyDistribution);
        }
        return proxyDistributions;
    }
482947
public DistributionPoint[] getDistributionPoints()
    {
        DistributionPoint[]    dp = new DistributionPoint[seq.size()];

        for (int i = 0; i != seq.size(); i++)
        {
            dp[i] = DistributionPoint.getInstance(seq.getObjectAt(i));
        }

        return dp;
    }
875488
public static Specification<JpaTargetTag> ofTarget(final String controllerId) {
        return (targetRoot, query, criteriaBuilder) -> {
            final Join<JpaTargetTag, JpaTarget> tagJoin = targetRoot.join(JpaTargetTag_.assignedToTargets);

            query.distinct(true);

            return criteriaBuilder.equal(tagJoin.get(JpaTarget_.controllerId), controllerId);
        };

    }
659348
public void setTargets(Collection<IPermissionTarget> targets) {

        // clear out any existing targets
        targetMap.clear();

        // add each target to the internal map and index it by the target key
        for (IPermissionTarget target : targets) {
            targetMap.put(target.getKey(), target);
        }
    }
40760
public ListDeploymentTargetsRequest withTargetFilters(java.util.Map<String, java.util.List<String>> targetFilters) {
        setTargetFilters(targetFilters);
        return this;
    }
454863
public static Specification<JpaDistributionSetType> byId(final Long distid) {
        return (targetRoot, query, cb) -> cb.equal(targetRoot.<Long> get(JpaDistributionSetType_.id), distid);
    }
1150431
@Override
    public Collection<IPermissionTarget> searchTargets(String term) {

        // Initialize a new collection of matching targets.  We use a HashSet
        // implementation here to prevent duplicate target entries.
        Collection<IPermissionTarget> matching = new HashSet<IPermissionTarget>();

        /*
         * Attempt to find matching entities for each allowed entity type.
         * Any matching entities will be added to our collection.
         */
        for (TargetType targetType : allowedTargetTypes) {
            Set<JsonEntityBean> entities = groupListHelper.search(targetType.toString(), term);
            for (JsonEntityBean entity : entities) {
                IPermissionTarget target =
                        new PermissionTargetImpl(entity.getId(), entity.getName(), targetType);
                matching.add(target);
            }
        }

        if (IPermission.ALL_CATEGORIES_TARGET.contains(term)) {
            matching.add(ALL_CATEGORIES_TARGET);
        } else if (IPermission.ALL_PORTLETS_TARGET.contains(term)) {
            matching.add(ALL_PORTLETS_TARGET);
        } else if (IPermission.ALL_GROUPS_TARGET.contains(term)) {
            matching.add(ALL_GROUPS_TARGET);
        }

        // return the list of matching targets
        return matching;
    }
211232
public java.util.List<java.util.Map<String, java.util.List<String>>> getTargetMaps() {
        if (targetMaps == null) {
            targetMaps = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, java.util.List<String>>>();
        }
        return targetMaps;
    }
1360142
public void populateTableByDistributionSet(final DistributionSet distributionSet) {
        removeAllItems();
        if (distributionSet == null) {
            return;
        }

        final Container dataSource = getContainerDataSource();
        final List<TargetFilterQuery> filters = distributionSet.getAutoAssignFilters();
        filters.forEach(query -> {
            final Object itemId = dataSource.addItem();
            final Item item = dataSource.getItem(itemId);
            item.getItemProperty(TFQ_NAME).setValue(query.getName());
            item.getItemProperty(TFQ_QUERY).setValue(query.getQuery());
        });

    }