List of usage examples for org.apache.commons.collections.map CaseInsensitiveMap CaseInsensitiveMap
public CaseInsensitiveMap()
From source file:edu.scripps.fl.pubchem.xml.extract.XMLExtractor.java
public Map<Integer, String> getColumnsMap(TableModel tableModel) { Map<Integer, String> map = new CaseInsensitiveMap(); for (int ii = 0; ii < tableModel.getColumnCount(); ii++) { String name = tableModel.getColumnName(ii); if (null != name) { // excel sometimes adds null columns name = name.replaceAll("[-\\s+]", ""); map.put(ii, name);/*from w w w .jav a2s .com*/ } } return map; }
From source file:MapHeavenV1.java
private void createMaps() { cIMap = new CaseInsensitiveMap(); identMap = new IdentityMap(); lazyMap = LazyMap.decorate(new HashMap(), FactoryUtils.instantiateFactory(StringBuffer.class)); }
From source file:easycare.cuke.pageObjects.patient.PatientPhysicianSearchResultPage.java
public List<Map<String, String>> extractPhysicians() { List<Map<String, String>> physicians = new ArrayList<>(); List<WebElement> physicianOrgTableList = findElementsByCssSelector("table.physicianOrg"); for (WebElement physicianOrgTable : physicianOrgTableList) { String organisation = physicianOrgTable.findElement(By.cssSelector("th.orgName")).getText(); List<WebElement> physicianRowList = physicianOrgTable.findElements(By.cssSelector("tbody > tr")); for (WebElement physicianRow : physicianRowList) { @SuppressWarnings("unchecked") Map<String, String> physician = new CaseInsensitiveMap(); physician.put("physician name", getElementTextByCss(physicianRow, "td.physicianName")); // cannot use getElementTextByCss here as license number could // be blank String licenseNumber = physicianRow.findElement(By.cssSelector("td.license")).getText(); if (StringUtils.isBlank(licenseNumber)) { licenseNumber = "<BLANK>"; }// w w w .j a va 2s.c o m physician.put("license number", licenseNumber); physician.put("address", getElementTextByCss(physicianRow, "td.address")); physician.put("organisation", organisation); physicians.add(physician); } } return physicians; }
From source file:net.certifi.audittablegen.TableConfig.java
TableConfig(String tableName) { excludedColumns = new CaseInsensitiveMap(); includedColumns = new CaseInsensitiveMap(); this.tableName = tableName; columns = new CaseInsensitiveMap(); }
From source file:com.livinglogic.dbutils.ResultSetMapIterator.java
private void fetch() { try {/*from ww w .ja v a 2s.c o m*/ if (resultSet.next()) { Map<String, Object> record = new CaseInsensitiveMap(); for (int i = 1; i <= numberOfColumns; ++i) { String key = metaData.getColumnLabel(i); int type = metaData.getColumnType(i); Object value; if (type == DATE) value = resultSet.getDate(i); else if (type == TIMESTAMP // Don't use the constants from oracle.jdbc.OracleTypes, so that we don't require ojdbc.jar || type == -102 // oracle.jdbc.OracleTypes.TIMESTAMPLTZ || type == -100 // oracle.jdbc.OracleTypes.TIMESTAMPNS || type == -101) // oracle.jdbc.OracleTypes.TIMESTAMPTZ value = resultSet.getTimestamp(i); else { value = resultSet.getObject(i); if (value instanceof Clob) { String stringValue = ((Clob) value).getSubString(1L, (int) ((Clob) value).length()); try { ((Clob) value).free(); } catch (SQLException ex) { } value = stringValue; } else if (value instanceof BigDecimal) value = Utils.narrowBigDecimal((BigDecimal) value); else if (value instanceof BigInteger) value = Utils.narrowBigInteger((BigInteger) value); } record.put(key, value); } nextRecord = record; } else { nextRecord = null; resultSet.close(); } } catch (Exception ex) { throw new RuntimeException(ex); } }
From source file:io.lightlink.dao.mapping.BeanMapper.java
public BeanMapper(Class paramClass, List<String> fieldsOfLine) { PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(paramClass); descriptorMap = new CaseInsensitiveMap(); for (PropertyDescriptor descriptor : descriptors) { descriptorMap.put(normalizePropertyName(descriptor.getName()), descriptor); }// w ww. jav a 2 s . c o m List<String> ownFields = new ArrayList<String>(); Map<String, List<String>> fieldsByChild = new CaseInsensitiveMap(); groupFields(fieldsOfLine, ownFields, fieldsByChild); this.ownFields = ownFields; for (Map.Entry<String, List<String>> entry : fieldsByChild.entrySet()) { String childProperty = normalizePropertyName(entry.getKey()); PropertyDescriptor descriptor = descriptorMap.get(childProperty); if (descriptor != null) { List<String> properties = entry.getValue(); if (descriptor.getPropertyType().isAssignableFrom(ArrayList.class)) { Type[] typeArguments = ((ParameterizedType) descriptor.getReadMethod().getGenericReturnType()) .getActualTypeArguments(); if (typeArguments.length == 0) throw new RuntimeException("Cannot define Generic list type of " + entry.getKey() + " property of " + paramClass); Type firstType = typeArguments[0]; if (firstType instanceof Class) { childListMappers.put(childProperty, new BeanMapper((Class) firstType, properties)); } } else { childMappers.put(childProperty, new BeanMapper(descriptor.getPropertyType(), properties)); } } else { throw new RuntimeException( "cannot define mapping for class:" + paramClass.getName() + " property:" + childProperty); } } this.paramClass = paramClass; }
From source file:com.timtripcony.AbstractMapModel.java
/** * Retrieves a Map of all Items within the Document. Extended by PW to use CaseInsensitiveMap. <br/> * This allows the code to deal with existing Documents or fields set via LotusScript, were the case of the Item * name may be unreliable/*from w ww.j a va 2 s.c o m*/ * * @return Map<Object,Object> Key=Item name, Value=Item value(s) */ @SuppressWarnings("unchecked") public Map<Object, Object> getValues() { if (values == null) { values = new CaseInsensitiveMap(); } return values; }
From source file:net.certifi.audittablegen.ChangeSourceFactory.java
ChangeSourceFactory(ConfigSource configSource) { this.configSource = configSource; auditTablesMap = new CaseInsensitiveMap(); baseTableMap = new CaseInsensitiveMap(); baseTableList = new ArrayList<>(); for (ConfigAttribute attrib : configSource.dbAttribs) { switch (attrib.getType()) { case tableprefix: tablePrefix = attrib.getValue(); break; case tablepostfix: tablePostfix = attrib.getValue(); break; case columnprefix: columnPrefix = attrib.getValue(); break; case columnpostfix: columnPostfix = attrib.getValue(); break; case iddatatype: auditIdTypeName = attrib.getValue(); case userdatatype: auditUserTypeName = attrib.getValue(); break; case timestampdatatype: auditTimeStampTypeName = attrib.getValue(); break; case actiondatatype: auditActionTypeName = attrib.getValue(); break; case sessionusersql: sessionUserSQL = attrib.getValue(); break; case sessionuserdatatype: sessionUserTypeName = attrib.getValue(); break; case sessionuserdatasize: sessionUserDataSize = attrib.getIntValue(); break; default://from w w w.j av a 2s . co m break; } } for (TableDef td : configSource.allTables) { String tableName = td.getName(); if (tableName.toLowerCase().startsWith(tablePrefix.toLowerCase()) && tableName.toLowerCase().endsWith(tablePostfix.toLowerCase())) { //matches audit table pattern auditTablesMap.put(tableName, td); } else { baseTableList.add(td); baseTableMap.put(tableName, td); } } }
From source file:edu.scripps.fl.pubchem.xml.PopulateArray.java
public Map<String, Integer> getColumnsMap(TableModel tableModel) { Map<String, Integer> map = new CaseInsensitiveMap(); for (int ii = 0; ii < tableModel.getColumnCount(); ii++) { String name = tableModel.getColumnName(ii); if (null != name) { // excel sometimes adds null columns name = name.replaceAll("[-\\s+]", ""); map.put(name, ii);// w w w . ja va 2 s.c o m } } return map; }
From source file:net.certifi.audittablegen.PostgresqlDMR.java
/** * Get List of ColumnDef objects for all tables * in the targeted database/schema. Postgres specific code replaces * 'serial' date type with integer, because the column in the audit table * must be of type integer and not serial. Since this data is interpreted * by ChangeSourceFactory, which should be database independent, the * translation needs to be in the DMR.//from www. jav a 2 s . c o m * * @param tableName * @return ArrayList of ColumnDef objects or an empty list if none are found. */ @Override public List getColumns(String tableName) { //getDataTypes will initialize the map if it isn't already loaded Map<String, DataTypeDef> dtds = getDataTypes(); List columns = new ArrayList<>(); try { Connection conn = dataSource.getConnection(); DatabaseMetaData dmd = conn.getMetaData(); ResultSet rs = dmd.getColumns(null, verifiedSchema, tableName, null); //load all of the metadata in the result set into a map for each column ResultSetMetaData rsmd = rs.getMetaData(); int metaDataColumnCount = rsmd.getColumnCount(); if (!rs.isBeforeFirst()) { throw new RuntimeException( "No results for DatabaseMetaData.getColumns(" + verifiedSchema + "." + tableName + ")"); } while (rs.next()) { ColumnDef columnDef = new ColumnDef(); Map columnMetaData = new CaseInsensitiveMap(); for (int i = 1; i <= metaDataColumnCount; i++) { columnMetaData.put(rsmd.getColumnName(i), rs.getString(i)); } columnDef.setName(rs.getString("COLUMN_NAME")); String type_name = rs.getString("TYPE_NAME"); if (type_name.equalsIgnoreCase("serial")) { columnDef.setTypeName("int4"); } else { columnDef.setTypeName(type_name); } columnDef.setSqlType(rs.getInt("DATA_TYPE")); columnDef.setSize(rs.getInt("COLUMN_SIZE")); columnDef.setDecimalSize(rs.getInt("DECIMAL_DIGITS")); columnDef.setSourceMeta(columnMetaData); if (dtds.containsKey(columnDef.getTypeName())) { columnDef.setDataTypeDef(dtds.get(columnDef.getTypeName())); } else { throw new RuntimeException( "Missing DATA_TYPE definition for data type " + columnDef.getTypeName()); } columns.add(columnDef); } } catch (SQLException e) { throw Throwables.propagate(e); } return columns; }