List of usage examples for java.util Set equals
boolean equals(Object o);
From source file:com.centeractive.ws.server.matcher.SoapOperationMatcher.java
/** * document style service -> there is not encoded operation name - matching based on the input style * * @param rootNodes root nodes of the request * @return operation matched// ww w.java2s. c o m */ private BindingOperation getOperationByInputNames(final Set<Node> rootNodes) { AggregatingVisitor<BindingOperation> visitor = new AggregatingVisitor<BindingOperation>() { @Override public void visit(BindingOperation operation) { Set<String> expectedNames = operation.getOperation().getInput().getMessage().getParts().keySet(); Set<String> receivedNames = XmlUtils.getNodeNames(rootNodes); if (receivedNames.equals(expectedNames)) { addResult(operation); } } }; visitOperation(visitor); return visitor.getUniqueResult(); }
From source file:org.reficio.ws.server.matcher.SoapOperationMatcher.java
/** * document style service -> there is not encoded operation name - matching based on the input style * * @param rootNodes root nodes of the request * @return operation matched//from w ww.j a v a 2 s. co m */ @SuppressWarnings("unchecked") private BindingOperation getOperationByInputNames(final Set<Node> rootNodes) { AggregatingVisitor<BindingOperation> visitor = new AggregatingVisitor<BindingOperation>() { @Override public void visit(BindingOperation operation) { Set<String> expectedNames = operation.getOperation().getInput().getMessage().getParts().keySet(); Set<String> receivedNames = XmlUtils.getNodeNames(rootNodes); if (receivedNames.equals(expectedNames)) { addResult(operation); } } }; visitOperation(visitor); return visitor.getUniqueResult(); }
From source file:org.apache.syncope.common.lib.AttributableOperations.java
private static void populate(final Map<String, AttrTO> updatedAttrs, final Map<String, AttrTO> originalAttrs, final AbstractAttributableMod result, final boolean virtuals) { for (Map.Entry<String, AttrTO> entry : updatedAttrs.entrySet()) { AttrMod mod = new AttrMod(); mod.setSchema(entry.getKey());/*w ww. ja va 2 s . c o m*/ Set<String> updatedValues = new HashSet<String>(entry.getValue().getValues()); Set<String> originalValues = originalAttrs.containsKey(entry.getKey()) ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues()) : Collections.<String>emptySet(); if (!originalAttrs.containsKey(entry.getKey())) { // SYNCOPE-459: take care of user virtual attributes without any value updatedValues.remove(""); mod.getValuesToBeAdded().addAll(new ArrayList<String>(updatedValues)); if (virtuals) { result.getVirAttrsToUpdate().add(mod); } else { result.getPlainAttrsToUpdate().add(mod); } } else if (!updatedValues.equals(originalValues)) { // avoid unwanted inputs updatedValues.remove(""); if (!entry.getValue().isReadonly()) { mod.getValuesToBeAdded().addAll(updatedValues); if (!mod.isEmpty()) { if (virtuals) { result.getVirAttrsToRemove().add(mod.getSchema()); } else { result.getPlainAttrsToRemove().add(mod.getSchema()); } } } mod.getValuesToBeRemoved().addAll(originalValues); if (!mod.isEmpty()) { if (virtuals) { result.getVirAttrsToUpdate().add(mod); } else { result.getPlainAttrsToUpdate().add(mod); } } } } }
From source file:com.netflix.imfutility.audio.SoundfieldGroupHelper.java
protected List<SoundfieldGroupInfo> findInputForChannelGroup(FFmpegAudioChannels[] channelsGroup) { List<SoundfieldGroupInfo> result = new ArrayList<>(); for (SoundfieldGroupInfo soundfieldGroupInfo : inputSoundfieldGroups.values()) { Set<FFmpegAudioChannels> inputChannels = soundfieldGroupInfo.getChannelsMap().keySet(); Set<FFmpegAudioChannels> requiredChannels = new HashSet<>(Arrays.asList(channelsGroup)); if (!inputChannels.equals(requiredChannels)) { continue; }//from w w w . ja v a 2 s . com result.add(soundfieldGroupInfo); } return result; }
From source file:edu.wisc.my.redirect.TabSelectingUrlRedirectController.java
@Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { final String serverName = request.getServerName(); final PortalUrl portalUrl = this.portalUrlProvider.getPortalUrl(serverName); //If strict param matching only run if the request parameter keyset matches the mapped parameter keyset final Set<?> requestParameterKeys = request.getParameterMap().keySet(); if (this.strictParameterMatching && !requestParameterKeys.equals(this.parameterMappings.keySet())) { if (this.logger.isInfoEnabled()) { this.logger.info("Sending not found error, requested parameter key set " + requestParameterKeys + " does not match mapped parameter key set " + this.parameterMappings.keySet()); }/* www .j a v a 2 s . c o m*/ response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } //Map static parameters for (final Map.Entry<String, List<String>> parameterMappingEntry : this.staticParameters.entrySet()) { final String name = parameterMappingEntry.getKey(); final List<String> values = parameterMappingEntry.getValue(); if (this.logger.isDebugEnabled()) { this.logger.debug("Adding static parameter '" + name + "' with values: " + values); } portalUrl.setParameter(name, values.toArray(new String[values.size()])); } //Map request parameters for (final Map.Entry<String, Set<String>> parameterMappingEntry : this.parameterMappings.entrySet()) { final String name = parameterMappingEntry.getKey(); final String[] values = request.getParameterValues(name); if (values != null) { for (final String mappedName : parameterMappingEntry.getValue()) { if (this.logger.isDebugEnabled()) { this.logger.debug("Mapping parameter '" + name + "' to portal parameter '" + mappedName + "' with values: " + Arrays.asList(values)); } portalUrl.setParameter(mappedName, values); } } else if (this.logger.isDebugEnabled()) { this.logger.debug( "Skipping mapped parameter '" + name + "' since it was not specified on the original URL"); } } //Set public based on if remoteUser is set final String remoteUser = request.getRemoteUser(); final boolean isAuthenticated = StringUtils.isNotBlank(remoteUser); portalUrl.setPublic(!isAuthenticated); if (isAuthenticated) { portalUrl.setTabIndex(this.privateTabIndex); } else { portalUrl.setTabIndex(this.publicTabIndex); } portalUrl.setType(RequestType.ACTION); final String redirectUrl = portalUrl.toString(); if (this.logger.isInfoEnabled()) { this.logger.info("Redirecting to: " + redirectUrl); } return new ModelAndView(new RedirectView(redirectUrl, false)); }
From source file:test.edu.uci.ics.jung.graph.impl.KPartiteTest.java
public void testAddVertex() { g.addVertex(a1);/*from ww w. j a va 2 s .co m*/ g.addVertex(a2); g.addVertex(b1); g.addVertex(b2); try { g.addVertex(c1); fail("should not be able to add vertex which does not pass predicates"); } catch (IllegalArgumentException iae) { } Set a_set = new HashSet(); a_set.add(a1); a_set.add(a2); assertTrue(a_set.equals(PredicateUtils.getVertices(g, a_pred))); Set b_set = new HashSet(); b_set.add(b1); b_set.add(b2); assertTrue(b_set.equals(PredicateUtils.getVertices(g, b_pred))); }
From source file:org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache.java
public List<String> getUserAuths(String user) { this.lock.readLock().lock(); try {// w w w .j a va 2s .c om List<String> auths = EMPTY_LIST; Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user); if (!authOrdinals.equals(EMPTY_SET)) { auths = new ArrayList<String>(authOrdinals.size()); for (Integer authOrdinal : authOrdinals) { auths.add(ordinalVsLabels.get(authOrdinal)); } } return auths; } finally { this.lock.readLock().unlock(); } }
From source file:org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache.java
public List<String> getGroupAuths(String[] groups) { this.lock.readLock().lock(); try {// w ww . j ava2 s . c o m List<String> auths = EMPTY_LIST; Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups); if (!authOrdinals.equals(EMPTY_SET)) { auths = new ArrayList<String>(authOrdinals.size()); for (Integer authOrdinal : authOrdinals) { auths.add(ordinalVsLabels.get(authOrdinal)); } } return auths; } finally { this.lock.readLock().unlock(); } }
From source file:org.bizbundles.forward.ExcelToResourceBundle.java
private void warnMatchingNumberOfKeys() { boolean equals = true; if (listOfKeys.size() == 1) { equals = true;//from ww w . j a v a 2s .com } else { Set<String> set1 = listOfKeys.get(0); Set<String> other; for (int i = 1; i < listOfKeys.size(); i++) { other = listOfKeys.get(i); if (!set1.equals(other)) { equals = false; } } } if (!equals) { logger.warn("There are keys that do not have an equivalent in other sheets"); } }
From source file:org.apache.syncope.core.logic.AbstractAnyLogic.java
protected ProvisioningResult<TO> afterUpdate(final TO input, final List<PropagationStatus> statuses, final List<LogicActions> actions, final boolean authDynRealms, final Set<String> dynRealmsBefore) { Set<String> dynRealmsAfter = new HashSet<>(input.getDynRealms()); if (authDynRealms && !dynRealmsBefore.equals(dynRealmsAfter)) { throw new DelegatedAdministrationException( this instanceof UserLogic ? AnyTypeKind.USER : this instanceof GroupLogic ? AnyTypeKind.GROUP : AnyTypeKind.ANY_OBJECT, input.getKey());/*from w w w. ja va 2s . c o m*/ } TO any = input; for (LogicActions action : actions) { any = action.afterUpdate(any); } ProvisioningResult<TO> result = new ProvisioningResult<>(); result.setEntity(any); result.getPropagationStatuses().addAll(statuses); return result; }