List of usage examples for java.lang String CASE_INSENSITIVE_ORDER
Comparator CASE_INSENSITIVE_ORDER
To view the source code for java.lang String CASE_INSENSITIVE_ORDER.
Click Source Link
From source file:it.unibz.instasearch.InstaSearchPlugin.java
/** * Returns a list of open project names// w w w.j av a 2 s .c o m * @return ProjectNames */ public static List<String> getProjectNames() { ArrayList<String> projectNames = new ArrayList<String>(); if (getWorkspaceRoot() == null) return projectNames; IProject[] projects = getWorkspaceRoot().getProjects(); for (IProject project : projects) { if (project.exists() && project.isAccessible() && project.isOpen()) projectNames.add(project.getName()); } Collections.sort(projectNames, String.CASE_INSENSITIVE_ORDER); return projectNames; }
From source file:de.tor.tribes.util.report.ReportManager.java
@Override public String[] getGroups() { String[] groups = super.getGroups(); Arrays.sort(groups, new Comparator<String>() { @Override//from ww w . j a v a2s.c o m public int compare(String o1, String o2) { if (o1.equals(DEFAULT_GROUP) || o1.equals(FARM_SET)) { return -1; } else if (o2.equals(DEFAULT_GROUP) || o2.equals(FARM_SET)) { return 1; } else { return String.CASE_INSENSITIVE_ORDER.compare(o1, o2); } } }); return groups; }
From source file:com.evolveum.midpoint.web.component.search.Property.java
@Override public int compareTo(Property o) { String n1 = getItemDefinitionName(definition); String n2 = getItemDefinitionName(o.definition); if (n1 == null || n2 == null) { return 0; }// w ww.jav a2 s . c o m return String.CASE_INSENSITIVE_ORDER.compare(n1, n2); }
From source file:org.apereo.services.persondir.support.jdbc.ColumnMapParameterizedRowMapper.java
/** * Create a Map instance to be used as column map. * <br>/*w w w. ja v a2 s . com*/ * By default, a linked case-insensitive Map will be created * * @param columnCount the column count, to be used as initial capacity for the Map * @return the new Map instance */ @SuppressWarnings("unchecked") protected Map<String, Object> createColumnMap(final int columnCount) { return new TreeMap(String.CASE_INSENSITIVE_ORDER); }
From source file:com.evolveum.midpoint.web.component.menu.top.LocaleDescriptor.java
private int compareStrings(String s1, String s2) { if (s1 == null || s2 == null) { return 0; }// w ww. ja v a 2 s . c om return String.CASE_INSENSITIVE_ORDER.compare(s1, s2); }
From source file:org.apache.kylin.cube.model.validation.rule.AggregationGroupRule.java
private void inner(CubeDesc cube, ValidateContext context) { if (cube.getAggregationGroups() == null || cube.getAggregationGroups().size() == 0) { context.addResult(ResultLevel.ERROR, "Cube should have at least one Aggregation group."); return;/*from w w w .j a va 2 s . co m*/ } int index = 0; for (AggregationGroup agg : cube.getAggregationGroups()) { if (agg.getIncludes() == null) { context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " 'includes' field not set"); continue; } if (agg.getSelectRule() == null) { context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " 'select rule' field not set"); continue; } Set<String> includeDims = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (agg.getIncludes() != null) { for (String include : agg.getIncludes()) { includeDims.add(include); } } Set<String> mandatoryDims = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (agg.getSelectRule().mandatoryDims != null) { for (String m : agg.getSelectRule().mandatoryDims) { mandatoryDims.add(m); } } Set<String> hierarchyDims = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (agg.getSelectRule().hierarchyDims != null) { for (String[] ss : agg.getSelectRule().hierarchyDims) { for (String s : ss) { hierarchyDims.add(s); } } } Set<String> jointDims = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (agg.getSelectRule().jointDims != null) { for (String[] ss : agg.getSelectRule().jointDims) { for (String s : ss) { jointDims.add(s); } } } if (!includeDims.containsAll(mandatoryDims) || !includeDims.containsAll(hierarchyDims) || !includeDims.containsAll(jointDims)) { List<String> notIncluded = Lists.newArrayList(); final Iterable<String> all = Iterables .unmodifiableIterable(Iterables.concat(mandatoryDims, hierarchyDims, jointDims)); for (String dim : all) { if (includeDims.contains(dim) == false) { notIncluded.add(dim); } } context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " 'includes' dimensions not include all the dimensions:" + notIncluded.toString()); continue; } if (CollectionUtils.containsAny(mandatoryDims, hierarchyDims)) { Set<String> intersection = new HashSet<>(mandatoryDims); intersection.retainAll(hierarchyDims); context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " mandatory dimension has overlap with hierarchy dimension: " + intersection.toString()); continue; } if (CollectionUtils.containsAny(mandatoryDims, jointDims)) { Set<String> intersection = new HashSet<>(mandatoryDims); intersection.retainAll(jointDims); context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " mandatory dimension has overlap with joint dimension: " + intersection.toString()); continue; } int jointDimNum = 0; if (agg.getSelectRule().jointDims != null) { for (String[] joints : agg.getSelectRule().jointDims) { Set<String> oneJoint = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for (String s : joints) { oneJoint.add(s); } if (oneJoint.size() < 2) { context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " require at least 2 dimensions in a joint: " + oneJoint.toString()); continue; } jointDimNum += oneJoint.size(); int overlapHierarchies = 0; if (agg.getSelectRule().hierarchyDims != null) { for (String[] oneHierarchy : agg.getSelectRule().hierarchyDims) { Set<String> share = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); share.addAll(CollectionUtils.intersection(oneJoint, Arrays.asList(oneHierarchy))); if (!share.isEmpty()) { overlapHierarchies++; } if (share.size() > 1) { context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " joint dimensions has overlap with more than 1 dimensions in same hierarchy: " + share.toString()); continue; } } if (overlapHierarchies > 1) { context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " joint dimensions has overlap with more than 1 hierarchies"); continue; } } } if (jointDimNum != jointDims.size()) { Set<String> existing = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); Set<String> overlap = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for (String[] joints : agg.getSelectRule().jointDims) { Set<String> oneJoint = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for (String s : joints) { oneJoint.add(s); } if (CollectionUtils.containsAny(existing, oneJoint)) { overlap.addAll(CollectionUtils.intersection(existing, oneJoint)); } existing.addAll(oneJoint); } context.addResult(ResultLevel.ERROR, "Aggregation group " + index + " a dimension exists in more than one joint: " + overlap.toString()); continue; } } long combination = 0; try { combination = agg.calculateCuboidCombination(); } catch (Exception ex) { combination = getMaxCombinations(cube) + 1; } finally { if (combination > getMaxCombinations(cube)) { String msg = "Aggregation group " + index + " has too many combinations, current combination is " + combination + ", max allowed combination is " + getMaxCombinations(cube) + "; use 'mandatory'/'hierarchy'/'joint' to optimize; or update 'kylin.cube.aggrgroup.max-combination' to a bigger value."; context.addResult(ResultLevel.ERROR, msg); continue; } } index++; } }
From source file:net.tirasa.connid.bundles.soap.cxf.ForceSoapActionOutInterceptor.java
private void setSoapAction(final SoapMessage message) { BindingOperationInfo boi = message.getExchange().getBindingOperationInfo(); // The soap action is set on the wrapped operation. if (boi != null && boi.isUnwrapped()) { boi = boi.getWrappedOperation(); }/*from w ww . ja v a 2 s. co m*/ final String action = getSoapAction(message, boi); if (message.getVersion() instanceof Soap11) { Map<String, List<String>> reqHeaders = CastUtils .cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS)); if (reqHeaders == null) { reqHeaders = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); } if (reqHeaders.isEmpty()) { message.put(Message.PROTOCOL_HEADERS, reqHeaders); } if (!reqHeaders.containsKey(SoapBindingConstants.SOAP_ACTION)) { reqHeaders.put(SoapBindingConstants.SOAP_ACTION, Collections.singletonList(action)); } } else if (message.getVersion() instanceof Soap12 && !"\"\"".equals(action)) { String contentType = (String) message.get(Message.CONTENT_TYPE); if (contentType.indexOf("action=\"") == -1) { contentType = new StringBuilder().append(contentType).append("; action=").append(action).toString(); message.put(Message.CONTENT_TYPE, contentType); } } }
From source file:de.cosmocode.json.JSONObjectMapTest.java
@Override public SampleElements<Entry<String, Object>> samples() { return SampleElements.mapEntries(new SampleElements<String>("key", "test", "name", "size", "string"), new SampleElements<Object>(Boolean.TRUE, Integer.MAX_VALUE, 123, String.CASE_INSENSITIVE_ORDER, "test")); }
From source file:com.jci.utils.CommonUtils.java
/** * Gets the dest mapping.//w w w . j a v a 2s .c o m * * @param folderUrl the folder url * @return the dest mapping */ public TreeMap<String, HashMap<Integer, String>> getDestMapping(String folderUrl) { // NO_UCD (unused code) HashMap<Integer, String> map = null; ObjectMapper mapper = new ObjectMapper(); TreeMap<String, HashMap<Integer, String>> mappingList = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); File folder = new File(folderUrl); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) {//reading only 1 file need to make changes if (listOfFiles[i].isFile()) { TypeReference<HashMap<Integer, String>> typeRef = new TypeReference<HashMap<Integer, String>>() { }; try { map = mapper.readValue(listOfFiles[i], typeRef); mappingList.put(FilenameUtils.removeExtension(listOfFiles[i].getName()), map); } catch (IOException e) { LOG.error("### Exception in ####", e); } } } LOG.error("mappingList--->" + mappingList); return mappingList; }
From source file:net.community.chest.gitcloud.facade.ServletUtils.java
public static final Map<String, String> getRequestHeaders(HttpServletRequest req) { // NOTE: map must be case insensitive as per HTTP requirements Map<String, String> hdrsMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); for (Enumeration<String> hdrs = req.getHeaderNames(); (hdrs != null) && hdrs.hasMoreElements();) { String hdrName = hdrs.nextElement(), hdrValue = req.getHeader(hdrName); hdrsMap.put(capitalizeHttpHeaderName(hdrName), StringUtils.trimToEmpty(hdrValue)); }//from w ww . jav a 2 s . c o m return hdrsMap; }