Package org.apache.commons.collections.iterators

Examples of org.apache.commons.collections.iterators.EnumerationIterator


                return false;
            }
        }
        // pick out all the user properties parameters, and set it into the
        // user properties
        Iterator names = new EnumerationIterator(request.getParameterNames());
        while (names.hasNext()) {
            String name = (String) names.next();
            if (name != null && name.startsWith(USER_PROPERTY_PREFIX)) {
                String newValue = request.getParameter(name);
                int index = name.indexOf(SEPARATOR);
                String key = name.substring(index + 1);
                UserProperty currentProp = usr.getUserProperty(key);
View Full Code Here


        } catch (Exception t) {
            logger.debug("Exception while getting language settings as locales", t);
        }

        // retrieve the browser locales
        for (@SuppressWarnings("unchecked") Iterator<Locale> browserLocales = new EnumerationIterator(request.getLocales()); browserLocales
                .hasNext();) {
            final Locale curLocale = browserLocales.next();
            if (siteLanguages.contains(curLocale)) {
                addLocale(site, newLocaleList, curLocale);
            } else if (!StringUtils.isEmpty(curLocale.getCountry())) {
                final Locale langOnlyLocale = new Locale(curLocale.getLanguage());
                if (siteLanguages.contains(langOnlyLocale)) {
View Full Code Here

            addLocale(site, newLocaleList, preferredLocale);
        }

        // retrieve the browser locales
        for (@SuppressWarnings("unchecked")
        Iterator<Locale> browserLocales = new EnumerationIterator(request.getLocales()); browserLocales
                .hasNext();) {
            final Locale curLocale = browserLocales.next();
            if (siteLanguages.contains(curLocale)) {
                addLocale(site, newLocaleList, curLocale);
            } else if (!StringUtils.isEmpty(curLocale.getCountry())) {
                final Locale langOnlyLocale = new Locale(curLocale.getLanguage());
                if (siteLanguages.contains(langOnlyLocale)) {
View Full Code Here

                BufferedReader buffered                  =  new BufferedReader( new FileReader( this.propertiesFilePath ) );
                int            position                  =  0;

                // compose all properties List, used to find the new properties...
                List         allProperties             =  new ArrayList();
                Iterator    allPropertiesEnumeration  =  new EnumerationIterator(properties.propertyNames());
                while(allPropertiesEnumeration.hasNext()) {
                    allProperties.add( (String) allPropertiesEnumeration.next() );
                }

                // parse the file...
                while((lineReaded = buffered.readLine()) != null)
                {
View Full Code Here

     *            declarations.
     */
    private void writeNSDecls ()
        throws SAXException
    {
        Iterator prefixes = new EnumerationIterator(nsSupport.getDeclaredPrefixes());
        while (prefixes.hasNext()) {
            String prefix = (String) prefixes.next();
            String uri = nsSupport.getURI(prefix);
            if (uri == null) {
                uri = "";
            }
            char ch[] = uri.toCharArray();
View Full Code Here

            properties.append(getI18n("org.jahia.engines.groups.guest.label", "guest"));
            return adjustStringSize(properties.toString(), size);
        } else {
            final JahiaGroup group = (JahiaGroup) p;
            // Find some group members for properties
            final Iterator grpMembers = group.isPreloadedGroups() ? new EnumerationIterator(group.members()) : null;
            final StringBuffer members = new StringBuffer().append("(");
            if (grpMembers != null) {
                while (grpMembers.hasNext()) {
                    final Object obj = grpMembers.next();
                    if (obj instanceof JahiaUser) {
View Full Code Here

    public static Set removeJahiaAdministrators(Set users) {
        final Set usersWithoutJahiaAdmin = new TreeSet(PRINCIPAL_COMPARATOR);
        usersWithoutJahiaAdmin.addAll(users);
        final JahiaGroup jahiaAdminGroup = ServicesRegistry.getInstance().
                getJahiaGroupManagerService().getAdministratorGroup(0);
        final Iterator memberEnum = new EnumerationIterator(jahiaAdminGroup.members());
        while (memberEnum.hasNext()) {
            final Object curMemberObject = memberEnum.next();
            if (curMemberObject instanceof JahiaUser) {
                usersWithoutJahiaAdmin.remove(curMemberObject);
            }
        }
        return usersWithoutJahiaAdmin;
View Full Code Here

                    .append(request.getRemoteUser()).append("\nSession ID: ")
                    .append(request.getRequestedSessionId()).append("\nSession user: ")
                    .append(getUserInfo(request)).append("\nRequest headers: ");

            @SuppressWarnings("unchecked")
            Iterator<String> headerNames = new EnumerationIterator(request.getHeaderNames());
            while (headerNames.hasNext()) {
                String headerName = headerNames.next();
                String headerValue = request.getHeader(headerName);
                info.append("\n  ").append(headerName).append(": ").append(
                        headerValue);
            }
        }
View Full Code Here

            this.requestURL = request.getRequestURI();
            this.queryString = request.getQueryString();
            this.method = request.getMethod();
            this.remoteHost = request.getRemoteHost();
            this.remoteAddr = request.getRemoteAddr();
            Iterator headerNames = new EnumerationIterator(request.getHeaderNames());
            while (headerNames.hasNext()) {
                String headerName = (String) headerNames.next();
                String headerValue = request.getHeader(headerName);
                headers.put(headerName, headerValue);
            }

        }
View Full Code Here

     *
     * @param enumeration  the enumeration to traverse, which should not be <code>null</code>.
     * @throws NullPointerException if the enumeration parameter is <code>null</code>.
     */
    public static List toList(Enumeration enumeration) {
        return IteratorUtils.toList(new EnumerationIterator(enumeration));
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.iterators.EnumerationIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.