public interface Classification extends RegistryObject {
// Property Accessor Methods (by property name)
public abstract ClassificationScheme getClassificationScheme( )
throws javax.xml.registry.JAXRException; //L0
public abstract void setClassificationScheme(ClassificationScheme classificationScheme)
throws javax.xml.registry.JAXRException; //L0
public abstract RegistryObject getClassifiedObject( )
throws javax.xml.registry.JAXRException; //L0
public abstract void setClassifiedObject(RegistryObject classifiedObject)
throws javax.xml.registry.JAXRException; //L0
public abstract Concept getConcept( )
throws javax.xml.registry.JAXRException; //L0
public abstract void setConcept(Concept concept)
throws javax.xml.registry.JAXRException; //L0
public abstract boolean isExternal( )
throws javax.xml.registry.JAXRException; //L0
public abstract String getValue( )
throws javax.xml.registry.JAXRException; //L0
public abstract void setValue(String value)
throws javax.xml.registry.JAXRException; //L0
}
A Classification is an object that categorizes the
RegistryObject to which it is attached according
to the ClassificationScheme to which it belongs.
There are several standard classification schemes in use, such as
NAICS and UNSPSC, which are widely supported by registries and can be
used by businesses to make it easier for registry searches to locate
their services. For example, a book publisher might label its
Organization entry and its services with the
classification Book Publisher, which is part of
the NAICS classification scheme.
In order to categorize a RegistryObject, use one
of the LifeCycleManager
createClassification( ) methods and then call the
addClassification( ) or
addClassifications( ) method of the target
RegistryObject. Note that a
Classification instance can be associated with
only one object in the registry at any given time, so it is necessary
to create a new instance for each object to be classified. The object
that a Classification is associated with can be
obtained from its getClassifiedObject( ) method
and set using setClassifiedObject( ), which is
called on your behalf when you use addClassification(
) or addClassifications( ).
There are two types of Classification: internal
and external. The type of a Classification is the
same as that of the scheme to which it belongs, as described in the
reference section for the ClassificationScheme
interface later in this chapter. An internal
Classification is defined by the
Concept from the
ClassificationScheme that appears as the node in
which it corresponds to the classification hierarchy. Given a
ClassificationScheme, you can use the
findConceptByPath( ) method of
BusinessQueryManager to obtain the required
Concept and then use the single-argument variant
of the LifeCycleManager
createClassification( ) method to create the
corresponding Classification object. The following
code extract illustrates this: bqm and
blcm are instances of
BusinessQueryManager and
BusinessLifeCycleManager, respectively:
ClassificationScheme naics = bqm.findClassificationSchemeByName(null, "%naics%");
String path = "/" + naics.getKey( ).getId( ) + "/51/511/5111/51113";
Concept publisherConcept = bqm.findConceptByPath(path);
Classification bookPublishers = blcm.createClassification(publisherConcept);
This code creates a Classification that refers to
the "Book Publishers" category of
the NAICS classification scheme, which is supported as an internal
classification scheme by the JAXR provider in the reference
implementation.
An external Classification simply has an
associated name and value, and is created using one of the other two
createClassification( ) methods of
LifeCycleManager:
// Create external classification
ClassificationScheme naics = bqm.findClassificationSchemeByName(null, "%naics%");
Classification bookPublishers = blcm.createClassification(naics, "Book Publishers", "51113");
Here, you need only to specify the name of the classification
("Book Publishers") and its value
("51113"). Using external
classifications is more error-prone than internal classifications
because there is no way for the registry to verify that the values
supplied are valid, whereas an internal classification can only be
created from a Concept that is part of a
(presumably trusted) internal
ClassificationScheme.
You can get or set the Concept associated with an
internal Classification using the
getConcept( ) and setConcept( )
methods. For an external Classification, use the
getValue( ) and setValue( )
methods instead. In the case of the external
Classification created previously, the
getValue( ) method returns
"51113". The name attribute
("Book Publishers") can be
retrieved using the getName( ) method inherited
from RegistryObject. You can use the
isExternal( ) method to determine whether a
Classification is external or internal and, hence,
which of these sets of methods you need to use.