Example usage for java.lang String CASE_INSENSITIVE_ORDER

List of usage examples for java.lang String CASE_INSENSITIVE_ORDER

Introduction

In this page you can find the example usage for java.lang String CASE_INSENSITIVE_ORDER.

Prototype

Comparator CASE_INSENSITIVE_ORDER

To view the source code for java.lang String CASE_INSENSITIVE_ORDER.

Click Source Link

Document

A Comparator that orders String objects as by compareToIgnoreCase .

Usage

From source file:com.netflix.genie.web.data.repositories.jpa.specifications.JpaSpecificationUtils.java

/**
 * Get the sorted like statement for tags used in specification queries.
 *
 * @param tags The tags to use. Not null.
 * @return The tags sorted while ignoring case delimited with percent symbol.
 *//*from   w ww. j  a v  a  2 s  .co m*/
static String getTagLikeString(@NotNull final Set<String> tags) {
    final StringBuilder builder = new StringBuilder();
    tags.stream().filter(StringUtils::isNotBlank).sorted(String.CASE_INSENSITIVE_ORDER)
            .forEach(tag -> builder.append(PERCENT).append(TAG_DELIMITER).append(tag).append(TAG_DELIMITER));
    return builder.append(PERCENT).toString();
}

From source file:com.xpn.xwiki.plugin.tag.TagQueryUtils.java

/**
 * Get all tags within the wiki./*w w w .ja va 2s . c  o  m*/
 *
 * @param context XWiki context.
 * @return list of tags (alphabetical order).
 * @throws com.xpn.xwiki.XWikiException if search query fails (possible failures: DB access problems, etc).
 */
public static List<String> getAllTags(XWikiContext context) throws XWikiException {
    List<String> results;

    String hql = "select distinct elements(prop.list) from XWikiDocument as doc, BaseObject as obj, "
            + "DBStringListProperty as prop where obj.name=doc.fullName and obj.className='XWiki.TagClass' and "
            + "obj.id=prop.id.id and prop.id.name='tags'";

    try {
        Query query = context.getWiki().getStore().getQueryManager().createQuery(hql, Query.HQL);
        query.addFilter(Utils.<QueryFilter>getComponent(QueryFilter.class, HiddenDocumentFilter.HINT));
        results = query.execute();
    } catch (QueryException e) {
        throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_UNKNOWN,
                String.format("Failed to get all tags", hql), e);
    }

    Collections.sort(results, String.CASE_INSENSITIVE_ORDER);

    return results;
}

From source file:it.unibz.instasearch.prefs.PreferenceInitializer.java

/**
 * Get extensions that Eclipse knows of and the default ones
 * @return comma separated string of extensions
 *//*ww w  .  j  ava  2s  .c om*/
public static String getIndexableExtensions() {
    String defaultExtArray[] = DEFAULT_EXTENSIONS.split(",");

    TreeSet<String> extensions = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
    extensions.addAll(Arrays.asList(defaultExtArray));

    IFileEditorMapping[] allMappings = ((EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry())
            .getUnifiedMappings();

    IContentType text = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);

    for (int i = 0; i < allMappings.length; i++) {
        if (allMappings[i].getName().equals("*")) {
            String ext = allMappings[i].getExtension();
            IContentType type = Platform.getContentTypeManager().findContentTypeFor("." + ext);

            if (type != null && type.isKindOf(text))
                extensions.add(ext);
        }
    }

    IContentType[] types = Platform.getContentTypeManager().getAllContentTypes();
    for (IContentType type : types) {
        if (type.isKindOf(text)) {
            String exts[] = type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
            extensions.addAll(Arrays.asList(exts));
        }
    }

    return StringUtils.join(extensions.toArray(), ",");
}

From source file:org.duracloud.syncui.controller.JQueryFileTreeController.java

private void loadChildren(File directory, List<File> children) {
    if (directory.exists()) {
        String[] filenames = directory.list(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return name.charAt(0) != '.';
            }/*from w  ww  .ja  v a 2s  . c o m*/
        });

        Arrays.sort(filenames, String.CASE_INSENSITIVE_ORDER);
        for (String filename : filenames) {
            children.add(new File(directory, filename));
        }
    }
}

From source file:org.apache.ode.karaf.commands.OdeListCommand.java

