If you create an organization without specifying a primary contact, the default primary contact is the User object that created the organization (that is, the user whose credentials you set when you created the connection to the Registry). However, you can specify a different user as the primary contact. A User is also a complex type of registry object. It normally includes the following attributes, in addition to those common to all objects:
A PersonName object
One or more PostalAddress objects
One or more TelephoneNumber objects
One or more EmailAddress objects
One or more URL objects that represent the user’s home page
The following code fragment creates a User and then sets that User as the primary contact for the organization. This User has a telephone number and email address but no postal address.
// Create primary contact, set name User primaryContact = blcm.createUser(); String userId = primaryContact.getKey().getId(); System.out.println("User URN is " + userId); PersonName pName = blcm.createPersonName("Jane", "M.", "Doe"); primaryContact.setPersonName(pName); // Set primary contact phone number TelephoneNumber pctNum = blcm.createTelephoneNumber(); pctNum.setCountryCode("1"); pctNum.setAreaCode("100"); pctNum.setNumber("100-1001"); pctNum.setType("MobilePhone"); Collection phoneNums = new ArrayList(); phoneNums.add(pctNum); primaryContact.setTelephoneNumbers(phoneNums); // Set primary contact email address EmailAddress emailAddress = blcm.createEmailAddress("jane.doe@TheCoffeeBreak.com"); emailAddress.setType("OfficeEmail")); Collection emailAddresses = new ArrayList(); emailAddresses.add(emailAddress); primaryContact.setEmailAddresses(emailAddresses); URL pcUrl = new URL((bundle.getString("person.url")); primaryContact.setUrl(pcUrl); // Set primary contact for organization org.setPrimaryContact(primaryContact);
The telephone number type for the primary contact is the value of a concept in the PhoneType classification scheme: "OfficePhone", "MobilePhone", "HomePhone", "FAX", or "Beeper". The email address type for the primary contact is the value of a concept in the EmailType classification scheme: either "OfficeEmail" or "HomeEmail".