Populate column and super column maps.

@param m
the m
@param columnNameToFieldMap
the column name to field map
@param superColumnNameToFieldMap
the super column name to field map
770194
public static void populateColumnAndSuperColumnMaps(EntityMetadata m, Map<String, Field> columnNameToFieldMap,
            Map<String, Field> superColumnNameToFieldMap, final KunderaMetadata kunderaMetadata)
    {

        getEmbeddableType(m, columnNameToFieldMap, superColumnNameToFieldMap, kunderaMetadata);
    }
373906
public Map<String, Metamodel> getMetamodelMap()
    {
        if (metamodelMap == null)
        {
            metamodelMap = new HashMap<String, Metamodel>();
        }
        return metamodelMap;
    }
1114168
public static int[][] getDomainMapping(String colName, String[] modelDom, String[] colDom, boolean logNonExactMapping) {
    int emap[] = new int[modelDom.length];
    boolean bmap[] = new boolean[modelDom.length];
    HashMap<String,Integer> md = new HashMap<String, Integer>((int) ((colDom.length/0.75f)+1));
    for( int i = 0; i < colDom.length; i++) md.put(colDom[i], i);
    for( int i = 0; i < modelDom.length; i++) {
      Integer I = md.get(modelDom[i]);
      if (I == null && logNonExactMapping)
        Log.warn(Sys.SCORM, "Domain mapping: target domain contains the factor '"+modelDom[i]+"' which DOES NOT appear in input domain " + (colName!=null?"(column: " + colName+")":""));
      if (I!=null) {
        emap[i] = I;
        bmap[i] = true;
      }
    }
    if (logNonExactMapping) { // Inform about additional values in column domain which do not appear in model domain
      for (int i=0; i<colDom.length; i++) {
        boolean found = false;
        for (int j=0; j<emap.length; j++)
          if (emap[j]==i) { found=true; break; }
        if (!found)
          Log.warn(Sys.SCORM, "Domain mapping: target domain DOES NOT contain the factor '"+colDom[i]+"' which appears in input domain "+ (colName!=null?"(column: " + colName+")":""));
      }
    }

    // produce packed values
    int[][] res = Utils.pack(emap, bmap);
    // Sort values in numeric order to support binary search in TransfVec
    Utils.sortWith(res[0], res[1]);
    return res;
  }
949878
private List<Map<String, Object>> getColumnsToOutput(EntityMetadata m, KunderaQuery kunderaQuery)
    {
        if (kunderaQuery.isSelectStatement())
        {
            SelectStatement selectStatement = kunderaQuery.getSelectStatement();
            SelectClause selectClause = (SelectClause) selectStatement.getSelectClause();
            return KunderaQueryUtils.readSelectClause(selectClause.getSelectExpression(), m, false, kunderaMetadata);
        }
        return new ArrayList();
    }
968832
@Override
    public Map<String, String> mapToColumns(Tuple tuple) {
        Fields fields = tuple.getFields();
        Map<String, String> columns = new HashMap<String, String>();
        for (int i = 0; i < fields.size(); i++) {
            String name = fields.get(i);
            Object value = tuple.getValueByField(name);
            columns.put(name, (value != null ? value.toString() : ""));
        }
        return columns;
    }
309487
public static Map<String, Field> createSuperColumnsFieldMap(final EntityMetadata m,
            final KunderaMetadata kunderaMetadata)
    {
        Map<String, Field> superColumnNameToFieldMap = new HashMap<String, Field>();
        getEmbeddableType(m, null, superColumnNameToFieldMap, kunderaMetadata);
        return superColumnNameToFieldMap;
    }
