background image

Adding Classifications

<< Complex data item | Adding Services and Service Bindings >>
<< Complex data item | Adding Services and Service Bindings >>
188
J
AVA
API
FOR
XML R
EGISTRIES
// Set primary contact email address
EmailAddress emailAddress =
blcm.createEmailAddress("jane.doe@TheCoffeeBreak.com");
Collection<EmailAddress> emailAddresses =
new ArrayList<EmailAddress>();
emailAddresses.add(emailAddress);
primaryContact.setEmailAddresses(emailAddresses);
// Set primary contact for organization
org.setPrimaryContact(primaryContact);
Adding Classifications
Organizations commonly belong to one or more classifications based on one or
more classification schemes (taxonomies). To establish a classification for an
organization using a taxonomy, the client first locates the taxonomy it wants to
use. It uses the
BusinessQueryManager
to find the taxonomy. The
findClassificationSchemeByName
method takes a set of
FindQualifier
objects as its first argument, but this argument can be null.
// Set classification scheme to NAICS
ClassificationScheme cScheme =
bqm.findClassificationSchemeByName(null,
"ntis-gov:naics:1997");
The client then creates a classification using the classification scheme and a con-
cept (a taxonomy element) within the classification scheme. For example, the
following code sets up a classification for the organization within the NAICS
taxonomy. The second and third arguments of the
createClassification
method are the name and the value of the concept.
// Create and add classification
InternationalString sn =
blcm.createInternationalString(
"All Other Specialty Food Stores"));
String sv = "445299";
Classification classification =
blcm.createClassification(cScheme, sn, sv);
Collection<Classification> classifications =
new ArrayList<Classification>();
classifications.add(classification);
org.addClassifications(classifications);
Services also use classifications, so you can use similar code to add a classifica-
tion to a
Service
object.