com.bea.content
Class PropertyDefinition

java.lang.Object
  extended by com.bea.content.ContentEntity
      extended by com.bea.content.PropertyDefinition
All Implemented Interfaces
Serializable, Cloneable, Comparable<PropertyDefinition>

public class PropertyDefinition
extends ContentEntity
implements Cloneable, Comparable<PropertyDefinition>

PropertyDefinition defines the shape of a Property. It describes the Property type (binary, boolean, string, double, calendar, long, link), whether it is required, whether it is editable, the default value and restricted values, if applicable.

A PropertyDefinition may contain a PropertyChoice array. This is a list of values that may be selected for a Property's values.

Rules for a PropertyDefinition are as follows.

  • If the PropertyDefinition contains a reference, it may not be multi-valued, or of types link or binary.
  • If the PropertyDefinition is of type binary, it may not be multi-valued or restricted and may only have one PropertyChoice.
  • If the PropertyDefinition is of type boolean, it may not be multi-valued.
  • If the PropertyDefinition is of type link, it may not have PropertyChoice(s), or be set as the primary property.
  • If the PropertyDefinition is restricted then the Properties of this type must have value(s) must be contained in the PropertyChoice list. For example: consider a PropertyDefinition named "color". It has PropertyChoices "blue", "green", and "red". If the PropertyDefinition is restricted then the value of a Property defined by this PropertyDefinition may not have a value that isn't "green", "red", or "blue".

    An ObjectClass is defined using PropertyDefinitions. ObjectClasses can be nested within one another. As an example, consider an ObjectClass 'Address' with PropertyDefinitions for 'street', 'city', and 'zipcode'. Another ObjectClass called 'PersonalInformation' contains PropertyDefinitions for 'firstname', 'lastname', etc. Now 'PersonalInformation' can also refer to 'Address' as a "nested" ObjectClass. Those PropertyDefinitions that belong to the 'Address' ObjectClass are then considered "nested" and 'Address' is an ObjectClass that is nested in 'PersonalInformation'.

    In the above example, 'PersonalInformation' is called the "root level container", and the two PropertyDefinitions 'firstname', 'lastname' are not considered nested.

    Here is a code example using nested property definitions:

    
            // First create the nested and container ObjectClasses
            ID repId = new ID(repositoryName, null);
    
            // create nested type with a mandatory primary property
            PropertyDefinition[] pds = new PropertyDefinition[2];
            pds[0] = new PropertyDefinition(repId, "stringType", null, Property.STRING, false, false,
                    false, false, false, null);
            pds[1] = new PropertyDefinition(repId, "primaryType", null, Property.STRING, false, false,
                    true, false, true, null);
            nestedType = new ObjectClass(repId, "NestedType", pds[1], pds);
            nestedType = typeManager.addType(context, nestedType);
    
            // create the container ObjectClass
            pds = new PropertyDefinition[2];
            pds[0] = new PropertyDefinition(repId, "longType", null, Property.LONG, false, false,
                    false, false, false, null);
            pds[1] = new PropertyDefinition(nestedType.getId(), repId, "nestedType", Property.NESTED,
                    false, multiValued, "nested type");
            container = new ObjectClass(repId, "container", null, pds);
            container = typeManager.addType(context, container);
    

    See Also
    Serialized Form

    Field Summary
    static int INHERITED
              An inherited type indicates a property definition which is a part of the object class due to the definition's object class extending another object class.
    static int NATIVE
              A native type indicates a property definition explicitly defined on a given object class.
    static int OVERRIDDEN
              An overridden type indicates a property definition which was inherited and then was further modified to override the original definition in some fashion.
     
    Fields inherited from class com.bea.content.ContentEntity
    id
     
    Constructor Summary
    PropertyDefinition(ID nestedObjectClassId, ID id, String name, int type, boolean isMandatory, boolean isMultiValued, String description)
              Constructs PropertyDefinition without PropertyChoices that represents a nested ObjectClass.
    PropertyDefinition(ID id, String name, String reference, int type, boolean isReadOnly, boolean isRestricted, boolean isMandatory, boolean isMultiValued, boolean isPrimary, String description)
              Constructs PropertyDefinition without PropertyChoices.
    PropertyDefinition(PropertyChoice[] propertyChoices, ID id, String name, String reference, int type, boolean isReadOnly, boolean isRestricted, boolean isMandatory, boolean isMultiValued, boolean isPrimary, String description)
              Constructs the PropertyDefinition with all attributes.
     
    Method Summary
     Object clone()
              Clones a PropertyDefinition with its property choices.
     int compareTo(PropertyDefinition pd)
              Implements the Comparable interface based on the property definition's name.
     String getDescription()
              Gets the description.
     String getName()
              Returns the name of this PropertyDefinition.
     ObjectClass getNestedObjectClass()
              Return the object class associated with this property definition if is type NESTED.
     ID getNestedObjectClassId()
              Gets the nested object class id that this property definition represents.
     PropertyChoice[] getPropertyChoices()
              Returns the array of PropertyChoices.
     int getPropertyDefinitionType()
              Gets the property definition type for this definition.
     String getReference()
              Returns a means by which instances of properties for this PropertyDefinition may be referenced.
     int getType()
              Gets the defined data type.
     boolean isMandatory()
              Returns true if a value for the Property is required.
     void isMandatory(boolean isMandatory)
              Set to true if a value for the Property is required, or false otherwise.
     boolean isMultiValued()
              Returns true if the Property can have multiple values.
     void isMultiValued(boolean isMultiValued)
              Set to true if the Property can have multiple values, false otherwise.
     boolean isNested()
              Indicates whether this PropertyDefinition belongs to an Objectclass that is nested inside another ObjectClass.
     void isNested(boolean isNested)
              Indicates whether this PropertyDefinition belongs to an Objectclass that is nested inside another ObjectClass.
     boolean isObjectClassReadOnly()
              A flag indicating if the ObjectClass is read-only because the repository does not support write operations or isn't configured to allow write access to ObjectClasses.
     boolean isPrimary()
              Returns true if this PropertyDefinition represents the primary PropertyDefinition for its ObjectClass.
     void isPrimary(boolean isPrimary)
              Set to true if this PropertyDefinition represents the primary PropertyDefinition for its ObjectClass.
     boolean isReadOnly()
              Returns true if a value for the Property cannot be edited.
     void isReadOnly(boolean isReadOnly)
              Set to true if a value for the Property cannot be edited, or false otherwise.
     boolean isRestricted()
              Returns true if a value for the Property is restricted to the available choices.
     void isRestricted(boolean isRestricted)
              Set to true if a value for the Property is restricted to the available choices, or false otherwise.
     boolean isSearchable()
              Returns true if a value for the Property should be searchable.
     void isSearchable(boolean isSearchable)
              Set to true if a value for the Property should be searchable.
     boolean isSortable()
              Returns true if a value for the Property should be sortable when searching.
     void setDescription(String description)
              Sets the description.
     void setMandatory(boolean isMandatory)
              Set to true if a value for the Property is required, or false otherwise.
     void setMultiValued(boolean isMultiValued)
              Set to true if the Property can have multiple values, false otherwise.
     void setName(String name)
              Sets the name of this PropertyDefinition.
     void setNested(boolean isNested)
              Indicates whether this PropertyDefinition belongs to an Objectclass that is nested inside another ObjectClass.
     void setObjectClassOps(ObjectClassOps objectClassOps)
              Deprecated No longer used.
     void setPrimary(boolean isPrimary)
              Set to true if this PropertyDefinition represents the primary PropertyDefinition for its ObjectClass.
     void setPropertyChoices(PropertyChoice[] propertyChoices)
              Sets the array of PropertyChoices.
     void setReadOnly(boolean isReadOnly)
              Set to true if a value for the Property cannot be edited, or false otherwise.
     void setReference(String reference)
              Sets a means by which all instances of properties for this PropertyDefinition may be referenced.
     void setRestricted(boolean isRestricted)
              Set to true if a value for the Property is restricted to the available choices, or false otherwise.
     void setSearchable(boolean isSearchable)
              Set to true if a value for the Property should be searchable.
     void setSortable(boolean sortable)
              Set to true if a value for the Property should be sortable when searching.
     void setType(int type)
              Sets the defined data type id.
     String toString()
              Returns the PropertyDefinition attributs as a String.
     
    Methods inherited from class com.bea.content.ContentEntity
    getId, setId
     
    Methods inherited from class java.lang.Object
    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    NATIVE

    public static final int NATIVE
    A native type indicates a property definition explicitly defined on a given object class. The definition was not a part of the object class via object class inheritance.

    See Also
    Constants Summary

    INHERITED

    public static final int INHERITED
    An inherited type indicates a property definition which is a part of the object class due to the definition's object class extending another object class.

    See Also
    Constants Summary

    OVERRIDDEN

    public static final int OVERRIDDEN
    An overridden type indicates a property definition which was inherited and then was further modified to override the original definition in some fashion.

    See Also
    Constants Summary
    Constructor Detail

    PropertyDefinition

    public PropertyDefinition(PropertyChoice[] propertyChoices,
                              ID id,
                              String name,
                              String reference,
                              int type,
                              boolean isReadOnly,
                              boolean isRestricted,
                              boolean isMandatory,
                              boolean isMultiValued,
                              boolean isPrimary,
                              String description)
    Constructs the PropertyDefinition with all attributes.

    Parameters
    propertyChoices - - available value choices for a Property that is defined by this PropertyDefinition.
    id - - the unique id for this PropertyDefinition
    name - - the name of this PropertyDefinition that is unique relative to its ObjectClass.
    reference - - an external reference for all Properties defined by this PropertyDefinition. In the WLP Repository, this is the column name for an explicit property.
    type - - the type of this PropertyDefinition.
    isReadOnly - - true if a Property defined by this PropertyDefinition is intended to not be writable, false otherwise.
    isRestricted - - true if a Property defined by this PropertyDefinition may only contain value(s) defined in this PropertyDefinitions PropertyChoice array, false otherwise
    isMandatory - - true if a Property defined by this PropertyDefinition must contain a non-null value and in the case of a String must not be empty, false otherwise
    isMultiValued - - true if a Property defined by this PropertyDefinition may contain multiple values, false otherwise.
    isPrimary - - true if the PropertyDefinition is the Primary PropertyDefinition for the ObjectClass.
    description - - a description of this PropertyDefinition.

    PropertyDefinition

    public PropertyDefinition(ID id,
                              String name,
                              String reference,
                              int type,
                              boolean isReadOnly,
                              boolean isRestricted,
                              boolean isMandatory,
                              boolean isMultiValued,
                              boolean isPrimary,
                              String description)
    Constructs PropertyDefinition without PropertyChoices.

    Parameters
    id - - the unique id for this PropertyDefinition
    name - - the name of this PropertyDefinition that is unique relative to its ObjectClass.
    reference - - an external reference for all Properties defined by this PropertyDefinition. In the WLP Repository, this is the column name for an explicit property.
    type - - the type of this PropertyDefinition.
    isReadOnly - - true if a Property defined by this PropertyDefinition is intended to not be writable, false otherwise.
    isRestricted - - true if a Property defined by this PropertyDefinition may only contain value(s) defined in this PropertyDefinitions PropertyChoice array, false otherwise
    isMandatory - - true if a Property defined by this PropertyDefinition must contain a non-null value and in the case of a String must not be empty, false otherwise.
    isMultiValued - - true if a Property defined by this PropertyDefinition may contain multiple values, false otherwise.
    isPrimary - - true if the PropertyDefinition is the Primary PropertyDefinition for the ObjectClass.
    description - - a description of this PropertyDefinition.

    PropertyDefinition

    public PropertyDefinition(ID nestedObjectClassId,
                              ID id,
                              String name,
                              int type,
                              boolean isMandatory,
                              boolean isMultiValued,
                              String description)
    Constructs PropertyDefinition without PropertyChoices that represents a nested ObjectClass. There is no way to set propertyChoices, isReadOnly, reference, isRestricted, or isPrimary variables, as they have to be null or false for a nested type.

    Parameters
    nestedObjectClassId - - the unique id of the nested ObjectClass that this PropertyDefinition represents.
    id - - the unique id for this PropertyDefinition
    name - - the name of this PropertyDefinition that is unique relative to its ObjectClass.
    type - - the type of this PropertyDefinition.
    isMandatory - - true if a Property defined by this PropertyDefinition must contain a non-null value and in the case of a String must not be empty, false otherwise.
    isMultiValued - - true if a Property defined by this PropertyDefinition may contain multiple values, false otherwise.
    description - - a description of this PropertyDefinition.
    Method Detail

    getDescription

    public String getDescription()
    Gets the description.

    Returns
    The description.

    setDescription

    public void setDescription(String description)
    Sets the description.

    Parameters
    description - The description.

    getPropertyChoices

    public PropertyChoice[] getPropertyChoices()
    Returns the array of PropertyChoices.

    Returns
    The array of property choices for this property definition or null if there aren't any.

    setPropertyChoices

    public void setPropertyChoices(PropertyChoice[] propertyChoices)
    Sets the array of PropertyChoices.

    Parameters
    propertyChoices - The property choices for this property definition.

    getName

    public String getName()
    Returns the name of this PropertyDefinition. If this is a nested type, the name will reflect the nested hierarchy with Property.NESTED_DELIMITER between each parent and child property definition name. The delimiter is not valid for use within the actual name, only to seperate the parent/child names.

    Returns
    The name of this property definition.

    setName

    public void setName(String name)
    Sets the name of this PropertyDefinition. If this is a nested type, the name will reflect the nested hierarchy with Property.NESTED_DELIMITER between each parent and child property definition name. The delimiter is not valid for use within the actual name, only to seperate the parent/child names.

    Parameters
    name - The name of this property definition.

    getReference

    public String getReference()
    Returns a means by which instances of properties for this PropertyDefinition may be referenced. In the WLP Repository, this is the column name for an explicit property. The property will be stored in the CM_NODE table as opposed to the CM_PROPERTY table. Please see the product documentation for further details about explicit properties.

    Returns
    The reference value. A null value means that instances of this property definition are not referenced.

    setReference

    public void setReference(String reference)
    Sets a means by which all instances of properties for this PropertyDefinition may be referenced. In the WLP Repository, this is the column name for an explicit property. The property will be stored in the CM_NODE table as opposed to the CM_PROPERTY table. Please see the product documentation for further details about explicit properties.

    Parameters
    reference - The reference value. A null value means that instances of this property definition are not referenced.

    getType

    public int getType()
    Gets the defined data type. See constants defined in Property for the valid types.

    Returns
    The data type.

    setType

    public void setType(int type)
    Sets the defined data type id. See constants defined in Property for the valid types.

    Parameters
    type - The data type.

    setObjectClassOps

    @Deprecated
    public void setObjectClassOps(ObjectClassOps objectClassOps)
    Deprecated No longer used.

    Sets the ObjectClassOps to perform objectclass lookup for a nested property. This method exists for VCR usage.

    Parameters
    objectClassOps - The objectClassOps of the SPI for this repository.

    getNestedObjectClass

    public ObjectClass getNestedObjectClass()
                                     throws RepositoryException
    Return the object class associated with this property definition if is type NESTED.

    Returns
    The object class associated with this property definition if is type NESTED.
    Throws
    RepositoryException - If this operation fails.

    getNestedObjectClassId

    public ID getNestedObjectClassId()
    Gets the nested object class id that this property definition represents.

    Returns
    The nested object class id or null if this property definition isn't a type of Property.NESTED

    getPropertyDefinitionType

    public int getPropertyDefinitionType()
    Gets the property definition type for this definition. This will be one of NATIVE, INHERITED or OVERRIDDEN. This is system managed and therefore is not settable.

    Returns
    The property definition type.

    isReadOnly

    public boolean isReadOnly()
    Returns true if a value for the Property cannot be edited.

    Returns
    True if the property is read-only.

    isReadOnly

    public void isReadOnly(boolean isReadOnly)
    Set to true if a value for the Property cannot be edited, or false otherwise.

    Parameters
    isReadOnly - True if the property is read-only.

    setReadOnly

    public void setReadOnly(boolean isReadOnly)
    Set to true if a value for the Property cannot be edited, or false otherwise.

    Parameters
    isReadOnly - True if the property is read-only.

    isRestricted

    public boolean isRestricted()
    Returns true if a value for the Property is restricted to the available choices.

    Returns
    True if the proeprty value(s) is/are restricted.

    isRestricted

    public void isRestricted(boolean isRestricted)
    Set to true if a value for the Property is restricted to the available choices, or false otherwise.

    Parameters
    isRestricted - True if the property value(s) is/are restricted.

    setRestricted

    public void setRestricted(boolean isRestricted)
    Set to true if a value for the Property is restricted to the available choices, or false otherwise.

    Parameters
    isRestricted - True if the property value(s) is/are restricted.

    isMultiValued

    public boolean isMultiValued()
    Returns true if the Property can have multiple values.

    Returns
    True if the property can have multiple values.

    isMultiValued

    public void isMultiValued(boolean isMultiValued)
    Set to true if the Property can have multiple values, false otherwise.

    Parameters
    isMultiValued - True if the property can have multiple values.

    setMultiValued

    public void setMultiValued(boolean isMultiValued)
    Set to true if the Property can have multiple values, false otherwise.

    Parameters
    isMultiValued - True if the property can have multiple values.

    isMandatory

    public boolean isMandatory()
    Returns true if a value for the Property is required.

    Returns
    True if the property requires a value.

    isMandatory

    public void isMandatory(boolean isMandatory)
    Set to true if a value for the Property is required, or false otherwise.

    Parameters
    isMandatory - True if the property requires a value.

    setMandatory

    public void setMandatory(boolean isMandatory)
    Set to true if a value for the Property is required, or false otherwise.

    Parameters
    isMandatory - True if the property requires a value.

    isSortable

    public boolean isSortable()
    Returns true if a value for the Property should be sortable when searching. Defaults to the value of isSearchable() if not explicitly set. The VCR will override an SPI response if the repository is configured to not be searchable. In that case, this will always return false.

    Returns
    True if properties should be sortable by the repository.

    setSortable

    public void setSortable(boolean sortable)
    Set to true if a value for the Property should be sortable when searching. Defaults to the value of isSearchable() if not explicitly set. This value may be ignored by the underlying repository if it cannot support sorting on properties of this type. The value of the isSortable()} call will be accurate when the PropertyDefinition is retrieved.

    Parameters
    sortable - True if properties should be sortable.

    isSearchable

    public boolean isSearchable()
    Returns true if a value for the Property should be searchable.

    Returns
    True if properties should be indexed by the repository's full-text search implementation. The VCR will override an SPI response if the repository is configured to not be searchable. In that case, this will always return false.

    isSearchable

    public void isSearchable(boolean isSearchable)
    Set to true if a value for the Property should be searchable. This value may be ignored by the underlying repository if it cannot support searching on properties of this type. The value of the isSearchable()} call will be accurate when the PropertyDefinition is retrieved.

    Parameters
    isSearchable - True if properties should be indexed by the repository's full-text search implementation.

    setSearchable

    public void setSearchable(boolean isSearchable)
    Set to true if a value for the Property should be searchable. This value may be ignored by the underlying repository if it cannot support searching on properties of this type. The value of the isSearchable()} call will be accurate when the PropertyDefinition is retrieved.

    Parameters
    isSearchable - True if properties should be indexed by the repository's full-text search implementation.

    isNested

    public boolean isNested()
    Indicates whether this PropertyDefinition belongs to an Objectclass that is nested inside another ObjectClass. A code example using nested PropertyDefinitions is provided in this class level javadoc.

    Returns
    True if this property definition is nested.

    isNested

    public void isNested(boolean isNested)
    Indicates whether this PropertyDefinition belongs to an Objectclass that is nested inside another ObjectClass. A code example using nested PropertyDefinitions is provided in this class level javadoc.

    Parameters
    isNested - True if this property definition is nested.

    setNested

    public void setNested(boolean isNested)
    Indicates whether this PropertyDefinition belongs to an Objectclass that is nested inside another ObjectClass. A code example using nested PropertyDefinitions is provided in this class level javadoc.

    Parameters
    isNested - True if this property definition is nested.

    isPrimary

    public boolean isPrimary()
    Returns true if this PropertyDefinition represents the primary PropertyDefinition for its ObjectClass. There may only be one primary PropertyDefinition per ObjectClass. The ObjectClass holds the true relationship to the primary PropertyDefinition. This is an indicator to describe that relationship.

    Returns
    True if this properfy definition is the primary property definition for its containing object class.

    isPrimary

    public void isPrimary(boolean isPrimary)
    Set to true if this PropertyDefinition represents the primary PropertyDefinition for its ObjectClass. There may only be one primary PropertyDefinition per ObjectClass. The ObjectClass holds the true relationship to the primary PropertyDefinition. This is an indicator to describe that relationship.

    Parameters
    isPrimary - True if this properfy definition is the primary property definition for its containing object class.

    setPrimary

    public void setPrimary(boolean isPrimary)
    Set to true if this PropertyDefinition represents the primary PropertyDefinition for its ObjectClass. There may only be one primary PropertyDefinition per ObjectClass. The ObjectClass holds the true relationship to the primary PropertyDefinition. This is an indicator to describe that relationship.

    Parameters
    isPrimary - True if this properfy definition is the primary property definition for its containing object class.

    toString

    public String toString()
    Returns the PropertyDefinition attributs as a String.

    Overrides:
    toString in class ContentEntity

    isObjectClassReadOnly

    public boolean isObjectClassReadOnly()
    A flag indicating if the ObjectClass is read-only because the repository does not support write operations or isn't configured to allow write access to ObjectClasses. If an ObjectClass is read-only, then calling a setter on the ObjectClass or one of its dependent objects (e.g. PropertyDefinition) will thrown a RepositoryRuntimeException when the setter is called.

    Returns
    true if the ObjectClass is read-only.

    clone

    public Object clone()
                 throws CloneNotSupportedException
    Clones a PropertyDefinition with its property choices. Note that binary property choice streams are not cloned, but merely copied.

    Overrides:
    clone in class ContentEntity
    Returns
    A clone of the PropertyDefinition.
    Throws
    CloneNotSupportedException - If the clone fails.

    compareTo

    public int compareTo(PropertyDefinition pd)
    Implements the Comparable interface based on the property definition's name.

    Specified by:
    compareTo in interface Comparable<PropertyDefinition>
    Parameters
    pd - The property definition to compare to.
    Returns
    a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.


    Copyright © 2011, Oracle. All rights reserved.