![]() ![]() The information includes the employee's name, home address, work address, home telephone number, work telephone number, and the employee's age. The DataGenerator class generates, at random, information about an employee. Public static final String FILENAME = "contacts.csv" Private static final String STATE_CODES = * US Postal Service two letter postal codes. New Address("8 Yawkey Way", null, getRandomName(),Ĭollections.singletonMap("work", getRandomPhone()), New Address("1500 Boylston St.", null, getRandomName(), * Generate a Contact with random information. Return (Base.getRandom().nextInt(40) - 20) * Contact.MILLIS_IN_YEAR Private static long getRandomDateInMillis() * Return a random date in millis before or after the epoch. Return Base.toDecString(Base.getRandom().nextInt(99999), 5) ![]() Return new PhoneNumber((short)anPhone, (short)anPhone, Private static PhoneNumber getRandomPhone() Private static int getRandomPhoneDigits() * The phone number includes access, country, area code, and local random birth date in millis before or after the epochĪch = (char) ('A' + rand.nextInt(26)) Īch = (char) ('a' + rand.nextInt(26)) append(Base.toDelimitedString(getRandomPhoneDigits(), ",")) append("330 Lectroid Rd.,Grover's Mill,") append(",US,Yoyodyne Propulsion Systems,") append(getRandomName()) /*random city name*/ append(" Beacon St.,") /*street1,empty street2*/ Sb.append(Integer.toString(Base.getRandom().nextInt(999))) PrintWriter writer = new PrintWriter(new BufferedWriter( Public static void generate(OutputStream out, int cContacts) * Generate the contacts and write them to a file. OutputStream out = new FileOutputStream(sFile) Int cCon = asArg.length > 1 ? Integer.parseInt(asArg) : 1000 ![]() String sFile = asArg.length > 0 ? asArg : FILENAME * DataGenerator is a generator of sample contacts. Return getFirstName() + " " + getLastName() Return Base.equals(getFirstName(), that.getFirstName()) &īase.equals(getLastName(), that.getLastName()) ![]() Public void writeExternal(PofWriter writer) Public void readExternal(PofReader reader) Public ContactId(String FirstName, String LastName) * Default constructor (necessary for PortableObject implementation). Public class ContactId implements PortableObject * ContactId is a key to the person for whom information is Select the Contacts project from the Required Project Selection dialog box, as illustrated in Figure 5-1. In the Properties for Loading dialog box, select Java Build Path. Right click the Loading project in the Project Explorer and select Properties. These files can be found in c:\home\oracle\workspace\Contacts\appClientModule and c:\home\oracle\workspace\Contacts\build\classes directories. See "Creating and Caching Complex Objects" for information on creating a new project.Īdd the classes and files related to the Address, PhoneNumber, and Contact classes that you created in an earlier exercise ( Contacts). In the Application Client Module page of the New Application Client Project wizard, deselect the Create a default Main class checkbox. Select CoherenceConfig from the Configuration drop-down list. To create a class that contains the key for a domain object:Ĭreate a new Application Client Project called Loading. 5.2.1 Create a Class with the Key for the Domain Objects ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |