BEA Systems, Inc.

com.beasys.commerce.axiom.document.ref
Class DefaultDocumentSchema

java.lang.Object
  |
  +--com.beasys.commerce.axiom.document.ref.DefaultDocumentSchema

public class DefaultDocumentSchema
extends java.lang.Object
implements DocumentSchemaDef

A concrete, base implementation of a document schema.


Inner Class Summary
static class DefaultDocumentSchema.PropertyInfo
          Helper data structure.
 
Field Summary
protected  java.lang.String description
          The schema description.
protected  java.lang.String name
          The schema name.
protected  java.util.Map properties
          The map of property name to property info.
 
Fields inherited from interface com.beasys.commerce.axiom.document.spi.DocumentSchemaDef
BOOLEAN, DATETIME, FLOAT, INTEGER, TEXT, USER_DEFINED
 
Constructor Summary
DefaultDocumentSchema(java.lang.String name)
          Constructor.
 
Method Summary
 java.lang.Object getAttributeDefaultValue(java.lang.String name)
          Get the default value for the attribute.
 java.lang.String getAttributeDescription(java.lang.String name)
          Get the description for the named attribute.
 java.util.Collection getAttributeNames()
          Get the list of valid property names.
 java.util.List getAttributePossibleValues(java.lang.String name)
          Get the possible values for the attribute.
 int getAttributeType(java.lang.String name)
          Get the attribute type.
 java.lang.String getDescription()
          Get the schema description.
 java.lang.String getName()
          Get the schema name.
 DefaultDocumentSchema.PropertyInfo getPropertyInfo(java.lang.String name)
          Get the info for the named property.
 boolean isAttributeMultiValued(java.lang.String name)
          Determine if the attribute is multi-valued.
 void setDescription(java.lang.String d)
          Set the schema description.
 void setName(java.lang.String name)
          Set the schema name.
 void setProperty(java.lang.String name, int type, java.lang.Object defValue, boolean isMultiValued, java.util.List possibleValues, java.lang.String description)
          Set the info the named property.
 void setPropertyInfo(java.lang.String name, DefaultDocumentSchema.PropertyInfo info)
          Set the info for the named property.
static boolean validateAttribute(DefaultDocumentSchema.PropertyInfo info, java.lang.Object value)
          Validate the attribute value against the given property info.
static boolean validateAttribute(int type, java.lang.Object value)
          Validate the attribute value against the specified type.
 boolean validateAttribute(java.lang.String name, java.lang.Object value)
          Validate the specified attribute against the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The schema name.

description

protected java.lang.String description
The schema description.

properties

protected java.util.Map properties
The map of property name to property info.
Constructor Detail

DefaultDocumentSchema

public DefaultDocumentSchema(java.lang.String name)
Constructor.
Method Detail

getName

public java.lang.String getName()
Get the schema name.
Specified by:
getName in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Returns:
the String schema name.
Throws:
DocumentException - thrown on an error.

setName

public void setName(java.lang.String name)
Set the schema name.

getDescription

public java.lang.String getDescription()
Get the schema description.
Specified by:
getDescription in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Returns:
the description of the schema (null for none).
Throws:
DocumentException - thrown on an error.

setDescription

public void setDescription(java.lang.String d)
Set the schema description.

setPropertyInfo

public void setPropertyInfo(java.lang.String name,
                            DefaultDocumentSchema.PropertyInfo info)
Set the info for the named property.
Parameters:
name - the property name.
info - the property info (null to remove).

setProperty

public void setProperty(java.lang.String name,
                        int type,
                        java.lang.Object defValue,
                        boolean isMultiValued,
                        java.util.List possibleValues,
                        java.lang.String description)
Set the info the named property.

getPropertyInfo

public DefaultDocumentSchema.PropertyInfo getPropertyInfo(java.lang.String name)
                                                   throws DocumentException
Get the info for the named property.
Parameters:
name - the property name.
Returns:
the info for the property.
Throws:
DocumentException - thrown if the propert info doesn't exist.

getAttributeNames

public java.util.Collection getAttributeNames()
Get the list of valid property names.
Specified by:
getAttributeNames in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Returns:
the list of String attribute names.
Throws:
DocumentException - thrown on an error.

getAttributeType

public int getAttributeType(java.lang.String name)
                     throws DocumentException
Get the attribute type.
Specified by:
getAttributeType in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Parameters:
attributeName - the name of the attribute.
Returns:
the int type (one of TEXT, INTEGER, FLOAT, BOOLEAN, DATE, or USER_DEFINED).
Throws:
DocumentException - thrown on an error.
See Also:
DocumentSchemaDef.TEXT, DocumentSchemaDef.INTEGER, DocumentSchemaDef.FLOAT, DocumentSchemaDef.BOOLEAN, DocumentSchemaDef.DATETIME, DocumentSchemaDef.USER_DEFINED

getAttributeDefaultValue

public java.lang.Object getAttributeDefaultValue(java.lang.String name)
                                          throws DocumentException
Get the default value for the attribute.
Specified by:
getAttributeDefaultValue in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Parameters:
attributeName - the name of the attribute.
Returns:
the default value, or null for none.
Throws:
DocumentException - thrown on an error.

getAttributeDescription

public java.lang.String getAttributeDescription(java.lang.String name)
                                         throws DocumentException
Get the description for the named attribute.
Specified by:
getAttributeDescription in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Parameters:
attributeName - the name of the attribute.
Returns:
the description, or null for none.
Throws:
DocumentException - thrown on an error.

isAttributeMultiValued

public boolean isAttributeMultiValued(java.lang.String name)
                               throws DocumentException
Determine if the attribute is multi-valued.
Specified by:
isAttributeMultiValued in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Parameters:
attributeName - the name of the attribute.
Returns:
true if multi-valued, false if not
Throws:
DocumentException - thrown on an error.

getAttributePossibleValues

public java.util.List getAttributePossibleValues(java.lang.String name)
                                          throws DocumentException
Get the possible values for the attribute.
Specified by:
getAttributePossibleValues in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Parameters:
attributeName - the name of the attribute.
Returns:
the list of possible values.
Throws:
DocumentException - thrown on an error.

validateAttribute

public boolean validateAttribute(java.lang.String name,
                                 java.lang.Object value)
                          throws DocumentException
Validate the specified attribute against the given value.
Specified by:
validateAttribute in interface DocumentSchemaDef
Tags copied from interface: DocumentSchemaDef
Parameters:
attributeName - the name of the attribute.
attributeValue - the suggested value for the attribute.
Returns:
true if the value valid, false if not.
Throws:
DocumentException - thrown on an error.

validateAttribute

public static boolean validateAttribute(DefaultDocumentSchema.PropertyInfo info,
                                        java.lang.Object value)
Validate the attribute value against the given property info.

validateAttribute

public static boolean validateAttribute(int type,
                                        java.lang.Object value)
Validate the attribute value against the specified type.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved