public void create ( String firstName , String lastName , boolean married ) { long ts = System . currentTimeMillis ( ) ; UserProfileModel profileModel = UserProfileModel . newBuilder ( ) . setFirstName ( firstName ) . setLastName ( lastName ) . setMarried ( married ) . setCreated ( ts ) . build ( ) ; UserActionsModel actionsModel = UserActionsModel . newBuilder ( ) . setFirstName ( firstName ) . setLastName ( lastName ) . setActions ( new HashMap < String , String > ( ) ) . build ( ) ; actionsModel . getActions ( ) . put ( "profile_created" , Long . toString ( ts ) ) ; UserProfileActionsModel profileActionsModel = UserProfileActionsModel . newBuilder ( ) . setUserProfileModel ( profileModel ) . setUserActionsModel ( actionsModel ) . build ( ) ; if ( ! userProfileActionsDao . put ( profileActionsModel ) ) { // If put returns false, a user already existed at this row System . out . println ( "Creating a new user profile failed due to a write conflict." ) ; } }
Create a fresh new user record .