/** * Contains composite key. * * @param tableInfo * the table info * @return true, if successful */ private boolean containsCompositeKey(TableInfo tableInfo) { return tableInfo.getTableIdType() != null && tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class); }
builder.append(Constants.OPEN_ROUND_BRACKET); if (!tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class)) String idType = tableInfo.getTableIdType().getSimpleName().toLowerCase(); builder.append(OracleNoSQLValidationClassMapper.getValidIdType(idType)); builder.append(Constants.COMMA); builder.append(Constants.OPEN_ROUND_BRACKET); if (!tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class))
if (tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class)) EmbeddableType embeddableIdType = metaModel.embeddable(tableInfo.getTableIdType()); Field[] fields = tableInfo.getTableIdType().getDeclaredFields(); .getValidTypeForClass(tableInfo.getTableIdType())).key(true).build()); if (tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class))
EmbeddableType compoEmbeddableType = null; if (!compositeColumns.isEmpty() && tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class)) String dataType = CassandraValidationClassMapper.getValidationClass(tableInfo.getTableIdType(), true); String cqlType = translator.getCQLType(dataType); translator.appendColumnName(queryBuilder, tableInfo.getIdColumnName(), cqlType); if (compoEmbeddableType != null && tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class)) Field[] fields = tableInfo.getTableIdType().getDeclaredFields(); StringBuilder primaryKeyBuilder = new StringBuilder(); appendPrimaryKey(translator, compoEmbeddableType, fields, primaryKeyBuilder);
.getValidationClassInstance(tableInfo.getTableIdType(), true).getName());
private boolean containsCompositeKey(TableInfo tableInfo) { return tableInfo.getTableIdType() != null && tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class); }
/** * @param tableInfo * @return CfDef object */ private CfDef getTableMetadata(TableInfo tableInfo) { CfDef cfDef = new CfDef(); cfDef.setKeyspace(databaseName); cfDef.setName(tableInfo.getTableName()); cfDef.setKey_validation_class(CassandraValidationClassMapper.getValidationClass(tableInfo.getTableIdType(), isCql3Enabled(tableInfo))); Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName); tables = schema != null ? schema.getTables() : null; Properties cfProperties = getColumnFamilyProperties(tableInfo); String defaultValidationClass = null; if (tableInfo.getType() != null && tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name())) { getSuperColumnFamilyMetadata(tableInfo, cfDef, defaultValidationClass); } else if (tableInfo.getType() != null) { getColumnFamilyMetadata(tableInfo, cfDef, cfProperties); } setColumnFamilyProperties(cfDef, cfProperties, null); return cfDef; }
Assert.assertEquals(String.class,tableInfo.getTableIdType()); Assert.assertEquals("column family", tableInfo.getType());
String dataType = CassandraValidationClassMapper.getValidationClass(tableInfo.getTableIdType(), true); String cqlType = translator.getCQLType(dataType); translator.appendColumnName(queryBuilder, tableInfo.getIdColumnName(), cqlType); Field[] fields = tableInfo.getTableIdType().getDeclaredFields();
/** * @param tableInfo * @return CfDef object */ private CfDef getTableMetadata(TableInfo tableInfo) { CfDef cfDef = new CfDef(); cfDef.setKeyspace(databaseName); cfDef.setName(tableInfo.getTableName()); cfDef.setKey_validation_class(CassandraValidationClassMapper.getValidationClass(tableInfo.getTableIdType(), isCql3Enabled(tableInfo))); Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName); tables = schema != null ? schema.getTables() : null; Properties cFProperties = getColumnFamilyProperties(tableInfo); String defaultValidationClass = null; if (tableInfo.getType() != null && tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name())) { getSuperColumnFamilyMetadata(tableInfo, cfDef, defaultValidationClass); } else if (tableInfo.getType() != null) { getColumnFamilyMetadata(tableInfo, cfDef, cFProperties); } setColumnFamilyProperties(cfDef, cFProperties, null); return cfDef; }