List of usage examples for org.apache.commons.collections CollectionUtils containsAny
public static boolean containsAny(final Collection coll1, final Collection coll2)
true
iff at least one element is in both collections. From source file:org.metaabm.function.impl.FArgumentArrayPrototypeImpl.java
public boolean accepts(IValue value) { return (value instanceof ITypedArray) && ((getSize() == -1) || (((ITypedArray) value).getSize() == getSize())) && CollectionUtils .containsAny(SAttributeType.getAvailableTypes(getSType()), value.getAvailableTypes()); }
From source file:org.metaabm.function.impl.FArgumentPrototypeImpl.java
public boolean accepts(IValue value) { return !(value instanceof ITypedArray) && CollectionUtils .containsAny(SAttributeType.getAvailableTypes(getSType()), value.getAvailableTypes()); }
From source file:org.opencb.cellbase.lib.impl.GeneMongoDBAdaptor.java
private QueryResult<Document> postDBFiltering(Query query, QueryResult<Document> documentQueryResult) { if (StringUtils.isNotEmpty(query.getString("transcripts.annotationFlags"))) { Set<String> flags = new HashSet<>( Arrays.asList(query.getString("transcripts.annotationFlags").split(","))); List<Document> documents = documentQueryResult.getResult(); for (Document document : documents) { ArrayList<Document> transcripts = document.get("transcripts", ArrayList.class); ArrayList<Document> matchedTranscripts = new ArrayList<>(); for (Document transcript : transcripts) { ArrayList annotationFlags = transcript.get("annotationFlags", ArrayList.class); if (annotationFlags != null && annotationFlags.size() > 0) { if (CollectionUtils.containsAny(annotationFlags, flags)) { matchedTranscripts.add(transcript); }// ww w. j a v a 2 s . co m } } document.put("transcripts", matchedTranscripts); } documentQueryResult.setResult(documents); } return documentQueryResult; }
From source file:org.openconcerto.sql.view.list.UpdateQueue.java
void rowModified(final SQLTableEvent evt) { final int id = evt.getId(); if (id < SQLRow.MIN_VALID_ID) { this.putUpdateAll(); } else if (CollectionUtils.containsAny(this.tableModel.getReq().getLineFields(), evt.getFields())) { this.put(evt); }/*from www. j ava 2 s .c o m*/ // si on n'affiche pas le champ ignorer }
From source file:org.openhab.tools.analysis.checkstyle.BuildPropertiesCheck.java
private void processBuildProperties(FileText fileText) throws CheckstyleException { // We ignore the exceptions thrown by the parseBuildProperties() method. A corrupt build.properties file will // fail the Maven build in the compile phase, so we should not care about this case in the validate phase IBuild buildPropertiesFile = parseBuildProperties(fileText); IBuildEntry binIncludesValue = buildPropertiesFile.getEntry(BIN_INCLUDES_PROPERTY_NAME); if (binIncludesValue != null) { List<String> missingValues = findMissingValues(binIncludesValue, expectedBinIncludesValues, true, (a, b) -> a.containsAll(b)); logMissingValues(fileText, BIN_INCLUDES_PROPERTY_NAME, missingValues, MISSING_BIN_INCLUDES_VALUE_MSG); } else {//from ww w .jav a 2 s . co m // bin.includes property is the single required property log(0, MISSING_BIN_INCLUDES_PROPERTY_MSG); } // some bundles don't contain any source code (only include some library), // so the source and output properties are not required IBuildEntry outputPropertyValue = buildPropertiesFile.getEntry(OUTPUT_PROPERTY_NAME); if (outputPropertyValue != null) { List<String> possibleMissingValues = findMissingValues(outputPropertyValue, possibleOutputValues, false, (a, b) -> CollectionUtils.containsAny(a, b)); // We would not like to log all possible values in a separate message if (!possibleMissingValues.isEmpty()) { List<String> valuesToLog = new ArrayList<String>(); valuesToLog.add("Any of " + possibleOutputValues.toString()); logMissingValues(fileText, OUTPUT_PROPERTY_NAME, valuesToLog, MISSING_OUTPUT_VALUE_MSG); } } IBuildEntry sourcePropertyValue = buildPropertiesFile.getEntry(SOURCE_PROPERTY_NAME); if (sourcePropertyValue != null) { // the build properties file is located directly in the base directory of the bundle File bundleBaseDir = fileText.getFile().getParentFile(); removeNonExistingSourceDirs(bundleBaseDir); List<String> missingValues = findMissingValues(sourcePropertyValue, possibleSourceValues, false, (a, b) -> a.containsAll(b)); logMissingValues(fileText, SOURCE_PROPERTY_NAME, missingValues, MISSING_SRC_VALUE_MSG); } }
From source file:org.openntf.xpt.core.dss.AbstractStorageService.java
private boolean isDocumentOfInterest(Document docCurrent, List<String> lstRolesGroups, List<String> lstFieldsToCheck) { try {//w w w . ja va 2 s .co m for (String strField : lstFieldsToCheck) { if (docCurrent.hasItem(strField)) { List<String> lstValues = getStringListFromDocument(docCurrent, strField); if (CollectionUtils.containsAny(lstRolesGroups, lstValues)) { return true; } } } } catch (Exception e) { LoggerFactory.logError(getClass(), "General Error", e); throw new XPTRuntimeException("General Error", e); } return false; }
From source file:org.opens.tanaguru.ruleimplementation.AbstractMarkerPageRuleImplementation.java
/** * @param id// www.ja v a 2 s. c om * @param classNames * @param role * @return whether one of the string given as argument belongs to a * marker list */ private boolean checkAttributeBelongsToMarkerList(String id, Collection<String> classNames, String role, Collection<String> markerList) { if (CollectionUtils.isEmpty(markerList)) { return false; } Collection<String> elAttr = new ArrayList<String>(); elAttr.add(id); elAttr.addAll(classNames); elAttr.add(role); return CollectionUtils.containsAny(markerList, elAttr); }
From source file:org.pentaho.marketplace.domain.services.BaPluginService.java
@Override protected boolean hasMarketplacePermission() { Collection<String> authorizedRoles = this.getAuthorizedRoles(); Collection<String> authorizedUsernames = this.getAuthorizedUsernames(); if (authorizedRoles.isEmpty() && authorizedUsernames.isEmpty()) { // If it's true, we'll just check if the user is admin return this.getSecurityHelper().isPentahoAdministrator(this.getCurrentSession()); }/*from w ww . ja va 2 s . c o m*/ Authentication authentication = this.getSecurityHelper().getAuthentication(this.getCurrentSession(), true); Collection<String> userRoles = this.getRoles(authentication); String userName = authentication.getName(); return authorizedUsernames.contains(userName) || CollectionUtils.containsAny(authorizedRoles, userRoles); }
From source file:org.sakaiproject.assignment.impl.AssignmentServiceImpl.java
private Assignment checkAssignmentAccessibleForUser(Assignment assignment, String currentUserId) throws PermissionException { if (assignment.getTypeOfAccess() == GROUP) { String context = assignment.getContext(); Collection<String> asgGroups = assignment.getGroups(); Collection<Group> allowedGroups = getGroupsAllowFunction(SECURE_ACCESS_ASSIGNMENT, context, currentUserId);// ww w . j av a 2 s. co m // reject and throw PermissionException if there is no intersection if (!allowAllGroups(context) && !StringUtils.equals(assignment.getAuthor(), currentUserId) && !CollectionUtils.containsAny(asgGroups, allowedGroups.stream().map(Group::getReference).collect(Collectors.toSet()))) { throw new PermissionException(currentUserId, SECURE_ACCESS_ASSIGNMENT, assignment.getId()); } } if (allowAddAssignment(assignment.getContext())) { // always return for users that can add assignment in the context return assignment; } else if (isAvailableOrSubmitted(assignment, currentUserId)) { return assignment; } throw new PermissionException(currentUserId, SECURE_ACCESS_ASSIGNMENT, assignment.getId()); }
From source file:org.sipfoundry.sipxconfig.admin.intercom.IntercomManagerImpl.java
/** * Return the intercom associated with a phone, through the groups the phone belongs to, or * null if there is no intercom for the phone. There should be at most one intercom for any * phone. If there is more than one, then return the first intercom found. */// w w w.j ava2 s . c o m public Intercom getIntercomForPhone(Phone phone) { Set phoneGroups = phone.getGroups(); for (Intercom intercom : loadIntercoms()) { Set intercomGroups = intercom.getGroups(); if (CollectionUtils.containsAny(phoneGroups, intercomGroups)) { return intercom; } } return null; }