if (!m.getType().equals(Type.SUPER_COLUMN_FAMILY))
slicePredicate, keyRange, getConsistencyLevel()); if (m.getType().isSuperColumnFamilyMetadata())
for (TableInfo tableInfo : tableInfos) if (isCql3Enabled(tableInfo) && !tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name()))
slicePredicate, keyRange, getConsistencyLevel()); if (m.getType().isSuperColumnFamilyMetadata())
if (m.getType().isSuperColumnFamilyMetadata())
PropertyAccessorHelper.setId(entity, m, (byte[]) thriftColumnValue); if (isCql3Enabled && !m.getType().equals(Type.SUPER_COLUMN_FAMILY) && !m.isCounterColumnType()) .getEntityMetadata(((AbstractAttribute) attribute).getBindableJavaType()); Object value; if (isCql3Enabled && !m.getType().equals(Type.SUPER_COLUMN_FAMILY))
if (m.getType().equals(Type.SUPER_COLUMN_FAMILY))
if (m.getType().isSuperColumnFamilyMetadata())
boolean isRelational, List<String> relationNames, CassandraDataHandler dataHandler) if (m.getType().isSuperColumnFamilyMetadata())
boolean isRelational, List<String> relationNames, CassandraDataHandler dataHandler) if (m.getType().isSuperColumnFamilyMetadata())
if (m.getType().isSuperColumnFamilyMetadata())
if (m.getType().isSuperColumnFamilyMetadata())
/** * @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; }
/** * Returns true in case of, composite Id and if cql3 opted and not a * embedded entity. * * @param metadata * @param metaModel * @return */ public boolean isCql3Enabled(EntityMetadata metadata) { if (metadata != null) { MetamodelImpl metaModel = (MetamodelImpl) KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel( metadata.getPersistenceUnit()); if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) { return true; } else if (getCqlVersion().equalsIgnoreCase(CassandraConstants.CQL_VERSION_3_0) && metadata.getType().equals(Type.SUPER_COLUMN_FAMILY)) { log.warn("Super Columns not supported by cql, Any operation on supercolumn family will be executed using thrift, returning false."); return false; } return getCqlVersion().equalsIgnoreCase(CassandraConstants.CQL_VERSION_3_0); } return getCqlVersion().equalsIgnoreCase(CassandraConstants.CQL_VERSION_3_0); }
/** * Gets the instance of. * * @param type * the type * @return the instance of */ private static ColumnFamilyType getInstanceOf(String type) { if (type.equals(Type.COLUMN_FAMILY.name())) { return ColumnFamilyType.Standard; } else { return ColumnFamilyType.Super; } } }
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()); // columnValue = // PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), // (byte[]) columnValue); // PropertyAccessorHelper.setId(entity, m, columnValue); } }
/** * Checks whether Inverted indexing is applicable for a given entity whose * metadata is passed as parameter * * @param m * @return */ public static boolean isInvertedIndexingApplicable(EntityMetadata m, boolean useSecondryIndex) { boolean invertedIndexingApplicable = useSecondryIndex && CassandraPropertyReader.csmd.isInvertedIndexingEnabled(m.getSchema()) && m.getType().isSuperColumnFamilyMetadata() && !m.isCounterColumnType(); return invertedIndexingApplicable; }
/** * * @param tableInfo */ private void validateCompoundKey(TableInfo tableInfo) { if (tableInfo.getType() != null && tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name())) { throw new SchemaGenerationException( "Composite/Compound columns are not yet supported over Super column family by Cassandra", "cassandra", databaseName); } }
/** * * @param tableInfo * @return */ private boolean isCql3Enabled(TableInfo tableInfo) { return containsCompositeKey(tableInfo) || ((cql_version != null && cql_version.equals(CassandraConstants.CQL_VERSION_3_0)) && !tableInfo .getType().equals(Type.SUPER_COLUMN_FAMILY.name())); }