List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:org.ff4j.store.FeatureStoreSpringJdbc.java
/** {@inheritDoc} */ public Map<String, Feature> readAll() { LinkedHashMap<String, Feature> mapFP = new LinkedHashMap<String, Feature>(); List<Feature> lFp = getJdbcTemplate().query(getQueryBuilder().getAllFeatures(), FMAPPER); for (Feature flipPoint : lFp) { mapFP.put(flipPoint.getUid(), flipPoint); }/*from w w w. j av a 2 s.c om*/ // Populating Roles RoleRowMapper rrm = new RoleRowMapper(); getJdbcTemplate().query(getQueryBuilder().getAllRoles(), rrm); Map<String, Set<String>> roles = rrm.getRoles(); for (Map.Entry<String, Set<String>> featId : roles.entrySet()) { if (mapFP.containsKey(featId.getKey())) { mapFP.get(featId.getKey()).getPermissions().addAll(featId.getValue()); } } return mapFP; }
From source file:org.openmeetings.app.data.user.Organisationmanagement.java
/** * //from w w w . j a v a2 s . com * @param user_id * @param usersToStore * @return * @throws Exception */ private boolean checkUserShouldBeStored(Long user_id, @SuppressWarnings("rawtypes") LinkedHashMap usersToStore) throws Exception { for (Iterator<?> it2 = usersToStore.keySet().iterator(); it2.hasNext();) { Integer key = (Integer) it2.next(); Long usersIdToCheck = Long.valueOf(usersToStore.get(key).toString()).longValue(); log.debug("usersIdToCheck: " + usersIdToCheck); if (user_id.equals(usersIdToCheck)) { return true; } } return false; }
From source file:com.allinfinance.dwr.system.SelectOptionsDWR.java
/** * ??/* www . j ava 2s . c o m*/ * @param txnId * @return */ public String getComboData(String txnId, HttpServletRequest request, HttpServletResponse response) { String jsonData = "{data:[{'valueField':'','displayField':'?'}]}"; try { //?? Operator operator = (Operator) request.getSession().getAttribute(Constants.OPERATOR_INFO); LinkedHashMap<String, String> dataMap = SelectOption.getSelectView(txnId, new Object[] { operator }); Iterator<String> iter = dataMap.keySet().iterator(); if (iter.hasNext()) { Map<String, Object> jsonDataMap = new HashMap<String, Object>(); LinkedList<Object> jsonDataList = new LinkedList<Object>(); Map<String, String> tmpMap = null; String key = null; while (iter.hasNext()) { tmpMap = new LinkedHashMap<String, String>(); key = iter.next(); tmpMap.put("valueField", key); tmpMap.put("displayField", dataMap.get(key)); jsonDataList.add(tmpMap); } jsonDataMap.put("data", jsonDataList); jsonData = JSONBean.genMapToJSON(jsonDataMap); } } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } return jsonData; }
From source file:com.allinfinance.dwr.system.SelectOptionsDWR.java
/** * ??/*from w ww . j a v a 2s. c o m*/ * @param txnId * @param request * @param response * @return * 2010-8-18?11:36:58 */ public String getFuncAllData(String txnId, HttpServletRequest request, HttpServletResponse response) { String jsonData = "{data:[{'valueField':'','displayField':'?'}]}"; try { //?? Operator operator = (Operator) request.getSession().getAttribute(Constants.OPERATOR_INFO); LinkedHashMap<String, String> dataMap = SelectOption.getSelectView(txnId, new Object[] { operator }); Iterator<String> iter = dataMap.keySet().iterator(); if (iter.hasNext()) { Map<String, Object> jsonDataMap = new HashMap<String, Object>(); LinkedList<Object> jsonDataList = new LinkedList<Object>(); Map<String, String> tmpMap = null; String key = null; while (iter.hasNext()) { tmpMap = new LinkedHashMap<String, String>(); key = iter.next(); tmpMap.put("valueField", key); tmpMap.put("displayField", dataMap.get(key)); jsonDataList.add(tmpMap); } jsonDataMap.put("data", jsonDataList); jsonData = JSONBean.genMapToJSON(jsonDataMap); } } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } return jsonData; }
From source file:com.cloud.utils.db.SqlGenerator.java
protected List<Pair<String, Attribute[]>> buildDeleteSqls() { LinkedHashMap<String, ArrayList<Attribute>> map = new LinkedHashMap<String, ArrayList<Attribute>>(); for (Class<?> table : _tables) { map.put(DbUtil.getTableName(table), new ArrayList<Attribute>()); }/*from w w w.j a v a 2 s . com*/ for (Attribute attr : _attributes) { if (attr.isId()) { ArrayList<Attribute> attrs = map.get(attr.table); assert (attrs != null) : "Null set of attributes for " + attr.table; attrs.add(attr); } } List<Pair<String, Attribute[]>> sqls = new ArrayList<Pair<String, Attribute[]>>(map.size()); for (Map.Entry<String, ArrayList<Attribute>> entry : map.entrySet()) { ArrayList<Attribute> attrs = entry.getValue(); String sql = buildDeleteSql(entry.getKey(), attrs); Pair<String, Attribute[]> pair = new Pair<String, Attribute[]>(sql, attrs.toArray(new Attribute[attrs.size()])); sqls.add(pair); } Collections.reverse(sqls); return sqls; }
From source file:com.cloud.utils.db.SqlGenerator.java
public List<Pair<String, Attribute[]>> buildInsertSqls() { LinkedHashMap<String, ArrayList<Attribute>> map = new LinkedHashMap<String, ArrayList<Attribute>>(); for (Class<?> table : _tables) { map.put(DbUtil.getTableName(table), new ArrayList<Attribute>()); }//from w ww. ja va2 s. c om for (Attribute attr : _attributes) { if (attr.isInsertable()) { ArrayList<Attribute> attrs = map.get(attr.table); assert (attrs != null) : "Null set of attributes for " + attr.table; attrs.add(attr); } } List<Pair<String, Attribute[]>> sqls = new ArrayList<Pair<String, Attribute[]>>(map.size()); for (Map.Entry<String, ArrayList<Attribute>> entry : map.entrySet()) { ArrayList<Attribute> attrs = entry.getValue(); StringBuilder sql = buildInsertSql(entry.getKey(), attrs); Pair<String, Attribute[]> pair = new Pair<String, Attribute[]>(sql.toString(), attrs.toArray(new Attribute[attrs.size()])); sqls.add(pair); } return sqls; }
From source file:com.tacitknowledge.util.migration.DistributedMigrationProcess.java
/** * Execute a dry run of the rollback process and return a count of the * number of tasks which will rollback.// w w w . j ava 2 s . c o m * * @param rollbacks a <code>List</code> of RollbackableMigrationTasks * @param rollbacksWithLaunchers a <code>LinkedHashMap</code> of task to launcher * @return count of the number of rollbacks */ protected final int rollbackDryRun(final List rollbacks, final LinkedHashMap rollbacksWithLaunchers) { // take the list of rollbacks // iterate through the rollbacks // log the context in which each rollback will execute int taskCount = 0; if (isPatchSetRollbackable(rollbacks)) { for (Iterator i = rollbacks.iterator(); i.hasNext();) { RollbackableMigrationTask task = (RollbackableMigrationTask) i.next(); log.info("Will execute rollback for task '" + task.getName() + "'"); taskCount++; JdbcMigrationLauncher launcher = (JdbcMigrationLauncher) rollbacksWithLaunchers.get(task); for (Iterator contextIterator = launcher.getContexts().keySet().iterator(); contextIterator .hasNext();) { MigrationContext context = (MigrationContext) contextIterator.next(); log.debug("Task will execute in context '" + context + "'"); } } } return taskCount; }
From source file:com.opengamma.analytics.financial.interestrate.capletstripping.CapletStrippingJacobian.java
public CapletStrippingJacobian(final List<CapFloor> caps, final YieldCurveBundle yieldCurves, final LinkedHashMap<String, double[]> knotPoints, final LinkedHashMap<String, Interpolator1D> interpolators, final LinkedHashMap<String, ParameterLimitsTransform> parameterTransforms, final LinkedHashMap<String, InterpolatedDoublesCurve> knownParameterTermSturctures) { Validate.notNull(caps, "caps null"); Validate.notNull(knotPoints, "null node points"); Validate.notNull(interpolators, "null interpolators"); Validate.isTrue(knotPoints.size() == interpolators.size(), "size mismatch between nodes and interpolators"); _knownParameterTermSturctures = knownParameterTermSturctures; final LinkedHashMap<String, Interpolator1D> transInterpolators = new LinkedHashMap<>(); final Set<String> names = interpolators.keySet(); _parameterNames = names;//ww w . j a v a 2 s . co m for (final String name : names) { final Interpolator1D temp = new TransformedInterpolator1D(interpolators.get(name), parameterTransforms.get(name)); transInterpolators.put(name, temp); } _capPricers = new ArrayList<>(caps.size()); for (final CapFloor cap : caps) { _capPricers.add(new CapFloorPricer(cap, yieldCurves)); } _interpolators = transInterpolators; _curveBuilder = new InterpolatedCurveBuildingFunction(knotPoints, transInterpolators); _dataBundleBuilder = new Interpolator1DDataBundleBuilderFunction(knotPoints, transInterpolators); }
From source file:com.joey.software.Launcher.microneedleAnalysis.DataAnalysisViewer.java
public XYSeriesCollection getAllFingerData() { XYSeriesCollection collection = new XYSeriesCollection(); LinkedHashMap<String, XYSeries> skinData = new LinkedHashMap<String, XYSeries>(); LinkedHashMap<String, XYSeries> poreData = new LinkedHashMap<String, XYSeries>(); LinkedHashMap<String, XYSeries> poreSkinData = new LinkedHashMap<String, XYSeries>(); LinkedHashMap<String, XYSeries> totalData = new LinkedHashMap<String, XYSeries>(); ArrayList<MeasurmentData> measureData = owner.measures; for (MeasurmentData measure : measureData) { if (validMeasurment(measure)) { String key = MicroNeedleAnalysis.clearLabel(measure.view, "abcdefghijklmnopqrstuvwxyz0123456789"); XYSeries skin = skinData.get(key); XYSeries pore = poreData.get(key); XYSeries poreSkin = poreSkinData.get(key); XYSeries total = totalData.get(key); if (skin == null) { skin = new XYSeries(key + " Skin"); skinData.put(key, skin); }/*from ww w . j a va 2 s . co m*/ if (pore == null) { pore = new XYSeries(key + " Pore"); poreData.put(key, pore); } if (poreSkin == null) { poreSkin = new XYSeries(key + " Pore Skin"); poreSkinData.put(key, poreSkin); } if (total == null) { total = new XYSeries(key + " Total"); totalData.put(key, total); } int time; try { time = Integer.parseInt(MicroNeedleAnalysis.clearLabel(measure.exp, "0123456789")); } catch (Exception e) { time = -10; } skin.add(time, measure.skinDim.getValue()); pore.add(time, measure.poreDim.getValue()); poreSkin.add(time, measure.skinPoreDim.getValue()); total.add(time, (measure.poreDim.getValue() + measure.skinPoreDim.getValue())); } } String[] keys = skinData.keySet().toArray(new String[0]); for (String key : keys) { XYSeries skin = skinData.get(key); XYSeries pore = poreData.get(key); XYSeries poreSkin = poreSkinData.get(key); XYSeries total = totalData.get(key); if (useSkin.isSelected()) { collection.addSeries(skin); } if (usePore.isSelected()) { collection.addSeries(pore); } if (usePoreSkin.isSelected()) { collection.addSeries(poreSkin); } if (useTotal.isSelected()) { collection.addSeries(total); } } return collection; }
From source file:de.ipk_gatersleben.ag_pbi.mmd.visualisations.gradient.GradientDataChartComponent.java
private IntervalXYDataset createDataSet(SubstanceInterface xmldata, ChartOptions co) { YIntervalSeriesCollection dataset = new YIntervalSeriesCollection(); LinkedHashMap<String, ArrayList<NumericMeasurementInterface>> name2measurement = new LinkedHashMap<String, ArrayList<NumericMeasurementInterface>>(); for (NumericMeasurementInterface m : Substance3D.getAllFiles(new Experiment(xmldata))) { SampleInterface s = m.getParentSample(); String name = s.getParentCondition().getExpAndConditionName() + ", " + ((Sample3D) s).getName(); if (!name2measurement.containsKey(name)) name2measurement.put(name, new ArrayList<NumericMeasurementInterface>()); name2measurement.get(name).add(m); co.rangeAxis = (co.rangeAxis != null && co.rangeAxis.equals("[unit]")) ? m.getUnit() : co.rangeAxis; co.domainAxis = co.domainAxis != null && co.domainAxis.equals("[unit]") ? ((NumericMeasurement3D) m).getPositionUnit() : co.domainAxis;//from w w w . j ava2 s .c om } for (String name : name2measurement.keySet()) { YIntervalSeries gradientvalues = new YIntervalSeries(name); ArrayList<NumericMeasurementInterface> measurements = name2measurement.get(name); if (measurements != null && measurements.size() > 0) { // calculate on the fly the mean value by putting together // measurements with the same position but different replicateID HashMap<Double, ArrayList<NumericMeasurementInterface>> position2measurement = new HashMap<Double, ArrayList<NumericMeasurementInterface>>(); for (NumericMeasurementInterface m : measurements) { Double position = ((NumericMeasurement3D) m).getPosition(); if (position != null) { if (!position2measurement.containsKey(position)) position2measurement.put(position, new ArrayList<NumericMeasurementInterface>()); position2measurement.get(position).add(m); } } for (Double pos : position2measurement.keySet()) { double sum = 0; int cnt = 0; for (NumericMeasurementInterface m : position2measurement.get(pos)) { sum += m.getValue(); cnt++; } if (cnt != 0) { double mean = (1d * sum) / (1d * cnt); double stddev = 0d; for (NumericMeasurementInterface m : position2measurement.get(pos)) stddev += Math.pow(m.getValue() - mean, 2); stddev = Math.sqrt(stddev); if (stddev < 0) stddev = 0; gradientvalues.add(pos * 1d, mean, mean - stddev, mean + stddev); } } } dataset.addSeries(gradientvalues); } return dataset; }