436196
public void putAll(IntMap<K> m)
    {
        m.entrySet().stream().forEach((e) ->
        {
            put(e.getKey(), e.getValue().value);
        }
406025
private void setId(EntityMetadata m, Object entity, Object columnValue, boolean isCql3Enabled)
    {
        if (isCql3Enabled && !m.getType().equals(Type.SUPER_COLUMN_FAMILY))
        {
            setFieldValueViaCQL(entity, columnValue, m.getIdAttribute());
        }
        else
        {
            setFieldValue(entity, columnValue, m.getIdAttribute());
        }
    }
1185610
private Map<String, Integer> createMapOfColumnIndex(String[] columns)
    {
        int i = 0;
        Map<String, Integer> map = new HashMap<String, Integer>();
        for (String column : columns)
        {
            map.put(column, i++);
        }
        return map;
    }
109155
@Override
	public void putAll(Map<? extends String, ? extends String> m) {
		this.groupedMap.putAll(DEFAULT_GROUP, m);
	}
33733
private Collection<ThriftRow> onColumnOrSuperColumnThriftRow(EntityMetadata m, Object e, Object id, long timestamp,
            Object columnTTLs)
    {
        // Iterate through Super columns

        Map<String, ThriftRow> thriftRows = new HashMap<String, ThriftRow>();

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        EntityType entityType = metaModel.entity(m.getEntityClazz());

        Set<Attribute> attributes = entityType.getAttributes();
        for (Attribute attribute : attributes)
        {
            String tableName = ((AbstractAttribute) attribute).getTableName() != null ? ((AbstractAttribute) attribute)
                    .getTableName() : m.getTableName();

            ThriftRow tr = getThriftRow(id, tableName, thriftRows);
            if (!attribute.getName().equals(m.getIdAttribute().getName()) && !attribute.isAssociation())
            {
                Field field = (Field) ((Attribute) attribute).getJavaMember();
                byte[] name = ByteBufferUtil.bytes(((AbstractAttribute) attribute).getJPAColumnName()).array();

                // if attribute is embeddable.
                if (metaModel.isEmbeddable(attribute.isCollection() ? ((PluralAttribute) attribute)
                        .getBindableJavaType() : attribute.getJavaType()))
                {
                    Map<String, Object> thriftSuperColumns = onEmbeddable(timestamp, tr, m, e, id, attribute);
                    if (thriftSuperColumns != null)
                    {
                        for (String columnFamilyName : thriftSuperColumns.keySet())
                        {
                            ThriftRow thriftRow = getThriftRow(id, columnFamilyName, thriftRows);
                            if (m.isCounterColumnType())
                            {
                                thriftRow.addCounterSuperColumn((CounterSuperColumn) thriftSuperColumns
                                        .get(columnFamilyName));
                            }
                            else
                            {
                                thriftRow.addSuperColumn((SuperColumn) thriftSuperColumns.get(columnFamilyName));
                            }
                        }
                    }
                }
                else
                {
                    Object value = getColumnValue(m, e, attribute);

                    if (m.getType().equals(Type.SUPER_COLUMN_FAMILY))
                    {
                        prepareSuperColumn(tr, m, value, name, timestamp);
                    }
                    else
                    {
                        int ttl = getTTLForColumn(columnTTLs, attribute);
                        prepareColumn(tr, m, value, name, timestamp, ttl);
                    }
                }
            }
        }

        // Add discriminator column.
        onDiscriminatorColumn(thriftRows.get(m.getTableName()), timestamp, entityType);
        return thriftRows.values();
    }
934438
@Override
  public MultigetSubSliceQuery<K,SN,N,V> setSuperColumn(SN superColumn) {
    Assert.notNull(superColumn, "supercolumn may not be null");
    this.superColumn = superColumn;
    return this;
  }
733765
private static void addToOutputColumns(Expression selectExpression, EntityMetadata m,
            List<Map<String, Object>> columnsToOutput, KunderaMetadata kunderaMetadata)
    {

        Map<String, Object> map = setFieldClazzAndColumnFamily(selectExpression, m, kunderaMetadata);
        columnsToOutput.add(map);
    }
219909
@TimerJ
    public TableMetadataBuilder withColumns(List<ColumnMetadata> columnsMetadata) {
        for (ColumnMetadata colMetadata : columnsMetadata) {
            columns.put(colMetadata.getName(), colMetadata);
        }
        return this;
    }
744177
private void build(Map<String, D6ModelClassFieldInfo> refFieldMap) {

        refFieldMap.clear();

        final Field[] fields = mModelClazz.getFields();

        for (int i = 0; i < fields.length; i++) {

            final Field field = fields[i];

            final DBColumn annoColumn = field.getAnnotation(DBColumn.class);
            if (annoColumn == null) {
                // there is no column annotation.
                continue;
            }
            final String columnName = annoColumn.columnName();
            final String columnType = annoColumn.columnType();

            if (columnName == null || columnType == null) {
                continue;
            }

            final D6ModelClassFieldInfo fieldInfo = new D6ModelClassFieldInfo();

            //
            fieldInfo.field = field;
            fieldInfo.columnName = columnName;
            fieldInfo.columnType = columnType;
            fieldInfo.value = null;
            //
            fieldInfo.isAutoIncrement = annoColumn.isAutoIncrement();
            fieldInfo.isNullable = annoColumn.isNullable();
            fieldInfo.isPrimaryKey = annoColumn.isPrimaryKey();
            fieldInfo.isUnique = annoColumn.isUnique();

            refFieldMap.put(columnName, fieldInfo);
        }

    }
620725
public void writeMapToXML(final Map<String, Set<String>> m) {
        final File outputFile = new File(job.tempDir, FILE_NAME_PLUGIN_XML);
        if (m == null) {
            return;
        }
        final Properties prop = new Properties();
        for (Map.Entry<String, Set<String>> entry : m.entrySet()) {
            final String key = entry.getKey();
            final String value = StringUtils.join(entry.getValue(),
                    COMMA);
            prop.setProperty(key, value);
        }
        //File outputFile = new File(tempDir, filename);

        final DocumentBuilder db = XMLUtils.getDocumentBuilder();
        final Document doc = db.newDocument();
        final Element properties = (Element) doc.appendChild(doc
                .createElement("properties"));

        final Set<Object> keys = prop.keySet();
        for (Object key1 : keys) {
            final String key = (String) key1;
            final Element entry = (Element) properties.appendChild(doc
                    .createElement("entry"));
            entry.setAttribute("key", key);
            entry.appendChild(doc.createTextNode(prop.getProperty(key)));
        }
        final TransformerFactory tf = TransformerFactory.newInstance();
        Transformer t;
        try {
            t = withLogger(tf.newTransformer(), logger);
            t.setOutputProperty(OutputKeys.INDENT, "yes");
            t.setOutputProperty(OutputKeys.METHOD, "xml");
            t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        } catch (final TransformerConfigurationException tce) {
            throw new RuntimeException(tce);
        }
        final DOMSource doms = new DOMSource(doc);
        OutputStream out = null;
        try {
            out = new FileOutputStream(outputFile);
            final StreamResult sr = new StreamResult(out);
            t.transform(doms, sr);
        } catch (final Exception e) {
            logger.error("Failed to process map: " + e.getMessage(), e);
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (final IOException e) {
                    logger.error("Failed to close output stream: " + e.getMessage());
                }
            }
        }
    }
1068794
public static void putAll(final Map<String, String> m) {
        if (contextMap instanceof ThreadContextMap2) {
            ((ThreadContextMap2) contextMap).putAll(m);
        } else if (contextMap instanceof DefaultThreadContextMap) {
            ((DefaultThreadContextMap) contextMap).putAll(m);
        } else {
            for (final Map.Entry<String, String> entry: m.entrySet()) {
                contextMap.put(entry.getKey(), entry.getValue());
            }
        }
    }