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:com.stimulus.archiva.presentation.ConfigBean.java
public List<String> getRuleFieldLabels() { ArrayList<String> list = new ArrayList<String>(); EmailFields emailFields = Config.getConfig().getEmailFields(); for (EmailField ef : emailFields.getAvailableFields().values()) { if (!Compare.equalsIgnoreCase(ef.getName(), "body") && !Compare.equalsIgnoreCase(ef.getName(), "attachments")) { list.add(ef.getResource());//ww w. ja va 2s. c om } } list.add("field_label_addresses"); Collections.sort(list, String.CASE_INSENSITIVE_ORDER); return translateList(list); }
From source file:org.apache.directory.fortress.core.impl.TestUtils.java
/** * * @param szInput//from w w w.j a va2 s . co m * @return */ public static Set<String> getSets(String szInput) { Set<String> vSets = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); try { if (StringUtils.isNotEmpty(szInput)) { StringTokenizer charSetTkn = new StringTokenizer(szInput, TestUtils.DELIMITER_TEST_DATA); if (charSetTkn.countTokens() > 0) { while (charSetTkn.hasMoreTokens()) { String value = charSetTkn.nextToken(); vSets.add(value); } } } } catch (java.lang.ArrayIndexOutOfBoundsException ae) { // ignore } return vSets; }
From source file:org.geoserver.web.admin.GlobalSettingsPage.java
private void logLevelsAppend(Form form, IModel loggingInfoModel) { // search for *LOGGING.properties files in the data directory GeoServerResourceLoader loader = GeoServerApplication.get().getBeanOfType(GeoServerResourceLoader.class); List<String> logProfiles = null; try {//from w ww.j av a2s .c o m File logsDirectory = loader.find("logs"); if (logsDirectory.exists() && logsDirectory.isDirectory()) { String[] propFiles = logsDirectory.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith("logging.properties"); } }); logProfiles = Arrays.asList(propFiles); Collections.sort(logProfiles, String.CASE_INSENSITIVE_ORDER); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Could not load the list of log configurations from the data directory", e); } // if none is found use the default set if (logProfiles == null || logProfiles.size() == 0) logProfiles = DEFAULT_LOG_PROFILES; form.add(new ListChoice("log4jConfigFile", new PropertyModel(loggingInfoModel, "level"), logProfiles)); }
From source file:org.openhim.mediator.engine.MediatorRequestHandler.java
private void respondToCaller(Integer status) { if (requestCaller != null) { if (response.getStatus() == null) { response.setStatus(response.getDescriptiveStatus()); }/*from w w w . j a va2 s . c o m*/ Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("Content-Type", OPENHIM_MIME_TYPE); MediatorHTTPResponse serverResponse = new MediatorHTTPResponse(null, response.toJSON(), status, headers); requestCaller.tell(serverResponse, getSelf()); requestCaller = null; } else { log.warning("FinishRequestMessage received but request caller is gone"); } }
From source file:org.intermine.web.struts.ReportController.java
/** * {@inheritDoc}//from w w w. ja v a 2s . co m */ @SuppressWarnings("unused") @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { long startTime = System.currentTimeMillis(); HttpSession session = request.getSession(); InterMineAPI im = SessionMethods.getInterMineAPI(session); if (im.getBagManager().isAnyBagToUpgrade(SessionMethods.getProfile(session))) { recordError(new ActionMessage("login.upgradeListManually"), request); } // fetch & set requested object InterMineObject requestedObject = getRequestedObject(im, request); if (requestedObject != null) { ReportObjectFactory reportObjectFactory = SessionMethods.getReportObjects(session); ReportObject reportObject = reportObjectFactory.get(requestedObject); request.setAttribute("object", reportObject); request.setAttribute("reportObject", reportObject); request.setAttribute("requestedObject", requestedObject); // hell starts here TagManager tm = im.getTagManager(); ServletContext servletContext = session.getServletContext(); ObjectStore os = im.getObjectStore(); String superuser = im.getProfileManager().getSuperuser(); if (superuser.equals(SessionMethods.getProfile(session).getUsername())) { request.setAttribute("SHOW_TAGS", true); } // place InlineLists based on TagManager, reportObject is cached while Controller is not Map<String, List<InlineList>> placedInlineLists = new TreeMap<String, List<InlineList>>(); // traverse all unplaced (non-header) InlineLists for (InlineList list : reportObject.getNormalInlineLists()) { FieldDescriptor fd = list.getDescriptor(); String taggedType = getTaggedType(fd); // assign lists to any aspects they are tagged to or put in unplaced lists String fieldPath = fd.getClassDescriptor().getUnqualifiedName() + "." + fd.getName(); for (String tagName : tm.getObjectTagNames(fieldPath, taggedType, superuser)) { if (AspectTagUtil.isAspectTag(tagName)) { List<InlineList> listsForAspect = placedInlineLists.get(tagName); if (listsForAspect == null) { listsForAspect = new ArrayList<InlineList>(); placedInlineLists.put(tagName, listsForAspect); } listsForAspect.add(list); } else if (TagNames.IM_SUMMARY.equals(tagName)) { List<InlineList> summaryLists = placedInlineLists.get(tagName); if (summaryLists == null) { summaryLists = new ArrayList<InlineList>(); placedInlineLists.put(tagName, summaryLists); } summaryLists.add(list); } } } // any lists that aren't tagged will be 'unplaced' List<InlineList> unplacedInlineLists = new ArrayList<InlineList>(reportObject.getNormalInlineLists()); unplacedInlineLists.removeAll(placedInlineLists.values()); long now = System.currentTimeMillis(); LOG.info("TIME placed inline lists: " + (now - startTime) + "ms"); long stepTime = now; request.setAttribute("mapOfInlineLists", placedInlineLists); request.setAttribute("listOfUnplacedInlineLists", unplacedInlineLists); Map<String, Map<String, DisplayField>> placementRefsAndCollections = new TreeMap<String, Map<String, DisplayField>>(); Set<String> aspects = new LinkedHashSet<String>(SessionMethods.getCategories(servletContext)); Set<ClassDescriptor> cds = os.getModel().getClassDescriptorsForClass(requestedObject.getClass()); for (String aspect : aspects) { placementRefsAndCollections.put(TagNames.IM_ASPECT_PREFIX + aspect, new TreeMap<String, DisplayField>(String.CASE_INSENSITIVE_ORDER)); } Map<String, DisplayField> miscRefs = new TreeMap<String, DisplayField>( reportObject.getRefsAndCollections()); placementRefsAndCollections.put(TagNames.IM_ASPECT_MISC, miscRefs); // summary refs and colls Map<String, DisplayField> summaryRefsCols = new TreeMap<String, DisplayField>(); placementRefsAndCollections.put(TagNames.IM_SUMMARY, summaryRefsCols); for (Iterator<Entry<String, DisplayField>> iter = reportObject.getRefsAndCollections().entrySet() .iterator(); iter.hasNext();) { Map.Entry<String, DisplayField> entry = iter.next(); DisplayField df = entry.getValue(); if (df instanceof DisplayReference) { categoriseBasedOnTags(((DisplayReference) df).getDescriptor(), "reference", df, miscRefs, tm, superuser, placementRefsAndCollections, SessionMethods.isSuperUser(session)); } else if (df instanceof DisplayCollection) { categoriseBasedOnTags(((DisplayCollection) df).getDescriptor(), "collection", df, miscRefs, tm, superuser, placementRefsAndCollections, SessionMethods.isSuperUser(session)); } } // remove any fields overridden by displayers removeFieldsReplacedByReportDisplayers(reportObject, placementRefsAndCollections); request.setAttribute("placementRefsAndCollections", placementRefsAndCollections); String type = reportObject.getType(); request.setAttribute("objectType", type); String stableLink = PortalHelper.generatePortalLink(reportObject.getObject(), im, request); if (stableLink != null) { request.setAttribute("stableLink", stableLink); } stepTime = System.currentTimeMillis(); startTime = stepTime; // attach only non empty categories Set<String> allClasses = new HashSet<String>(); for (ClassDescriptor cld : cds) { allClasses.add(cld.getUnqualifiedName()); } TemplateManager templateManager = im.getTemplateManager(); Map<String, List<ReportDisplayer>> displayerMap = reportObject.getReportDisplayers(); stepTime = System.currentTimeMillis(); startTime = stepTime; List<String> categories = new LinkedList<String>(); for (String aspect : aspects) { // 1) Displayers // 2) Inline Lists if ((displayerMap != null && displayerMap.containsKey(aspect)) || placedInlineLists.containsKey(aspect)) { categories.add(aspect); } else { // 3) Templates if (!templateManager.getReportPageTemplatesForAspect(aspect, allClasses).isEmpty()) { categories.add(aspect); } else { // 4) References & Collections if (placementRefsAndCollections.containsKey("im:aspect:" + aspect) && placementRefsAndCollections.get("im:aspect:" + aspect) != null) { for (DisplayField df : placementRefsAndCollections.get("im:aspect:" + aspect) .values()) { categories.add(aspect); break; } } } } } if (!categories.isEmpty()) { request.setAttribute("categories", categories); } now = System.currentTimeMillis(); LOG.info("TIME made list of categories: " + (now - stepTime) + "ms"); } return null; }
From source file:org.apache.directory.fortress.core.impl.PsoUtil.java
/** * Return Set of {@link org.apache.directory.fortress.core.model.OrgUnit#name}s ascendants contained within {@link org.apache.directory.fortress.core.model.OrgUnit.Type#PERM}. * * @param ous contains list of {@link org.apache.directory.fortress.core.model.OrgUnit}s. * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com. * @return contains Set of all descendants. *///w w w.j ava 2 s .c o m static Set<String> getInherited(List<OrgUnit> ous, String contextId) { // create Set with case insensitive comparator: Set<String> iOUs = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (CollectionUtils.isNotEmpty(ous)) { for (OrgUnit ou : ous) { String name = ou.getName(); iOUs.add(name); Set<String> parents = HierUtil.getAscendants(name, getGraph(contextId)); if (CollectionUtils.isNotEmpty(parents)) { iOUs.addAll(parents); } } } return iOUs; }
From source file:eu.stratosphere.addons.visualization.swt.SWTFailureEventTable.java
public SWTFailureEventTable(final Composite parent, final int style, final Set<String> nameSuggestions) { super(parent, SWT.NONE); // Load images synchronized (SWTFailureEventTable.class) { if (TASK_ICON == null) { TASK_ICON = loadIcon("/eu/stratosphere/nephele/visualization/swt/taskicon.png"); }/*from w w w. j a va 2s . c o m*/ if (INSTANCE_ICON == null) { INSTANCE_ICON = loadIcon("/eu/stratosphere/nephele/visualization/swt/nodeicon.png"); } } this.nameSuggestions = nameSuggestions; setLayout(new FillLayout()); this.failureEventTable = new Table(this, style); this.failureEventTable.setHeaderVisible(true); this.failureEventTable.setLinesVisible(true); final TableColumn iconColumn = new TableColumn(this.failureEventTable, SWT.NONE); final TableColumn nameColumn = new TableColumn(this.failureEventTable, SWT.NONE); nameColumn.setText("Name"); final TableColumn intervalColumn = new TableColumn(this.failureEventTable, SWT.NONE); intervalColumn.setText("Interval"); for (int i = 0; i < this.failureEventTable.getColumnCount(); ++i) { if (i == 0) { this.failureEventTable.getColumn(i).setWidth(ICON_COLUMN_WIDTH); } else { this.failureEventTable.getColumn(i).setWidth(TEXT_COLUMN_WIDTH); } } // Implement listener to add and update events this.failureEventTable.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(final MouseEvent arg0) { final TableItem ti = failureEventTable.getItem(new Point(arg0.x, arg0.y)); if (selectedFailurePattern == null) { return; } addOrEditTableItem(ti); } }); // Implement sorting of columns final Listener sortListener = new Listener() { @Override public void handleEvent(final Event arg0) { final TableColumn sortColumn = failureEventTable.getSortColumn(); final TableColumn currentColumn = (TableColumn) arg0.widget; int dir = failureEventTable.getSortDirection(); if (sortColumn == currentColumn) { dir = (dir == SWT.UP) ? SWT.DOWN : SWT.UP; } else { failureEventTable.setSortColumn(currentColumn); dir = SWT.UP; } final int direction = dir; final AbstractFailureEvent[] failureEvents = new AbstractFailureEvent[failureEventTable .getItemCount()]; for (int i = 0; i < failureEventTable.getItemCount(); ++i) { failureEvents[i] = (AbstractFailureEvent) failureEventTable.getItem(i).getData(); } Arrays.sort(failureEvents, new Comparator<AbstractFailureEvent>() { @Override public int compare(final AbstractFailureEvent o1, AbstractFailureEvent o2) { if (o1 == null) { return -1; } if (o2 == null) { return 1; } if (currentColumn == iconColumn) { final int v1 = (o1 instanceof VertexFailureEvent) ? 0 : 1; final int v2 = (o2 instanceof VertexFailureEvent) ? 0 : 1; return (direction == SWT.UP) ? (v1 - v2) : (v2 - v1); } else if (currentColumn == nameColumn) { if (direction == SWT.UP) { return String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName()); } else { return String.CASE_INSENSITIVE_ORDER.compare(o2.getName(), o1.getName()); } } else { if (direction == SWT.UP) { return (o1.getInterval() - o2.getInterval()); } else { return (o2.getInterval() - o1.getInterval()); } } } }); failureEventTable.removeAll(); for (int i = 0; i < failureEvents.length; ++i) { updateTableItem(null, failureEvents[i]); } failureEventTable.setSortColumn(currentColumn); failureEventTable.setSortDirection(direction); } }; iconColumn.addListener(SWT.Selection, sortListener); nameColumn.addListener(SWT.Selection, sortListener); intervalColumn.addListener(SWT.Selection, sortListener); // Implement keyboard commands this.failureEventTable.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent arg0) { if (arg0.keyCode == SWT.DEL) { removeSelectedTableItems(); } else if (arg0.keyCode == SWT.CR) { addOrEditSelectedTableItems(); } } }); // Set the menu this.failureEventTable.setMenu(createTableContextMenu()); }
From source file:com.yahoo.elide.core.EntityBinding.java
/** * Convert a deque to a list.//from w ww. ja v a 2 s .co m * * @param deque Deque to convert * @return Deque as a list */ private static List<String> dequeToList(final Deque<String> deque) { ArrayList<String> result = new ArrayList<>(); deque.stream().forEachOrdered(result::add); result.sort(String.CASE_INSENSITIVE_ORDER); return Collections.unmodifiableList(result); }
From source file:org.usergrid.utils.MapUtils.java
/** * @param <A>//from w w w. j av a 2 s. co m * @param <B> * @param <C> * @param map * @param ignore_case * @param a * @param b * @param c */ @SuppressWarnings("unchecked") public static <A, B, C> void addMapMapList(Map<A, Map<B, List<C>>> map, boolean ignore_case, A a, B b, C c) { Map<B, List<C>> map_b = map.get(a); if (map_b == null) { if (ignore_case && (b instanceof String)) { map_b = (Map<B, List<C>>) new TreeMap<String, List<C>>(String.CASE_INSENSITIVE_ORDER); } else { map_b = new LinkedHashMap<B, List<C>>(); } map.put(a, map_b); } addMapList(map_b, b, c); }
From source file:ch.fixme.status.Main.java
private AlertDialog createHsDialog() { // Construct hackerspaces list try {/*from w w w.j av a 2 s .c om*/ JSONObject obj = new JSONObject(mResultDir); JSONArray arr = obj.names(); int len = obj.length(); String[] names = new String[len]; final ArrayList<String> url = new ArrayList<String>(len); for (int i = 0; i < len; i++) { names[i] = arr.getString(i); } Arrays.sort(names, 0, len, String.CASE_INSENSITIVE_ORDER); for (int i = 0; i < len; i++) { url.add(i, obj.getString(names[i])); } // Create the dialog AlertDialog.Builder builder = new AlertDialog.Builder(Main.this); builder.setTitle(R.string.choose_hs).setItems(names, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { setIntent(null); Editor edit = mPrefs.edit(); edit.putString(PREF_API_URL, url.get(which)); getApiTask = new GetApiTask(); getApiTask.execute(url.get(which)); edit.commit(); } }); return builder.create(); } catch (Exception e) { e.printStackTrace(); showError(e.getClass().getCanonicalName(), e.getLocalizedMessage() + getString(R.string.error_generic)); return null; } }