private static void findAppendersTypes() { final Reflections reflections = new Reflections(); types = StreamEx .of(reflections.getSubTypesOf(Appender.class)) .filter(c -> !(c.isInterface() || Modifier.isAbstract(c.getModifiers()))) .map(Class::getName) .toList(); }
public static List<Long> id(final Collection<? extends DomainJpa> objects) { return objects == null ? ImmutableList.of() : StreamEx.of(objects).map(DomainJpa::getId).toList(); }
@Override @RequestMapping(value = SRV_PATH + M_R_CONFS, method = RequestMethod.GET) public List<OauthConfiguration> getServiceConfigurations() { return StreamEx .of(EnumSet.allOf(UserNetwork.class)) .map(oauth2Manager::getServiceConfiguration) .nonNull() .toList(); }
@Nonnull public List<RoleModel> getGwtUserRoles(@Nonnull final String userId) { return StreamEx.of(userRolesService.getUserRoles(userId)).map(adapter::toGwt).toList(); }
private static <R> List<R> filter(final String query, final boolean inherited, final long limit, final Function<Logger, R> logMapper) { final String patternString = MessageFormat.format(QUERY_FORMAT, CAMEL_CASE_P03.matcher(CAMEL_CASE_P02.matcher(CAMEL_CASE_P01.matcher(query).replaceAll(CAMEL_CASE_R01)).replaceAll(CAMEL_CASE_R02)).replaceAll(CAMEL_CASE_R03)); final Pattern queryPattern = Pattern.compile(patternString, Pattern.UNICODE_CHARACTER_CLASS); return StreamEx.of(Logs.getLoggers()).parallel().filter(l -> inherited || l.getLevel() != null).filter(l -> queryPattern.matcher(l.getName()).matches()).limit(limit).map(logMapper).toList(); }
private List<IRoleMetaInfo> map(final String modelId, final Collection<Role> roles) { return StreamEx.of(roles).map(r -> (IRoleMetaInfo) loadRole(modelId, r)).toList(); }
@Nonnull public static List<Appender<ILoggingEvent>> getAppenders() { return StreamEx .of(getLoggers()) .flatMap(l -> StreamEx.<Appender<ILoggingEvent>> of(l.iteratorForAppenders())) .toList(); }
@Override public List<IRoleMetaInfo> getRoles() { return EntryStream.of(getAllRoles()).flatCollection(e -> map(e)).toList(); }
@Override public List<IRoleMetaInfo> getUserRoles(final String userId) { return StreamEx.of(modelRegistry.getModels()).flatCollection(m -> getUserRoles(userId, m.getId())).toList(); }
private static Collection<EObject> findPermission(final PObject object, final EObject roleInstance, final POperation operation) { assert object.getEOperations().contains(operation); final List<EStructuralFeature> structuralFeatures = roleInstance.eClass().getEStructuralFeatures(); return StreamEx .of(structuralFeatures) .filter(f -> UamPackage.eINSTANCE.getPermission().isInstance(f.getEType()) && isOperationPermission((Permission) f.getEType(), operation)) .map(roleInstance::eGet) .map(EObject.class::cast) .toList(); }