@ Override public List < CpoAttribute > getCpoAttributes ( String expression ) throws CpoException { List < CpoAttribute > attributes = new ArrayList <> ( ) ; if ( expression != null && ! expression . isEmpty ( ) ) { Session session ; ResultSet rs ; try { session = getWriteSession ( ) ; rs = session . execute ( expression ) ; ColumnDefinitions columnDefs = rs . getColumnDefinitions ( ) ; for ( int i = 0 ; i < columnDefs . size ( ) ; i ++ ) { CpoAttribute attribute = new CassandraCpoAttribute ( ) ; attribute . setDataName ( columnDefs . getName ( i ) ) ; DataTypeMapEntry < ? > dataTypeMapEntry = metaDescriptor . getDataTypeMapEntry ( columnDefs . getType ( i ) . getName ( ) . ordinal ( ) ) ; attribute . setDataType ( dataTypeMapEntry . getDataTypeName ( ) ) ; attribute . setDataTypeInt ( dataTypeMapEntry . getDataTypeInt ( ) ) ; attribute . setJavaType ( dataTypeMapEntry . getJavaClass ( ) . getName ( ) ) ; attribute . setJavaName ( dataTypeMapEntry . makeJavaName ( columnDefs . getName ( i ) ) ) ; attributes . add ( attribute ) ; } } catch ( Throwable t ) { logger . error ( ExceptionHelper . getLocalizedMessage ( t ) , t ) ; throw new CpoException ( "Error Generating Attributes" , t ) ; } } return attributes ; }
Get the cpo attributes for this expression