org.dspace.content
Class MetadataSchema

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

public class MetadataSchema
extends Object

Class representing a schema in DSpace.

The schema object exposes a name which can later be used to generate namespace prefixes in RDF or XML, e.g. the core DSpace Dublin Core schema would have a name of 'dc'.

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

Field Summary
static String DC_SCHEMA
          Short Name of built-in Dublin Core schema.
static int DC_SCHEMA_ID
          Numeric Identifier of built-in Dublin Core schema.
 
Constructor Summary
MetadataSchema()
          Default constructor.
MetadataSchema(int schemaID, String namespace, String name)
          Object constructor.
MetadataSchema(String namespace, String name)
          Immutable object constructor for creating a new schema.
MetadataSchema(TableRow row)
          Constructor for loading the metadata schema from the database.
 
Method Summary
 void create(Context context)
          Creates a new metadata schema in the database, out of this object.
 void delete(Context context)
          Delete the metadata schema.
static MetadataSchema find(Context context, int id)
          Get the schema corresponding with this numeric ID.
static MetadataSchema find(Context context, String shortName)
          Get the schema corresponding with this short name.
static MetadataSchema[] findAll(Context context)
          Return all metadata schemas.
static MetadataSchema findByNamespace(Context context, String namespace)
          Get the schema object corresponding to this namespace URI.
 String getName()
          Get the schema name.
 String getNamespace()
          Get the schema namespace.
 int getSchemaID()
          Get the schema record key number.
 void setName(String name)
          Set the schema name.
 void setNamespace(String namespace)
          Set the schema namespace.
 void update(Context context)
          Update the metadata schema in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DC_SCHEMA_ID

public static final int DC_SCHEMA_ID
Numeric Identifier of built-in Dublin Core schema.

See Also:
Constant Field Values

DC_SCHEMA

public static final String DC_SCHEMA
Short Name of built-in Dublin Core schema.

See Also:
Constant Field Values
Constructor Detail

MetadataSchema

public MetadataSchema()
Default constructor.


MetadataSchema

public MetadataSchema(int schemaID,
                      String namespace,
                      String name)
Object constructor.

Parameters:
schemaID - database key ID number
namespace - XML namespace URI
name - short name of schema

MetadataSchema

public MetadataSchema(String namespace,
                      String name)
Immutable object constructor for creating a new schema.

Parameters:
namespace - XML namespace URI
name - short name of schema

MetadataSchema

public MetadataSchema(TableRow row)
Constructor for loading the metadata schema from the database.

Parameters:
row - table row object from which to populate this schema.
Method Detail

getNamespace

public String getNamespace()
Get the schema namespace.

Returns:
namespace String

setNamespace

public void setNamespace(String namespace)
Set the schema namespace.

Parameters:
namespace - XML namespace URI

getName

public String getName()
Get the schema name.

Returns:
name String

setName

public void setName(String name)
Set the schema name.

Parameters:
name - short name of schema

getSchemaID

public int getSchemaID()
Get the schema record key number.

Returns:
schema record key

create

public void create(Context context)
            throws SQLException,
                   AuthorizeException,
                   NonUniqueMetadataException
Creates a new metadata schema in the database, out of this object.

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

findByNamespace

public static MetadataSchema findByNamespace(Context context,
                                             String namespace)
                                      throws SQLException
Get the schema object corresponding to this namespace URI.

Parameters:
context - DSpace context
namespace - namespace URI to match
Returns:
metadata schema object or null if none found.
Throws:
SQLException

update

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

Parameters:
context - DSpace context
Throws:
SQLException
AuthorizeException
NonUniqueMetadataException

delete

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

Parameters:
context - DSpace context
Throws:
SQLException
AuthorizeException

findAll

public static MetadataSchema[] findAll(Context context)
                                throws SQLException
Return all metadata schemas.

Parameters:
context - DSpace context
Returns:
array of metadata schemas
Throws:
SQLException

find

public static MetadataSchema find(Context context,
                                  int id)
                           throws SQLException
Get the schema corresponding with this 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 schema ID
Returns:
the metadata schema object
Throws:
SQLException

find

public static MetadataSchema find(Context context,
                                  String shortName)
                           throws SQLException
Get the schema corresponding with this short name.

Parameters:
context - context, in case we need to read it in from DB
shortName - the short name for the schema
Returns:
the metadata schema object
Throws:
SQLException


Copyright © 2010 DuraSpace. All Rights Reserved.