private void listGreetings ( String guestbookName ) throws DatastoreException { Query . Builder query = Query . newBuilder ( ) ; query . addKindBuilder ( ) . setName ( GREETING_KIND ) ; query . setFilter ( makeFilter ( KEY_PROPERTY , PropertyFilter . Operator . HAS_ANCESTOR , makeValue ( makeKey ( GUESTBOOK_KIND , guestbookName ) ) ) ) ; query . addOrder ( makeOrder ( DATE_PROPERTY , PropertyOrder . Direction . DESCENDING ) ) ; List < Entity > greetings = runQuery ( query . build ( ) ) ; if ( greetings . size ( ) == 0 ) { System . out . println ( "no greetings in " + guestbookName ) ; } for ( Entity greeting : greetings ) { Map < String , Value > propertyMap = greeting . getProperties ( ) ; System . out . println ( DatastoreHelper . toDate ( propertyMap . get ( DATE_PROPERTY ) ) + ": " + DatastoreHelper . getString ( propertyMap . get ( USER_PROPERTY ) ) + " says " + DatastoreHelper . getString ( propertyMap . get ( MESSAGE_PROPERTY ) ) ) ; } }
List the greetings in the specified guestbook .