@Override
protected Object doExecute() throws Exception {
    try {/*from   w  ww. j a va  2s  . c  o m*/
        System.out.println("Existing processes");
        System.out.println("------------------");
        List<TProcessInfo> processes = getProcesses(timeoutInSeconds);
        if (processes != null) {
            System.out
                    .println("[ ] [Version] [PID                                                            ]");
            Set<String> sorted = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
            for (TProcessInfo info : processes) {
                StringBuilder line = new StringBuilder();
                line.append("[");
                line.append(info.getStatus().toString().charAt(0));
                line.append("] [");
                line.append(getNameString(Long.toString(info.getVersion()), 7, false));
                line.append("] [");
                line.append(getNameString(info.getPid().toString(), 63, true));
                line.append("]");

                sorted.add(line.toString());
            }
            for (String s : sorted) {
                System.out.println(s);
            }
        }
        System.out.println();

        System.out.println("Active instances");
        System.out.println("----------------");
        List<TInstanceInfo> instances = showAll ? getAllInstances(timeoutInSeconds)
                : getActiveInstances(timeoutInSeconds);
        if (instances != null) {
            System.out
                    .println("[ ] [IID  ] [Process Name                   ] [Failed Activities              ]");
            for (TInstanceInfo info : instances) {
                StringBuilder line = new StringBuilder();
                line.append("[");
                line.append(info.getStatus().toString().charAt(0));
                line.append("] [");
                line.append(getNameString(info.getIid(), 5, false));
                line.append("] [");
                line.append(getNameString(info.getPid(), 31, true));
                line.append("] [");
                StringBuilder failedString = new StringBuilder();
                List<TActivityInfo> failedActivities = getFailedActivities(info);
                if (!failedActivities.isEmpty()) {
                    boolean first = true;
                    for (TActivityInfo failed : failedActivities) {
                        if (!first) {
                            failedString.append(", ");
                        }
                        failedString.append(failed.getAiid());
                        first = false;
                    }
                }
                line.append(getNameString(failedString.toString(), 31, false));
                line.append("]");
                System.out.println(line.toString());
            }
        }
    } catch (TimeoutException e) {
        __log.error("Timed out after " + timeoutInSeconds + " seconds", e);
    }

    return null;
}

From source file:com.evolveum.midpoint.web.page.admin.configuration.dto.AppenderConfiguration.java

@Override
public int compareTo(O o) {
    if (o == null) {
        return 0;
    }/*from   ww w.ja v  a 2s  . co  m*/
    return String.CASE_INSENSITIVE_ORDER.compare(getName(), o.getName());
}

From source file:org.apache.usergrid.persistence.index.utils.MapUtils.java

@SuppressWarnings("unchecked")
public static <A, B, C, D> void addMapMapMapSet(Map<A, Map<B, Map<C, Set<D>>>> map, boolean ignoreCase, A a,
        B b, C c, D d) {//from   w w w  . j  a va  2 s  .c o m
    Map<B, Map<C, Set<D>>> mapB = map.get(a);
    if (mapB == null) {
        if (ignoreCase && (b instanceof String)) {
            mapB = (Map<B, Map<C, Set<D>>>) new TreeMap<String, Map<C, Set<D>>>(String.CASE_INSENSITIVE_ORDER);
        } else {
            mapB = new LinkedHashMap<B, Map<C, Set<D>>>();
        }
        map.put(a, mapB);
    }
    addMapMapSet(mapB, ignoreCase, b, c, d);
}

From source file:org.apache.accumulo.shell.commands.GetAuthsCommand.java

protected List<String> sortAuthorizations(Authorizations auths) {
    List<String> list = new ArrayList<String>();
    for (byte[] auth : auths) {
        list.add(new String(auth));
    }//from   ww w. j  a  va  2  s  . c  o  m
    Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
    return list;
}

From source file:org.apache.hawq.pxf.api.utilities.ProfilesConf.java

/**
 * Constructs the ProfilesConf enum singleton instance.
 * <p/>/*from  w w  w  .j  av a2  s.  co m*/
 * External profiles take precedence over the internal ones and override them.
 */
private ProfilesConf() {
    profilesMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    loadConf(INTERNAL_PROFILES, true);
    loadConf(EXTERNAL_PROFILES, false);
    if (profilesMap.isEmpty()) {
        throw new ProfileConfException(PROFILES_FILE_NOT_FOUND, EXTERNAL_PROFILES);
    }
    LOG.info("PXF profiles loaded: " + profilesMap.keySet());
}

From source file:org.caleydo.view.domino.internal.data.LabelDataValues.java

@Override
public int compare(EDimension dim, int a, int b, ITypedCollection otherData) {
    String av = get(a);//from   ww  w. j a  v  a2s  .com
    String bv = get(b);
    return Objects.compare(av, bv, String.CASE_INSENSITIVE_ORDER);
}