private Collection<String> getUnresolvedDependencies() { Set<String> ret = new HashSet<>(); for (SourceArtifact injectedDependency : injectedDependencies) { ret.add(injectedDependency.getName()); } return disjunction(dependencies, ret); }
private void validateIfRevisionMatchesTheCurrentConfigAndUpdateTheMaterialMap(FanInGraphContext context, Pair<StageIdentifier, List<FaninScmMaterial>> stageIdentifierScmPair) { final Set<MaterialConfig> currentScmMaterials = context.pipelineScmDepMap.get(materialConfig); final Set<FaninScmMaterial> scmMaterials = new HashSet<>(stageIdentifierScmPair.last()); final Set<String> currentScmFingerprint = new HashSet<>(); for (MaterialConfig currentScmMaterial : currentScmMaterials) { currentScmFingerprint.add(currentScmMaterial.getFingerprint()); } final Set<String> scmMaterialsFingerprint = new HashSet<>(); for (FaninScmMaterial scmMaterial : scmMaterials) { scmMaterialsFingerprint.add(scmMaterial.fingerprint); } final Collection commonMaterials = CollectionUtils.intersection(currentScmFingerprint, scmMaterialsFingerprint); if (commonMaterials.size() == scmMaterials.size() && commonMaterials.size() == currentScmMaterials.size()) { stageIdentifierScmMaterial.put(stageIdentifierScmPair.first(), scmMaterials); ++currentCount; } else { Collection disjunctionWithConfig = CollectionUtils.disjunction(currentScmFingerprint, commonMaterials); Collection disjunctionWithInstance = CollectionUtils.disjunction(scmMaterialsFingerprint, commonMaterials); LOGGER.warn("[Fan-in] - Incompatible materials for {}. Config: {}. Instance: {}.", stageIdentifierScmPair.first().getStageLocator(), disjunctionWithConfig, disjunctionWithInstance); //This is it. We will not go beyond this revision in history totalInstanceCount = currentCount; } }
Collection<Integer> disjunction = CollectionUtils.disjunction( nonEmptyIndexesBeforeChanges, nonEmptyIndexesAfterChanges ); Integer disjunctionIdx = (Integer) disjunction.toArray()[0]; if ( nonEmptyIndexesAfterChanges.contains( disjunctionIdx ) ) {
/** * Returns a {@link Collection} containing the exclusive disjunction (symmetric difference) of the given * {@link Collection}s. * * @param <E> the type of the elements in the collection * @param a the first collection, must be non-null * @param b the second collection, must be non-null * @return the symmetric difference of the two collections */ public <E> Collection<E> disjunction(Collection<E> a, Collection<E> b) { if (a == null) { return b; } else if (b == null) { return a; } return CollectionUtils.disjunction(a, b); }
protected static Map<String, SInstance> collectLowerBoundInstances(FeedbackFence feedbackFence) { // coleta os componentes descendentes que possuem um handler, e as instancias correspondentes final Set<Component> mainComponents = collectLowerBoundInstances(feedbackFence.getMainContainer()); final Set<Component> externalComponents = collectLowerBoundInstances(feedbackFence.getExternalContainer()); final Map<String, SInstance> map = new LinkedHashMap<>(); CollectionUtils.disjunction(mainComponents, externalComponents).stream() .flatMap(it -> resolveRootInstances(it).stream()) .forEachOrdered(it -> map.put(it.getPathFull(), it)); return map; }
@Override public Role defineRole( Role role ) { Role existing = roleRepository.findByAuthorityIgnoringCase( role.getAuthority() ); if ( existing != null ) { if ( existing.getPermissions().size() != role.getPermissions().size() ) { Collection<Permission> difference = CollectionUtils.disjunction( existing.getPermissions(), role.getPermissions() ); Collection<String> permissionNames = difference.stream().map( Permission::getName ).collect( Collectors.toList() ); LOG.error( "Cannot redefine role '{}' because it would loose the permissions: '{}', you should .addPermission() instead", role, StringUtils.join( permissionNames, ", " ) ); } return existing; } else { return roleRepository.save( role ); } }
/** * Validate assigned groups, and return corresponding group identifiers. The groups must be visible by the * principal, and added/removed groups from the user must be writable by the principal. * * @param previousGroups * The current user's groups.used to validate the changes. * @param desiredGroups * The groups the principal user has assigned to the user. In this list, there are some read-only groups * previously assigned to this user. Only the changes are checked. * @param delegates * The delegates (read/write) of the principal user. */ private void validateAndGroupsCN(final Collection<String> previousGroups, final Collection<String> desiredGroups, final List<DelegateOrg> delegates) { // Check visibility of the desired groups desiredGroups.forEach(g -> getGroup().findByIdExpected(securityHelper.getLogin(), g)); // Check the visible updated groups can be edited by the principal CollectionUtils.disjunction(desiredGroups, previousGroups).forEach(g -> validateWriteGroup(g, delegates)); }
UpdatePermission.class, collectionName, CollectionUtils.disjunction(collection, Collections.singleton(toDelete.getObject())), original ); .disjunction(Collections.singleton(this.getObject()), originalBidirectional);
UpdatePermission.class, collectionName, CollectionUtils.disjunction(collection, Collections.singleton(toDelete.getObject())), original ); .disjunction(Collections.singleton(this.getObject()), originalBidirectional);
public void execute(DelegateExecution execution) { if (LOGGER.isTraceEnabled()) { RuntimeService runtimeService = execution.getEngineServices().getRuntimeService(); Set<String> variablesSeen = new HashSet<>(); LOGGER.trace("--------------------------------- DumpVariables: " + execution.getCurrentActivityId()); // LOGGER.trace("All variables for execution id={}, parent id={}", execution.getId(), execution.getParentId()); // execution.getVariableInstances().forEach((n, v) -> LOGGER.trace(" - {} = {} (in {})", n, v.getValue(), v.getExecutionId())); LOGGER.trace("Execution hierarchy for id={}", execution.getId()); LOGGER.trace("------------------------------------"); dumpExecutionVariables(execution.getId(), execution, null, variablesSeen, runtimeService); Collection<String> disjunction = CollectionUtils.disjunction(variablesSeen, execution.getVariableNames()); if (!disjunction.isEmpty()) { LOGGER.trace("*** Variables not found in execution tree or 'execution.getVariableNames()': {}", disjunction); } LOGGER.trace("--------------------------------- DumpVariables: " + execution.getCurrentActivityId() + " END ------------"); } }
modified = CollectionUtils.disjunction( (Collection) relation, Collections.singleton(removeResource.getObject())
modified = CollectionUtils.disjunction( (Collection) relation, Collections.singleton(removeResource.getObject())