private boolean isRoleMentioned(IMentionable mentionable) { if (mentionable instanceof Role) { return getMentionedRoles().contains(mentionable); } else if (mentionable instanceof Member) { final Member member = (Member) mentionable; return CollectionUtils.containsAny(getMentionedRoles(), member.getRoles()); } else if (isFromType(ChannelType.TEXT) && mentionable instanceof User) { final Member member = getGuild().getMember((User) mentionable); return member != null && CollectionUtils.containsAny(getMentionedRoles(), member.getRoles()); } return false; }
if (!CollectionUtils.containsAny(gameJson.keySet(), richGameFields)) return new Game(name, url, type, timestamps);
public boolean hasUpdatedType(Set<String> typeNames) { return CollectionUtils.containsAny(this.typesName, typeNames); } }
|| CollectionUtils.containsAny(issuer.getRoles(), emote.getRoles()));
public static boolean containsAny(final Collection<?> coll1, final Collection<?> coll2) { return org.apache.commons.collections4.CollectionUtils.containsAny(coll1, coll2); }
@Override protected boolean boolVote(User user) { return (CollectionUtils.containsAny(roles, user.getAllRoles())); }
@Override public boolean hasAccess(User user) { Collection<String> userRoles = user.getAllRoles(); if (roles.isEmpty() || userRoles.contains(this.superuserRole) || CollectionUtils.containsAny(userRoles, roles)) { return true; } return false; }
private boolean isAffectedTestCase(SlangTestCase slangTestCase, Set<String> changedExecutables, Map<String, Executable> allTestedFlowModels) { String testFlowPath = slangTestCase.getTestFlowPath(); Executable testCaseReference = allTestedFlowModels.get(testFlowPath); if (testCaseReference == null) { throw new RuntimeException("Test case reference[" + testFlowPath + "] not found in compiled models."); } Set<String> testCaseDependencies = dependenciesHelper.fetchDependencies(testCaseReference, allTestedFlowModels); testCaseDependencies.add(testFlowPath); return containsAny(testCaseDependencies, changedExecutables); }
public boolean isTestCaseInActiveSuite(SlangTestCase testCase, List<String> testSuites) { return (isEmpty(testCase.getTestSuites()) && testSuites.contains(SlangBuildMain.DEFAULT_TESTS)) || containsAny(testSuites, testCase.getTestSuites()); }
protected String resolveAvailableComponents() { if (StringUtils.isNotEmpty(availableComponents)) { return StringUtils.remove(availableComponents, " "); } if (areaDefinition != null && areaDefinition.getAvailableComponents().size() > 0) { Iterator<ComponentAvailability> iterator = areaDefinition.getAvailableComponents().values().iterator(); List<String> componentIds = new ArrayList<String>(); final Collection<String> userRoles = MgnlContext.getUser().getAllRoles(); while (iterator.hasNext()) { ComponentAvailability availableComponent = iterator.next(); if (availableComponent.isEnabled()) { // check roles final Collection<String> roles = availableComponent.getRoles(); if (!roles.isEmpty()) { if (CollectionUtils.containsAny(userRoles, roles)) { componentIds.add(availableComponent.getId()); } } else { componentIds.add(availableComponent.getId()); } } } return StringUtils.join(componentIds, ','); } return ""; }
/** * PUBLIC: Tests whether two topics should be merged or not, * according to XTM rules. * * @param t1 topicIF; #1 topic to merge * @param t2 topicIF; #2 topic to merge * @return boolean; true if the topics should be merged, false otherwise. */ public static boolean shouldMerge(TopicIF t1, TopicIF t2) { // check subject locators if (CollectionUtils.containsAny(t1.getSubjectLocators(), t2.getSubjectLocators())) return true; // check subject indicators and source locators if (CollectionUtils.containsAny(t1.getSubjectIdentifiers(), t2.getSubjectIdentifiers()) || CollectionUtils.containsAny(t1.getItemIdentifiers(), t2.getSubjectIdentifiers())) return true; if (CollectionUtils.containsAny(t1.getItemIdentifiers(), t2.getItemIdentifiers()) || CollectionUtils.containsAny(t1.getSubjectIdentifiers(), t2.getItemIdentifiers())) return true; // should merge if they reify the same object ReifiableIF r1 = t1.getReified(); ReifiableIF r2 = t2.getReified(); if (r1 != null && Objects.equals(r1, r2)) return true; return false; }
if (!CollectionUtils.containsAny(MgnlContext.getUser().getAllRoles(), roles)) { return false;
final Collection<String> roles = templateConfig.getRoles(); if (!roles.isEmpty()) { if (!CollectionUtils.containsAny(MgnlContext.getUser().getAllRoles(), roles)) { return false;
/** * Return groups matching to given criteria. The visible groups, trees and companies are checked. The returned * groups of each user depends on the groups the user can see/write in CN form. * * @param uriInfo * filter data. * @return found groups. */ @GET public TableItem<ContainerCountVo> findAll(@Context final UriInfo uriInfo) { final List<ContainerScope> types = containerScopeResource.findAllDescOrder(ContainerType.GROUP); final Map<String, CompanyOrg> companies = getCompany().findAll(); final Collection<CompanyOrg> visibleCompanies = organizationResource.getContainers(); final Set<GroupOrg> writeGroups = getContainersForWrite(); final Set<GroupOrg> adminGroups = getContainersForAdmin(); final Map<String, UserOrg> users = getUser().findAll(); // Search the groups final Page<GroupOrg> findAll = getContainers(DataTableAttributes.getSearch(uriInfo), paginationJson.getPageRequest(uriInfo, ORDERED_COLUMNS)); // Apply pagination and secure the users data return paginationJson.applyPagination(uriInfo, findAll, rawGroup -> { final ContainerCountVo securedUserOrg = newContainerCountVo(rawGroup, writeGroups, adminGroups, types); securedUserOrg.setCount(rawGroup.getMembers().size()); // Computed the visible members securedUserOrg.setCountVisible((int) rawGroup.getMembers().stream().map(users::get).map(UserOrg::getCompany) .map(companies::get).map(CompanyOrg::getCompanyTree) .filter(c -> CollectionUtils.containsAny(visibleCompanies, c)).count()); return securedUserOrg; }); }