org.dspace.content
Class MetadataField

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

public class MetadataField
extends Object

DSpace object that represents a metadata field, which is defined by a combination of schema, element, and qualifier. Every metadata element belongs in a field.

Version:
$Revision: 3761 $
Author:
Martin Hald
See Also:
org.dspace.content.MetadataValue, org.dspace.content.MetadataSchema

Constructor Summary
MetadataField()
          Default constructor.
MetadataField(int schemaID, int fieldID, String element, String qualifier, String scopeNote)
          Full construtor for existing metadata field elements.
MetadataField(MetadataSchema schema)
          Constructor creating a field within a schema.
MetadataField(MetadataSchema schema, String element, String qualifier, String scopeNote)
          Full contructor for new metadata field elements.
MetadataField(TableRow row)
          Constructor to load the object from the database.
 
Method Summary
 void create(Context context)
          Creates a new metadata field.
 void delete(Context context)
          Delete the metadata field.
static MetadataField find(Context context, int id)
          Find the field corresponding to the given numeric ID.
static MetadataField[] findAll(Context context)
          Retrieve all Dublin Core types from the registry
static MetadataField[] findAllInSchema(Context context, int schemaID)
          Return all metadata fields that are found in a given schema.
static MetadataField findByElement(Context context, int schemaID, String element, String qualifier)
          Retrieves the metadata field from the database.
static String formKey(String schema, String element, String qualifier)
          Return the HTML FORM key for the given field.
 String getElement()
          Get the element name.
 int getFieldID()
          Get the metadata field id.
 String getQualifier()
          Get the qualifier.
 int getSchemaID()
          Get the schema record key.
 String getScopeNote()
          Get the scope note.
 void setElement(String element)
          Set the element name.
 void setQualifier(String qualifier)
          Set the qualifier.
 void setSchemaID(int schemaID)
          Set the schema record key.
 void setScopeNote(String scopeNote)
          Set the scope note.
 void update(Context context)
          Update the metadata field in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataField

public MetadataField()
Default constructor.


MetadataField

public MetadataField(MetadataSchema schema)
Constructor creating a field within a schema.

Parameters:
schema - schema to which the field belongs

MetadataField

public MetadataField(MetadataSchema schema,
                     String element,
                     String qualifier,
                     String scopeNote)
Full contructor for new metadata field elements.

Parameters:
schema - schema to which the field belongs
element - element of the field
qualifier - qualifier of the field
scopeNote - scope note of the field

MetadataField

public MetadataField(int schemaID,
                     int fieldID,
                     String element,
                     String qualifier,
                     String scopeNote)
Full construtor for existing metadata field elements.

Parameters:
schemaID - schema to which the field belongs
fieldID - dataabse ID of field.
element - element of the field
qualifier - qualifier of the field
scopeNote - scope note of the field

MetadataField

public MetadataField(TableRow row)
Constructor to load the object from the database.

Parameters:
row - database row from which to populate object.
Method Detail

getElement

public String getElement()
Get the element name.

Returns:
element name

setElement

public void setElement(String element)
Set the element name.

Parameters:
element - new value for element

getFieldID

public int getFieldID()
Get the metadata field id.

Returns:
metadata field id

getQualifier

public String getQualifier()
Get the qualifier.

Returns:
qualifier

setQualifier

public void setQualifier(String qualifier)
Set the qualifier.

Parameters:
qualifier - new value for qualifier

getSchemaID

public int getSchemaID()
Get the schema record key.

Returns:
schema record key

setSchemaID

public void setSchemaID(int schemaID)
Set the schema record key.

Parameters:
schemaID - new value for key

getScopeNote

public String getScopeNote()
Get the scope note.

Returns:
scope note

setScopeNote

public void setScopeNote(String scopeNote)
Set the scope note.

Parameters:
scopeNote - new value for scope note

create

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

Parameters:
context - DSpace context object
Throws:
IOException
AuthorizeException
SQLException
NonUniqueMetadataException

findByElement

public static MetadataField findByElement(Context context,
                                          int schemaID,
                                          String element,
                                          String qualifier)
                                   throws SQLException,
                                          AuthorizeException
Retrieves the metadata field from the database.

Parameters:
context - dspace context
schemaID - schema by ID
element - element name
qualifier - qualifier (may be ANY or null)
Returns:
recalled metadata field
Throws:
SQLException
AuthorizeException

findAll

public static MetadataField[] findAll(Context context)
                               throws SQLException
Retrieve all Dublin Core types from the registry

Parameters:
context - dspace context
Returns:
an array of all the Dublin Core types
Throws:
SQLException

findAllInSchema

public static MetadataField[] findAllInSchema(Context context,
                                              int schemaID)
                                       throws SQLException
Return all metadata fields that are found in a given schema.

Parameters:
context - dspace context
schemaID - schema by db ID
Returns:
array of metadata fields
Throws:
SQLException

update

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

Parameters:
context - dspace context
Throws:
SQLException
AuthorizeException
NonUniqueMetadataException
IOException

delete

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

Parameters:
context - dspace context
Throws:
SQLException
AuthorizeException

formKey

public static String formKey(String schema,
                             String element,
                             String qualifier)
Return the HTML FORM key for the given field.

Parameters:
schema -
element -
qualifier -
Returns:
HTML FORM key

find

public static MetadataField find(Context context,
                                 int id)
                          throws SQLException
Find the field corresponding to the given numeric ID. The ID is a database key internal to DSpace.

Parameters:
context - context, in case we need to read it in from DB
id - the metadata field ID
Returns:
the metadata field object
Throws:
SQLException


Copyright © 2010 DuraSpace. All Rights Reserved.