private static void seedData ( PersistenceManager manager ) throws OnyxException { // Create a call log for area code (555) CellPhone myPhoneNumber = new CellPhone ( ) ; myPhoneNumber . setCellPhoneNumber ( "(555) 303-2322" ) ; myPhoneNumber . setAreaCode ( 555 ) ; manager . saveEntity ( myPhoneNumber ) ; CallLog callToMom = new CallLog ( ) ; callToMom . setDestinationNumber ( "(555) 323-2222" ) ; callToMom . setNSAListening ( true ) ; callToMom . setCallFrom ( myPhoneNumber ) ; callToMom . setCallFromAreaCode ( myPhoneNumber . getAreaCode ( ) ) ; manager . saveEntity ( callToMom ) ; @ SuppressWarnings ( "SpellCheckingInspection" ) CallLog callToEdwardSnowden = new CallLog ( ) ; callToEdwardSnowden . setDestinationNumber ( "(555) 122-2341" ) ; callToEdwardSnowden . setNSAListening ( false ) ; callToEdwardSnowden . setCallFrom ( myPhoneNumber ) ; callToEdwardSnowden . setCallFromAreaCode ( myPhoneNumber . getAreaCode ( ) ) ; manager . saveEntity ( callToEdwardSnowden ) ; // Create a call log for area code (123) // Note: Identifiers are not unique among partitions. Since the entire object graph is saved, // it is possible in this example to have the same identifiers for a CallLog in area code 555 as well as 123 CellPhone mySecretPhone = new CellPhone ( ) ; mySecretPhone . setCellPhoneNumber ( "(123) 936-3733" ) ; mySecretPhone . setAreaCode ( 123 ) ; manager . saveEntity ( mySecretPhone ) ; CallLog callToSomeoneShady = new CallLog ( ) ; callToSomeoneShady . setDestinationNumber ( "(555) 322-1143" ) ; callToSomeoneShady . setNSAListening ( false ) ; callToSomeoneShady . setCallFrom ( mySecretPhone ) ; callToSomeoneShady . setCallFromAreaCode ( mySecretPhone . getAreaCode ( ) ) ; manager . saveEntity ( callToSomeoneShady ) ; CallLog callToJoe = new CallLog ( ) ; callToJoe . setDestinationNumber ( "(555) 286-9987" ) ; callToJoe . setNSAListening ( true ) ; callToJoe . setCallFrom ( mySecretPhone ) ; callToJoe . setCallFromAreaCode ( mySecretPhone . getAreaCode ( ) ) ; manager . saveEntity ( callToJoe ) ; }
Seed Cell phone log data