Service Registry 3 2005Q4 Developer's Guide

Creating Organizations

An Organization object is probably the most complex registry object. This object normally includes the following attributes, in addition to those common to all objects:

An organization can also have one or more child organizations, which can in turn have children, to form a hierarchy of organizations.

The following code fragment creates an organization and specifies its name, description, postal address, and telephone number.

// Create organization name and description
Organization org =
     blcm.createOrganization("The ebXML Coffee Break");
InternationalString is =
    blcm.createInternationalString("Purveyor of " +
        "the finest coffees. Established 1905");
org.setDescription(is);

// create postal address for organization
String streetNumber = "99";
String street = "Imaginary Ave. Suite 33";
String city = "Imaginary City";
String state = "NY");
String country = "USA");
String postalCode = "00000";
String type = "Type US";
PostalAddress postAddr =
     blcm.createPostalAddress(streetNumber, street, city, state,
        country, postalCode, type);
org.setPostalAddress(postAddr);

// create telephone number for organization
TelephoneNumber tNum = blcm.createTelephoneNumber();
tNum.setCountryCode("1");
tNum.setAreaCode("100");
tNum.setNumber("100-1000");
tNum.setType("OfficePhone");
Collection tNums = new ArrayList();
tNums.add(tNum);
org.setTelephoneNumbers(tNums);

The telephone number type is the value of a concept in the PhoneType classification scheme: "OfficePhone", "MobilePhone", "HomePhone", "FAX", or "Beeper".

To create a hierarchy of organizations, use the Organization.addChildOrganization method to add one organization to another, or use the Organization.addChildOrganizations method to add a Collection of organizations to another.

Creating an Organization: Examples

For examples of creating an organization, see JAXRPublishOrg.java and JAXRPublishOrgNoPC.java in the directory <INSTALL>/registry/samples/organizations/src.

The JAXRPublishOrg example creates an organization, its primary contact, and a service and service binding. The example displays the unique identifiers for the organization, user, and service so that you can use the identifiers later when you delete the objects. This example creates a fictitious User as the primary contact for the organization.

The other example, JAXRPublishOrgNoPC.java, does not set a primary contact for the organization. In this case, the primary contact by default is the User who is authenticated when you run the program.

ProcedureTo Run the JAXRPublishOrg and JAXRPublishOrgNoPC Examples

Steps
  1. Go to the directory <INSTALL>/registry/samples/organizations.

  2. Type the following commands:


    asant pub-org
    asant pub-org-nopc
    

Creating and Retrieving an Organization Hierarchy: Examples

For examples of publishing and retrieving an organization hierarchy, see JAXRPublishOrgFamily.java and JAXRSearchOrgFamily.java in the directory<INSTALL>/registry/samples/organizations/src.

ProcedureTo Run the JAXRPublishOrgFamily and JAXRSearchOrgFamily Examples

Steps
  1. Go to the directory <INSTALL>/registry/samples/organizations.

  2. Type the following command to publish the organizations:


    asant pub-fam
    
  3. Type the following command to retrieve the organizations that you published:


    asant search-fam