public void printUserProfileActionsForLastName ( String lastName ) { // Create a partial key that will allow us to start the scanner from the // first user record that has last name equal to the one provided. PartitionKey startKey = new PartitionKey ( "lastName" ) ; // Get the scanner with the start key. Null for stopKey in the getScanner // method indicates that the scanner will scan to the end of the table. Our // loop will break out when it encounters a record without the last name. EntityScanner < UserProfileActionsModel > scanner = userProfileActionsDao . getScanner ( startKey , null ) ; scanner . initialize ( ) ; try { // scan until we find a last name not equal to the one provided for ( UserProfileActionsModel entity : scanner ) { if ( ! entity . getUserProfileModel ( ) . getLastName ( ) . equals ( lastName ) ) { // last name of row different, break out of the scan. break ; } System . out . println ( entity . toString ( ) ) ; } } finally { // scanners need to be closed. scanner . close ( ) ; } }
Print the user profiles and actions for all users with the provided last name