@Override public DatasetReader<GenericRecord> newReader() throws IOException { return dataset.newReader(); }
/** * Print all user profiles. * * This method demonstrates how to open a reader that will read the entire * table. It has no start or stop keys specified. */ public void printUserProfies() { DatasetReader<UserProfileModel2> reader = userProfileDataset.newReader(); try { for (UserProfileModel2 userProfile : reader) { System.out.println(userProfile.toString()); } } finally { // readers need to be closed. reader.close(); } }
/** * Print all user profiles. * * This method demonstrates how to open a reader that will read the entire * table. It has no start or stop keys specified. */ public void printUserProfies() { DatasetReader<UserProfileModel2> reader = userProfileDataset.newReader(); try { for (UserProfileModel2 userProfile : reader) { System.out.println(userProfile.toString()); } } finally { // readers need to be closed. reader.close(); } }
/** * Print the user profiles and actions for all users with the provided last * name * * This method demonstrates how to open a scanner with a start key. It's using * the composite dao, so the records it returns will be a composite of both * the profile model and actions model. * * @param lastName * The last name of users to scan. */ public void printUserProfileActionsForLastName(String lastName) { // TODO: use a reader with a start key DatasetReader<UserProfileActionsModel2> reader = userProfileActionsDataset.newReader(); try { for (UserProfileActionsModel2 entity : reader) { UserProfileModel2 userProfile = entity.getUserProfileModel(); if (userProfile.getLastName().equals(lastName)) { System.out.println(entity.toString()); } } } finally { // readers need to be closed. reader.close(); } }
/** * Print the user profiles and actions for all users with the provided last * name * * This method demonstrates how to open a scanner with a start key. It's using * the composite dao, so the records it returns will be a composite of both * the profile model and actions model. * * @param lastName * The last name of users to scan. */ public void printUserProfileActionsForLastName(String lastName) { // TODO: use a reader with a start key DatasetReader<UserProfileActionsModel2> reader = userProfileActionsDataset.newReader(); try { for (UserProfileActionsModel2 entity : reader) { UserProfileModel2 userProfile = entity.getUserProfileModel(); if (userProfile.getLastName().equals(lastName)) { System.out.println(entity.toString()); } } } finally { // readers need to be closed. reader.close(); } }
private void checkRecord(boolean shouldExist) { DatasetReader<TestEntity> dsReader = ds.newReader(); try { if (shouldExist) { assertTrue(dsReader.hasNext()); } else { assertFalse(dsReader.hasNext()); } } finally { dsReader.close(); } }
DatasetReader<TestEntity> reader = ds.newReader(); try { for (TestEntity entity : reader) {