Service Registry 3.1 Developer's Guide

Creating Users

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:


Note –

Typically, users create themselves by registering using the Web Console. It is highly uncommon to use JAXR to create a user. The sample programs create users to illustrate the User object and to generate organizations with different primary contacts.


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(CanonicalConstants.CANONICAL_PHONE_TYPE_CODE_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(CanonicalConstants.CANONICAL_EMAIL_TYPE_CODE_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". Use the CanonicalConstants codes for these types.