/** * map an xml columns to columns * * @param xmlColumns xml column * @param typesBelongingCompositeTypeForComparatorType * @return columns */ private List<ColumnModel> mapXmlColumnsToColumnsModel( List<ColumnMetadata> columnMetaData, List<Column> xmlColumns, ComparatorType columnNameComparatorType, GenericTypeEnum[] typesBelongingCompositeTypeForComparatorType, ComparatorType defaultColumnValueType) { List<ColumnModel> columnsModel = new ArrayList<ColumnModel>(); for (Column xmlColumn : xmlColumns) { ColumnMetadata assocMetaData = null; for (ColumnMetadata tmpColumnMetaData : columnMetaData) { if (tmpColumnMetaData.getName().equals(xmlColumn.getName())) { assocMetaData = tmpColumnMetaData; } } columnsModel.add( mapXmlColumnToColumnModel( assocMetaData, xmlColumn, columnNameComparatorType, typesBelongingCompositeTypeForComparatorType, defaultColumnValueType)); } return columnsModel; }
private ColumnMetadataModel mapXmlColumnMetadataToColumMetadataModel( ColumnMetadata xmlColumnMetadata) { ColumnMetadataModel columnMetadata = new ColumnMetadataModel(); columnMetadata.setColumnName(xmlColumnMetadata.getName()); columnMetadata.setValidationClass( ComparatorType.getByClassName(xmlColumnMetadata.getValidationClass().value())); if (xmlColumnMetadata.getIndexType() != null) { columnMetadata.setColumnIndexType( ColumnIndexType.valueOf(xmlColumnMetadata.getIndexType().value())); } columnMetadata.setIndexName(xmlColumnMetadata.getIndexName()); return columnMetadata; }