List of usage examples for java.util LinkedHashSet LinkedHashSet
public LinkedHashSet()
From source file:com.adaptris.mail.ApacheMailClient.java
@Override public void connectLocal() throws MailException { try {/* w w w . ja va2s .com*/ pop3 = createClient(); clientConfig.preConnectConfigure(pop3); pop3.connect(mailboxUrl.getHost(), mailboxUrl.getPort()); postConnectAction(pop3); clientConfig.postConnectConfigure(pop3); if (!pop3.login(mailboxUrl.getUsername(), mailboxUrl.getPassword())) { throw new Exception("Could not login to server, check username/password."); } } catch (Exception e) { disconnectLocal(); throw wrapException(e); } finally { collectedMessages = new HashMap<>(); messagesToDelete = new LinkedHashSet<>(); } }
From source file:com.examples.with.different.packagename.ClassHierarchyIncludingInterfaces.java
public static Iterable<Class<?>> hierarchy(final Class<?> type, final Interfaces interfacesBehavior) { final Iterable<Class<?>> classes = new Iterable<Class<?>>() { @Override// w w w . java 2 s . c om public Iterator<Class<?>> iterator() { final MutableObject<Class<?>> next = new MutableObject<Class<?>>(type); return new Iterator<Class<?>>() { @Override public boolean hasNext() { return next.getValue() != null; } @Override public Class<?> next() { final Class<?> result = next.getValue(); next.setValue(result.getSuperclass()); return result; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; if (interfacesBehavior != Interfaces.INCLUDE) { return classes; } return new Iterable<Class<?>>() { @Override public Iterator<Class<?>> iterator() { final Set<Class<?>> seenInterfaces = new HashSet<Class<?>>(); final Iterator<Class<?>> wrapped = classes.iterator(); return new Iterator<Class<?>>() { Iterator<Class<?>> interfaces = Collections.<Class<?>>emptySet().iterator(); @Override public boolean hasNext() { return interfaces.hasNext() || wrapped.hasNext(); } @Override public Class<?> next() { if (interfaces.hasNext()) { final Class<?> nextInterface = interfaces.next(); seenInterfaces.add(nextInterface); return nextInterface; } final Class<?> nextSuperclass = wrapped.next(); final Set<Class<?>> currentInterfaces = new LinkedHashSet<Class<?>>(); walkInterfaces(currentInterfaces, nextSuperclass); interfaces = currentInterfaces.iterator(); return nextSuperclass; } private void walkInterfaces(final Set<Class<?>> addTo, final Class<?> c) { for (final Class<?> iface : c.getInterfaces()) { if (!seenInterfaces.contains(iface)) { addTo.add(iface); } walkInterfaces(addTo, iface); } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }
From source file:com.conversantmedia.mapreduce.tool.annotation.handler.MaraAnnotationUtil.java
public void registerAnnotationHandler(MaraAnnotationHandler handler, AnnotatedTool driver) throws ToolException { if (this.annotationHandlers == null) { // retain order to ensure default handlers, added last, run last. this.annotationHandlers = new LinkedHashSet<>(); }/*from w w w . j a v a 2 s . c o m*/ this.annotationHandlers.add(handler); handler.initialize(driver); }
From source file:org.openmrs.module.chartsearch.web.controller.SettingsFormController.java
/** * @return/* ww w .ja va 2 s. c o m*/ */ @ModelAttribute("globalPropertiesModel") public PropertiesModel getModel() { List<GlobalProperty> editableProps = new ArrayList<GlobalProperty>(); Set<String> props = new LinkedHashSet<String>(); props.add(ChartSearchMainProperties.USE_DEDICATED_SOLR_SERVER); props.add(ChartSearchMainProperties.DEDICATED_SOLR_SERVER_URL); //remove the properties we dont want to edit for (GlobalProperty gp : Context.getAdministrationService() .getGlobalPropertiesByPrefix(ChartSearchMainProperties.MODULE_ID)) { if (props.contains(gp.getProperty())) editableProps.add(gp); } return new PropertiesModel(editableProps); }
From source file:com.boundary.sdk.snmp.metric.PollerEntry.java
public List<Long> getOidListIds() { Set<Long> ids = new LinkedHashSet<Long>(); for (OidMapListRef ref : oidLists) { if (ref.isEnabled()) { ids.add(ref.getId());// w w w . j a v a2 s . com } } ArrayList<Long> list = new ArrayList<Long>(); list.addAll(ids); return list; }
From source file:com.phoenixnap.oss.ramlapisync.verification.checkers.ActionQueryParameterChecker.java
@Override public Pair<Set<Issue>, Set<Issue>> check(ActionType name, Action reference, Action target, IssueLocation location, IssueSeverity maxSeverity) { logger.debug("Checking Action " + name); Set<Issue> errors = new LinkedHashSet<>(); Set<Issue> warnings = new LinkedHashSet<>(); //Resource (and all children) missing - Log it Issue issue;// w ww . j a v a 2 s . c o m if (reference.getQueryParameters() != null && !reference.getQueryParameters().isEmpty()) { for (Entry<String, QueryParameter> cParam : reference.getQueryParameters().entrySet()) { logger.debug("ActionQueryParameterChecker Checking param " + cParam.getKey()); IssueSeverity targetSeverity = maxSeverity; if (target.getQueryParameters() == null || target.getQueryParameters().isEmpty() || !target.getQueryParameters().containsKey(cParam.getKey())) { //we have a missing param, in case of required parameters this could break - upgrade severity if (!cParam.getValue().isRequired()) { targetSeverity = IssueSeverity.WARNING; //downgrade to warning for non required parameters } else { targetSeverity = IssueSeverity.ERROR; } //lets check if they are defined as form parameters since spring does not distinguish this. Do so only if we are checking the contract Map<String, MimeType> targetBody = target.getBody(); if (location == IssueLocation.SOURCE && targetBody != null && targetBody.containsKey(MediaType.APPLICATION_FORM_URLENCODED_VALUE) && targetBody.get(MediaType.APPLICATION_FORM_URLENCODED_VALUE) != null && targetBody.get(MediaType.APPLICATION_FORM_URLENCODED_VALUE) .getFormParameters() != null && targetBody.get(MediaType.APPLICATION_FORM_URLENCODED_VALUE).getFormParameters() .containsKey(cParam.getKey()) && ResourceParser.doesActionTypeSupportRequestBody(reference.getType())) { issue = new Issue(IssueSeverity.WARNING, location, IssueType.MISSING, QUERY_PARAMETER_FOUND_IN_FORM, reference.getResource(), reference, cParam.getKey()); } else { issue = new Issue(targetSeverity, location, IssueType.MISSING, QUERY_PARAMETER_MISSING, reference.getResource(), reference, cParam.getKey()); } RamlCheckerResourceVisitorCoordinator.addIssue(errors, warnings, issue, issue.getDescription() + " " + cParam.getKey() + " in " + location.name()); } else { QueryParameter referenceParameter = cParam.getValue(); QueryParameter targetParameter = target.getQueryParameters().get(cParam.getKey()); if (referenceParameter.isRequired() == false && targetParameter.isRequired()) { issue = new Issue(maxSeverity, location, IssueType.DIFFERENT, REQUIRED_PARAM_HIDDEN, reference.getResource(), reference, cParam.getKey()); RamlCheckerResourceVisitorCoordinator.addIssue(errors, warnings, issue, REQUIRED_PARAM_HIDDEN + " " + cParam.getKey() + " in " + location.name()); } if (referenceParameter.getType() != null && !referenceParameter.getType().equals(targetParameter.getType())) { issue = new Issue(IssueSeverity.WARNING, location, IssueType.DIFFERENT, INCOMPATIBLE_TYPES, reference.getResource(), reference, cParam.getKey()); RamlCheckerResourceVisitorCoordinator.addIssue(errors, warnings, issue, INCOMPATIBLE_TYPES + " " + cParam.getKey() + " in " + location.name()); } if ((referenceParameter.getMinLength() != null && !referenceParameter.getMinLength().equals(targetParameter.getMinLength())) || (referenceParameter.getMaxLength() != null && !referenceParameter.getMaxLength().equals(targetParameter.getMaxLength())) || (referenceParameter.getMaximum() != null && !referenceParameter.getMaximum().equals(targetParameter.getMaximum())) || (referenceParameter.getMinimum() != null && !referenceParameter.getMinimum().equals(targetParameter.getMinimum())) || (referenceParameter.getPattern() != null && !referenceParameter.getPattern().equals(targetParameter.getPattern()))) { issue = new Issue(IssueSeverity.WARNING, location, IssueType.DIFFERENT, INCOMPATIBLE_VALIDATION, reference.getResource(), reference, cParam.getKey()); RamlCheckerResourceVisitorCoordinator.addIssue(errors, warnings, issue, INCOMPATIBLE_VALIDATION + " " + cParam.getKey() + " in " + location.name()); } } } } return new Pair<>(warnings, errors); }
From source file:net.sf.dynamicreports.design.transformation.chartcustomizer.GroupedStackedBarRendererCustomizer.java
@Override public void customize(JFreeChart chart, ReportParameters reportParameters) { this.seriesColors = new LinkedHashMap<String, Paint>(); this.map = null; Set<String> groups = new LinkedHashSet<String>(); CategoryDataset dataset = chart.getCategoryPlot().getDataset(); for (int i = 0; i < dataset.getRowCount(); i++) { String rowKey = (String) dataset.getRowKey(i); String group = StringUtils.substringBefore(rowKey, GROUP_SERIES_KEY); String series = StringUtils.substringAfter(rowKey, GROUP_SERIES_KEY); if (map == null) { map = new KeyToGroupMap(group); }// w w w . j a v a2 s . co m map.mapKeyToGroup(rowKey, group); groups.add(group); if (!seriesColors.containsKey(series)) { Paint paint = chart.getCategoryPlot().getDrawingSupplier().getNextPaint(); seriesColors.put(series, paint); } } DefaultCategoryDataset newDataset = new DefaultCategoryDataset(); for (Object column : dataset.getColumnKeys()) { for (String group : groups) { for (String series : seriesColors.keySet()) { try { Number value = dataset.getValue(group + GROUP_SERIES_KEY + series, (Comparable<?>) column); newDataset.addValue(value, group + GROUP_SERIES_KEY + series, (Comparable<?>) column); } catch (UnknownKeyException e) { newDataset.addValue(0, group + GROUP_SERIES_KEY + series, (Comparable<?>) column); } } } } dataset = newDataset; GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer(); renderer.setSeriesToGroupMap(map); StackedBarRenderer categoryRenderer = (StackedBarRenderer) chart.getCategoryPlot().getRenderer(); renderer.setBaseItemLabelsVisible(categoryRenderer.getBaseItemLabelsVisible()); renderer.setBaseItemLabelFont(categoryRenderer.getBaseItemLabelFont()); renderer.setBaseItemLabelPaint(categoryRenderer.getBaseItemLabelPaint()); renderer.setBaseItemLabelGenerator(categoryRenderer.getBaseItemLabelGenerator()); renderer.setShadowVisible(categoryRenderer.getShadowsVisible()); renderer.setItemMargin(0.10); renderer.setDrawBarOutline(false); for (int i = 0; i < dataset.getRowCount(); i++) { String rowKey = (String) dataset.getRowKey(i); String score = StringUtils.substringAfter(rowKey, GROUP_SERIES_KEY); renderer.setSeriesPaint(i, seriesColors.get(score)); } CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis(); SubCategoryAxis newDomainAxis = new SubCategoryAxis(domainAxis.getLabel()); newDomainAxis.setLabelFont(domainAxis.getLabelFont()); newDomainAxis.setTickLabelFont(domainAxis.getTickLabelFont()); newDomainAxis.setLabelPaint(domainAxis.getLabelPaint()); newDomainAxis.setTickLabelPaint(domainAxis.getTickLabelPaint()); newDomainAxis.setAxisLinePaint(domainAxis.getAxisLinePaint()); newDomainAxis.setTickMarkPaint(domainAxis.getTickMarkPaint()); newDomainAxis.setTickLabelsVisible(domainAxis.isTickLabelsVisible()); newDomainAxis.setTickMarksVisible(domainAxis.isTickMarksVisible()); newDomainAxis.setCategoryMargin(0.05); for (String group : groups) { newDomainAxis.addSubCategory(group); } CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainAxis(newDomainAxis); plot.setRenderer(renderer); LegendItemCollection legendItems = new LegendItemCollection(); for (String item : seriesColors.keySet()) { legendItems.add(new LegendItem(item, seriesColors.get(item))); } plot.setFixedLegendItems(legendItems); chart.getCategoryPlot().setDataset(dataset); }
From source file:hr.fer.zemris.vhdllab.service.hierarchy.HierarchyNode.java
public HierarchyNode(File file, HierarchyNode parent) { Validate.notNull(file, "File can't be null"); this.file = EntityUtils.lightweightClone(file); this.dependencies = new LinkedHashSet<File>(); this.missingDependencies = new LinkedHashSet<String>(); this.parent = parent; if (this.parent != null) { this.parent.addDependency(this); }/* www . j a va 2 s . co m*/ }
From source file:de.hybris.platform.addonsupport.setup.populator.SupportedUiExperienceImpexMacroParameterPopulator.java
protected List<UiExperienceLevel> getSupportedUiExperienceLevels() { final String[] levelsAsString = StringUtils.split(getSiteConfigService() .getString("storefront.supportedUiExperienceLevels", UiExperienceLevel.DESKTOP.getCode()), ","); final Set<UiExperienceLevel> levels = new LinkedHashSet<UiExperienceLevel>(); for (int i = 0; i < levelsAsString.length; i++) { final UiExperienceLevel level = UiExperienceLevel.valueOf(levelsAsString[i]); levels.add(level);//from w ww . jav a 2 s. co m } return new ArrayList<UiExperienceLevel>(levels); }
From source file:com.springsource.hq.plugin.tcserver.plugin.serverconfig.environment.UnixFileReadingEnvironmentFactory.java
/** * Scan the setenv.sh file one time, gathering a symbol table built out of "variable=value" lines. Then look for two * important values: JAVA_HOME and JVM_OPTS. */// w w w . j a v a2 s . c o m public Environment create(ConfigResponse config) throws PluginException { try { Environment environment = new Environment(); if (new File(Metric.decode(config.getValue("installpath")) + "/bin/setenv.sh").exists()) { String envFile = Metric.decode(config.getValue("installpath")) + "/bin/setenv.sh"; Map<String, String[]> symbolTable = extractPropertyMapping(envFile); Set<String> jvmOptsValues = new LinkedHashSet<String>(); expandValue(symbolTable, "JVM_OPTS", jvmOptsValues); JvmOptions combJvmOptions = jvmOptionsConverter.convert(new ArrayList<String>(jvmOptsValues)); environment.setJvmOptions(combJvmOptions); Set<String> javaHome = new LinkedHashSet<String>(); expandValue(symbolTable, "JAVA_HOME", javaHome); environment.setJavaHome(collectionToSpaceDelimitedString(javaHome)); } return environment; } catch (IOException e2) { for (StackTraceElement elem : e2.getStackTrace()) { log.info(elem.toString()); } throw new PluginException( "Unable to read existing tc Runtime configuration. Cause: " + e2.getMessage()); } catch (Exception e) { log.error("Received " + e.getMessage()); e.printStackTrace(); throw new PluginException( "Unable to read existing tc Runtime configuration. Cause: " + e.getMessage()); } }