© 2002 BEA Systems, Inc.


com.bea.p13n.content.document.ref
Class DefaultDocumentSchema

java.lang.Object
  |
  +--com.bea.p13n.content.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.
 
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


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


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


getAttributeType

public int getAttributeType(java.lang.String name)
                     throws DocumentException
Get the attribute type.
Specified by:
getAttributeType in interface DocumentSchemaDef


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


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


isAttributeMultiValued

public boolean isAttributeMultiValued(java.lang.String name)
                               throws DocumentException
Determine if the attribute is multi-valued.
Specified by:
isAttributeMultiValued in interface DocumentSchemaDef


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


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


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.


© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved