org.dspace.content
Class MetadataValue

java.lang.Object
  extended by org.dspace.content.MetadataValue

public class MetadataValue
extends Object

Database access class representing a Dublin Core metadata value. It represents a value of a given MetadataField on an Item. (The Item can have many values of the same field.) It contains element, qualifier, value and language. the field (which names the schema, element, and qualifer), language, and a value.

Author:
Martin Hald
See Also:
org.dspace.content.MetadataSchema, org.dspace.content.MetadataField

Field Summary
 String language
          The language of the field, may be null
 int place
          The position of the record.
 String value
          The value of the field
 
Constructor Summary
MetadataValue()
          Default constructor.
MetadataValue(MetadataField field)
          Constructor to create a value for a given field.
MetadataValue(TableRow row)
          Construct the metadata object from the matching database row.
 
Method Summary
 void create(Context context)
          Creates a new metadata value.
 void delete(Context context)
          Delete the metadata field.
static MetadataValue find(Context context, int valueId)
          Retrieves the metadata value from the database.
static Collection findByField(Context context, int fieldId)
          Retrieves the metadata values for a given field from the database.
 int getFieldId()
          Get the field ID the metadata value represents.
 int getItemId()
          Get the item ID.
 String getLanguage()
          Get the language (e.g.
 int getPlace()
          Get the place ordering.
 String getValue()
          Get the metadata value.
 int getValueId()
          Get the value ID.
 void setFieldId(int fieldId)
          Set the field ID that the metadata value represents.
 void setItemId(int itemId)
          Set the item ID.
 void setLanguage(String language)
          Set the language (e.g.
 void setPlace(int place)
          Set the place ordering.
 void setValue(String value)
          Set the metadata value
 void update(Context context)
          Update the metadata value in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

public String value
The value of the field


language

public String language
The language of the field, may be null


place

public int place
The position of the record.

Constructor Detail

MetadataValue

public MetadataValue(TableRow row)
Construct the metadata object from the matching database row.

Parameters:
row - database row to use for contents

MetadataValue

public MetadataValue()
Default constructor.


MetadataValue

public MetadataValue(MetadataField field)
Constructor to create a value for a given field.

Parameters:
field - inital value for field
Method Detail

getFieldId

public int getFieldId()
Get the field ID the metadata value represents.

Returns:
metadata field ID

setFieldId

public void setFieldId(int fieldId)
Set the field ID that the metadata value represents.

Parameters:
fieldId - new field ID

getItemId

public int getItemId()
Get the item ID.

Returns:
item ID

setItemId

public void setItemId(int itemId)
Set the item ID.

Parameters:
itemId - new item ID

getLanguage

public String getLanguage()
Get the language (e.g. "en").

Returns:
language

setLanguage

public void setLanguage(String language)
Set the language (e.g. "en").

Parameters:
language - new language

getPlace

public int getPlace()
Get the place ordering.

Returns:
place ordering

setPlace

public void setPlace(int place)
Set the place ordering.

Parameters:
place - new place (relative order in series of values)

getValueId

public int getValueId()
Get the value ID.

Returns:
value ID

getValue

public String getValue()
Get the metadata value.

Returns:
metadata value

setValue

public void setValue(String value)
Set the metadata value

Parameters:
value - new metadata value

create

public void create(Context context)
            throws SQLException,
                   AuthorizeException
Creates a new metadata value.

Parameters:
context - DSpace context object
Throws:
SQLException
AuthorizeException

find

public static MetadataValue find(Context context,
                                 int valueId)
                          throws IOException,
                                 SQLException,
                                 AuthorizeException
Retrieves the metadata value from the database.

Parameters:
context - dspace context
valueId - database key id of value
Returns:
recalled metadata value
Throws:
IOException
SQLException
AuthorizeException

findByField

public static Collection findByField(Context context,
                                     int fieldId)
                              throws IOException,
                                     SQLException,
                                     AuthorizeException
Retrieves the metadata values for a given field from the database.

Parameters:
context - dspace context
fieldId - field whose values to look for
Returns:
a collection of metadata values
Throws:
IOException
SQLException
AuthorizeException

update

public void update(Context context)
            throws SQLException,
                   AuthorizeException
Update the metadata value in the database.

Parameters:
context - dspace context
Throws:
SQLException
AuthorizeException

delete

public void delete(Context context)
            throws SQLException,
                   AuthorizeException
Delete the metadata field.

Parameters:
context - dspace context
Throws:
SQLException
AuthorizeException


Copyright © 2008 The DSpace Foundation. All Rights Reserved.