Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.endeca.portal.metadata
Class MetadataObject

    java.lang.Object
      com.endeca.portal.metadata.AbstractMetadata
          com.endeca.portal.metadata.MetadataObject

All Implemented Interfaces:
  Metadata

Direct Known Subclasses:
  AttributeDisplayName, AttributeSet, FrameworkSetting, SimpleMetadataObject

    public abstract class MetadataObject

extends AbstractMetadata

Abstract class representing a Metadata Object. This class provides a basic Metadata implementation for getting and setting an Metadata Object's base fields (except for "Type" which is meant to be implementation-specific), storing an instance of the backing Liferay `MetadataRecord`, and managing the Metadata Object's list of Metadata Properties.

Author:
  Endeca Technologies, Inc.

Constructor Summary
`MetadataObject()` Constructor that creates a new Metadata object and its underlying MetadataRecord object.
`MetadataObject(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)` Constructor that creates a new Metadata object and assigns a given MetadataRecord to its underlying object.

Method Summary
`void` | `addProperties(java.util.List<? extends MetadataProperty> properties)` Adds a list of Metadata Properties to this Metadata Object
`void` | `addProperty(MetadataProperty property)` Adds a Metadata Property to this Metadata Object
`boolean` | `equals(java.lang.Object obj)` Indicates whether some other object is "equal to" this one.
`java.util.List<MetadataProperty>` | `getProperties()` Gets a list of Metadata Properties associated with this Metadata Object
`
`<T extends MetadataProperty> java.util.List<T>`
` | `getProperties(java.lang.Class<T> klass)` Get a list of all Metadata Properties associated with this Metadata Object of the specified class (determined using .isInstance)
`com.endeca.portal.liferay.ext.metadata.model.MetadataRecord` | `getSourceRecord()` Gets the Liferay source record
`abstract java.lang.String` | `getType()` Gets the implementation-specific type.
`protected void` | `init(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)` Initializes this AbstractMetadataObject from a MetadataRecord
`void` | `removeAllProperties()` Removes all Metadata Properties from this Metadata Object
`void` | `removeProperties(java.lang.Class<? extends MetadataProperty> klass)` Removes all Metadata Properties from this Metadata Object that are of a particular class
`void` | `removeProperties(java.util.List<? extends MetadataProperty> properties)` Removes each Metadata Property from this Metadata Object provided in a given list based on .equals() equality
`void` | `removeProperty(MetadataProperty property)` Removes a Metadata Property from this Metadata Object based on .equals() equality
`void` | `setSourceRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord rec)` Sets the Liferay source record

Methods inherited from class com.endeca.portal.metadata.AbstractMetadata
`getDescription, getFeature, getKey, getLastUpdated, getLocale, getObjectId, getRel, getSource, getValue, setDescription, setFeature, setKey, setLastUpdated, setLocale, setObjectId, setRel, setSource, setValue, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MetadataObject

    public MetadataObject()

  Constructor that creates a new Metadata object and its underlying MetadataRecord object. The underlying object is initialized with an id of -1 and is not persisted to the database; that must be done explicitly if you want it to be persisted.

### MetadataObject

    public MetadataObject(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)

  Constructor that creates a new Metadata object and assigns a given MetadataRecord to its underlying object. The underlying object is not persisted to the database; that must be done explicitly if you want it to be persisted.

  Parameters:
    `record` - the source MetadataRecord

Method Detail

### init

    protected void init(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)

  Initializes this AbstractMetadataObject from a MetadataRecord

  Parameters:
    `record` - the MetadataRecord from which this Metadata Object should be initialized

### getType

    public abstract java.lang.String getType()

  Gets the implementation-specific type.

  Specified by:
    `getType` in interface `Metadata`
  Specified by:
    `getType` in class `AbstractMetadata`
  Returns:
    the type of metadata this object represents
  See Also:
    `getType()`

### getSourceRecord

    public com.endeca.portal.liferay.ext.metadata.model.MetadataRecord getSourceRecord()

  Gets the Liferay source record

  Returns:
    the source record

### setSourceRecord

    public void setSourceRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord rec)

  Sets the Liferay source record

  Parameters:
    `rec` - the source record

### addProperty

    public void addProperty(MetadataProperty property)

  Adds a Metadata Property to this Metadata Object

  Parameters:
    `property` - the Metadata Property

### addProperties

    public void addProperties(java.util.List<? extends MetadataProperty> properties)

  Adds a list of Metadata Properties to this Metadata Object

  Parameters:
    `properties` - the list of Metadata Properties to add

### getProperties

    public java.util.List<MetadataProperty> getProperties()

  Gets a list of Metadata Properties associated with this Metadata Object

  Returns:
    the list of Metadata Properties

### getProperties

    public <T extends MetadataProperty> java.util.List<T> getProperties(java.lang.Class<T> klass)

  Get a list of all Metadata Properties associated with this Metadata Object of the specified class (determined using .isInstance)

  Type Parameters:
    `T` - an extension of MetadataProperty
  Parameters:
    `klass` - the Class of Metadata Property to retrieve
  Returns:
    the list of Metadata Properties matching the supplied Class type

### removeProperty

    public void removeProperty(MetadataProperty property)

  Removes a Metadata Property from this Metadata Object based on .equals() equality

  Parameters:
    `property` - the Metadata Property

### removeProperties

    public void removeProperties(java.util.List<? extends MetadataProperty> properties)

  Removes each Metadata Property from this Metadata Object provided in a given list based on .equals() equality

  Parameters:
    `properties` - the list of Metadata Properties to remove

### removeProperties

    public void removeProperties(java.lang.Class<? extends MetadataProperty> klass)

  Removes all Metadata Properties from this Metadata Object that are of a particular class

  Parameters:
    `klass` - the Class of Metadata Property to be removed.

### removeAllProperties

    public void removeAllProperties()

  Removes all Metadata Properties from this Metadata Object

### equals

    public boolean equals(java.lang.Object obj)

  Indicates whether some other object is "equal to" this one. Returns true if the other object is a MetadataObject and its object ID is the same as this one's ID. If the object ID is -1 for either this object or the other object, false will be returned. TODO: What actually should happen when the object ID is -1?

  Overrides:
    `equals` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD