Difference between revisions of "API:EPrints/DataObj"
Line 10: | Line 10: | ||
'''EPrints::DataObj''' - Base class for records in EPrints. | '''EPrints::DataObj''' - Base class for records in EPrints. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 46: | Line 46: | ||
$plugin_output = $dataobj->export( $plugin_id [,%params] ) | $plugin_output = $dataobj->export( $plugin_id [,%params] ) | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 83: | Line 83: | ||
###################################################################### =pod | ###################################################################### =pod | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 95: | Line 95: | ||
If $dataset is not defined uses the default dataset for this object. | If $dataset is not defined uses the default dataset for this object. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 105: | Line 105: | ||
Returns the EPrints::Handle object to which this record belongs. | Returns the EPrints::Handle object to which this record belongs. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 117: | Line 117: | ||
Return true if successful. | Return true if successful. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 131: | Line 131: | ||
Commit may also queue indexer jobs or log changes, depending on the object. | Commit may also queue indexer jobs or log changes, depending on the object. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 141: | Line 141: | ||
Get a the value of a metadata field. If the field is not set then it returns undef unless the field has the property multiple set, in which case it returns [] (a reference to an empty array). | Get a the value of a metadata field. If the field is not set then it returns undef unless the field has the property multiple set, in which case it returns [] (a reference to an empty array). | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 151: | Line 151: | ||
Set the value of the named metadata field in this record. | Set the value of the named metadata field in this record. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 163: | Line 163: | ||
For example "author.id/editor.id" would return a list of all author and editor ids from this record. | For example "author.id/editor.id" would return a list of all author and editor ids from this record. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 173: | Line 173: | ||
Returns a reference to the hash table of all the metadata for this record keyed by fieldname. | Returns a reference to the hash table of all the metadata for this record keyed by fieldname. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 185: | Line 185: | ||
Warns if the field does not exist. | Warns if the field does not exist. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 199: | Line 199: | ||
This method is useful for plugins which may operate on multiple repositories, and the fact a field does not exist is not an issue. | This method is useful for plugins which may operate on multiple repositories, and the fact a field does not exist is not an issue. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 209: | Line 209: | ||
Returns the rendered version of the value of the given field, as appropriate for the current session. If $showall is true then all values are rendered - this is usually used for staff viewing data. | Returns the rendered version of the value of the given field, as appropriate for the current session. If $showall is true then all values are rendered - this is usually used for staff viewing data. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 219: | Line 219: | ||
Renders the record as a citation. If $style is set then it uses that citation style from the citations config file. Otherwise $style defaults to the type of this record. If $params{url} is set then the citiation will link to the specified URL. | Renders the record as a citation. If $style is set then it uses that citation style from the citations config file. Otherwise $style defaults to the type of this record. If $params{url} is set then the citiation will link to the specified URL. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 229: | Line 229: | ||
Renders a citation (as above) but as a link to the URL for this item. For example - the abstract page of an eprint. | Renders a citation (as above) but as a link to the URL for this item. For example - the abstract page of an eprint. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 239: | Line 239: | ||
As for render_citation_link but the link goes to the edit URL for the item. | As for render_citation_link but the link goes to the edit URL for the item. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 249: | Line 249: | ||
Returns a short description of this object using the "brief" citation style for this dataset. | Returns a short description of this object using the "brief" citation style for this dataset. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 259: | Line 259: | ||
Return a chunk of XHTML DOM describing this object in the normal way. This is the public view of the record, not the staff view. | Return a chunk of XHTML DOM describing this object in the normal way. This is the public view of the record, not the staff view. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 269: | Line 269: | ||
Return an XHTML table in DOM describing this record. All values of all fields are listed. This is the staff view. | Return an XHTML table in DOM describing this record. All values of all fields are listed. This is the staff view. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 279: | Line 279: | ||
Returns the value of the primary key of this record. | Returns the value of the primary key of this record. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 289: | Line 289: | ||
Returns the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs. | Returns the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 301: | Line 301: | ||
The URI is generally of the form <em>repository_url</em>/id/<em>datasetid</em>/<em>dataobj_id</em> | The URI is generally of the form <em>repository_url</em>/id/<em>datasetid</em>/<em>dataobj_id</em> | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 311: | Line 311: | ||
Returns the URL for this record, for example the URL of the abstract page of an eprint. | Returns the URL for this record, for example the URL of the abstract page of an eprint. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 321: | Line 321: | ||
Returns the URL for the control page for this object. | Returns the URL for the control page for this object. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 331: | Line 331: | ||
Apply an output plugin to this items. Return the results. No additional parameters are required for most export plugins. | Apply an output plugin to this items. Return the results. No additional parameters are required for most export plugins. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 343: | Line 343: | ||
It's false on most dataobjs, except those which override this method. | It's false on most dataobjs, except those which override this method. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 355: | Line 355: | ||
Defaults to true. Which doesn't mean that they have the right to edit it, just that their scope matches. You also need editor rights to use this. It's currently used just to filter eprint editors so that only ones with a scope AND a priv can edit. | Defaults to true. Which doesn't mean that they have the right to edit it, just that their scope matches. You also need editor rights to use this. It's currently used just to filter eprint editors so that only ones with a scope AND a priv can edit. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 369: | Line 369: | ||
A reference to an empty array indicates no problems. | A reference to an empty array indicates no problems. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 381: | Line 381: | ||
A reference to an empty array indicates no problems. | A reference to an empty array indicates no problems. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 393: | Line 393: | ||
Returns the file object or undef if the storage failed. | Returns the file object or undef if the storage failed. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 405: | Line 405: | ||
Returns the file object or undef if the file doesn't exist. | Returns the file object or undef if the file doesn't exist. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 422: | Line 422: | ||
$dataobj->remove_object_relations( $target [, $has => $is [, $has => $is ] ) | $dataobj->remove_object_relations( $target [, $has => $is [, $has => $is ] ) | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 434: | Line 434: | ||
You must commit $target after calling this method. | You must commit $target after calling this method. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 446: | Line 446: | ||
If @types is empty will return true if any relationships exist. | If @types is empty will return true if any relationships exist. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 456: | Line 456: | ||
Returns true if get_related_objects() would return some objects, but without actually retrieving the related objects from the database. | Returns true if get_related_objects() would return some objects, but without actually retrieving the related objects from the database. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 466: | Line 466: | ||
Returns a list of objects related to this object by @types. | Returns a list of objects related to this object by @types. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> | ||
Line 478: | Line 478: | ||
You must commit $target after calling this method. | You must commit $target after calling this method. | ||
− | <div style='background-color: # | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
<h4><span style='display:none'>User Comments</span></h4> | <h4><span style='display:none'>User Comments</span></h4> | ||
<!-- Edit below this comment --> | <!-- Edit below this comment --> |
Revision as of 14:03, 24 August 2009
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
NAME
EPrints::DataObj - Base class for records in EPrints.
SYNOPSIS
$dataobj = EPrints::DataObj->new( $handle, $id [, $dataset] ) $handle = $dataobj->get_handle $dataset = $dataobj->get_dataset $id = $dataobj->get_id $uri = $dataobj->uri $url = $dataobj->get_url $url = $dataobj->get_control_url $value = $dataobj->get_value( $fieldname ) $bool = $dataobj->is_set( $fieldname ) $bool = $dataobj->exists_and_set( $fieldname ) $success = $dataobj->remove $dataobj->set_value( $fieldname, $value ) $success = $dataobj->commit( [$force] ) $xhtml = $dataobj->render_value( $fieldname, [$showall] ) $xhtml = $dataobj->render_citation( [$style], [%params] ) $xhtml = $dataobj->render_citation_link( [$style], %params ) $xhtml = $dataobj->render_citation_link_staff( [$style], %params ) $xhtml = $dataobj->render_description ($xhtml, $title ) = $dataobj->render ($xhtml, $title ) = $dataobj->render_full $plugin_output = $dataobj->export( $plugin_id [,%params] )
DESCRIPTION
This module is a base class which is inherited by EPrints::DataObj::EPrint, EPrints::User, EPrints::DataObj::Subject and EPrints::DataObj::Document and several other classes.
It is ABSTRACT - these methods should not be called directly.
To create a new object in the database use: $obj = $ds->create_object( $handle, $data ); =cut
- #
- INSTANCE VARIABLES: #
- $self->{data} # A reference to a hash containing the metadata of this # record. #
- $self->{handle} # The current EPrints::Handle #
- $self->{dataset} # The EPrints::DataSet to which this record belongs. #
package EPrints::DataObj;
use MIME::Base64 ();
use strict;
- # $sys_fields = EPrints::DataObj->get_system_field_info # # Return an array describing the system metadata of the this # dataset. ######################################################################
sub get_system_field_info { my( $class ) = @_;
return (); }
- =pod
$dataobj = EPrints::DataObj->new( $handle, $id [, $dataset] )
Return new data object, created by loading it from the database.
If $dataset is not defined uses the default dataset for this object.
$handle = $dataobj->get_handle
Returns the EPrints::Handle object to which this record belongs.
$success = $dataobj->remove
Remove this data object from the database and any sub-objects or related files.
Return true if successful.
$success = $dataobj->commit( [$force] )
Write this object to the database and reset the changed fields.
If $force isn't true then it only actually modifies the database if one or more fields have been changed.
Commit may also queue indexer jobs or log changes, depending on the object.
$value = $dataobj->get_value( $fieldname )
Get a the value of a metadata field. If the field is not set then it returns undef unless the field has the property multiple set, in which case it returns [] (a reference to an empty array).
$dataobj->set_value( $fieldname, $value )
Set the value of the named metadata field in this record.
@values = $dataobj->get_values( $fieldnames )
Returns a list of all the values in this record of all the fields specified by $fieldnames. $fieldnames should be in the format used by browse views - slash seperated fieldnames with an optional .id suffix to indicate the id part rather than the main part.
For example "author.id/editor.id" would return a list of all author and editor ids from this record.
$data = $dataobj->get_data
Returns a reference to the hash table of all the metadata for this record keyed by fieldname.
$bool = $dataobj->is_set( $fieldname )
Returns true if the named field is set in this record, otherwise false.
Warns if the field does not exist.
$bool = $dataobj->exists_and_set( $fieldname )
Returns true if the named field is set in this record, otherwise false.
If the field does not exist, just return false.
This method is useful for plugins which may operate on multiple repositories, and the fact a field does not exist is not an issue.
$xhtml = $dataobj->render_value( $fieldname, [$showall] )
Returns the rendered version of the value of the given field, as appropriate for the current session. If $showall is true then all values are rendered - this is usually used for staff viewing data.
$xhtml = $dataobj->render_citation( [$style], [%params] )
Renders the record as a citation. If $style is set then it uses that citation style from the citations config file. Otherwise $style defaults to the type of this record. If $params{url} is set then the citiation will link to the specified URL.
$xhtml = $dataobj->render_citation_link( [$style], %params )
Renders a citation (as above) but as a link to the URL for this item. For example - the abstract page of an eprint.
$xhtml = $dataobj->render_citation_link_staff( [$style], %params )
As for render_citation_link but the link goes to the edit URL for the item.
$xhtml = $dataobj->render_description
Returns a short description of this object using the "brief" citation style for this dataset.
($xhtml, $title ) = $dataobj->render
Return a chunk of XHTML DOM describing this object in the normal way. This is the public view of the record, not the staff view.
($xhtml, $title ) = $dataobj->render_full
Return an XHTML table in DOM describing this record. All values of all fields are listed. This is the staff view.
$id = $dataobj->get_id
Returns the value of the primary key of this record.
$dataset = $dataobj->get_dataset
Returns the EPrints::DataSet object to which this record belongs.
$uri = $dataobj->uri
Returns a unique URI for this object. Not certain to resolve as a URL.
The URI is generally of the form repository_url/id/datasetid/dataobj_id
$url = $dataobj->get_url
Returns the URL for this record, for example the URL of the abstract page of an eprint.
$url = $dataobj->get_control_url
Returns the URL for the control page for this object.
$plugin_output = $dataobj->export( $plugin_id [,%params] )
Apply an output plugin to this items. Return the results. No additional parameters are required for most export plugins.
$boolean = $dataobj->has_owner( $user )
Return true if $user owns this record. Normally this means they created it, but a group of users could count as owners of the same record if you wanted.
It's false on most dataobjs, except those which override this method.
$boolean = $dataobj->in_editorial_scope_of( $user )
As for has_owner, but if the user is identified as someone with an editorial scope which includes this record.
Defaults to true. Which doesn't mean that they have the right to edit it, just that their scope matches. You also need editor rights to use this. It's currently used just to filter eprint editors so that only ones with a scope AND a priv can edit.
$problems = $dataobj->validate( [ $for_archive ], $workflow_id )
Return a reference to an array of XHTML DOM objects describing validation problems with the entire $dataobj based on $workflow_id.
If $workflow_id is undefined defaults to "default".
A reference to an empty array indicates no problems.
$warnings = $dataobj->get_warnings( )
Return a reference to an array of XHTML DOM objects describing problems with the entire $dataobj.
A reference to an empty array indicates no problems.
$file = $dataobj->add_stored_file( $filename, $filehandle [, $filesize ] )
Convenience method to add the file record for $filename to this object. Reads data from $filehandle. If $filesize is defined it may used to determine where the file should be stored.
Returns the file object or undef if the storage failed.
$file = $dataobj->get_stored_file( $filename )
Get the file object for $filename.
Returns the file object or undef if the file doesn't exist.
Related Objects
These methods have been introduced in ep3.2 to describe the relationships between objects in the system.
See the wiki for more detailed discussion of how to use these.
$dataobj->add_object_relations( $target, $has => $is [, $has => $is ] ) $bool = $dataobj->has_object_relations( $target, @types ) $bool = $dataobj->has_related_objects( @types ) $dataobjs = $dataobj->get_related_objects( @types ) $dataobj->remove_object_relations( $target [, $has => $is [, $has => $is ] )
$dataobj->add_object_relations( $target, $has => $is [, $has => $is ] )
Add a relation between this object and $target of type $has. If $is is defined will also add the reciprocal relationship $is from $target to this object. May be repeated to add multiple relationships.
You must commit $target after calling this method.
$bool = $dataobj->has_object_relations( $target, @types )
Returns true if this object is related to $target by all @types.
If @types is empty will return true if any relationships exist.
Returns true if get_related_objects() would return some objects, but without actually retrieving the related objects from the database.
Returns a list of objects related to this object by @types.
$dataobj->remove_object_relations( $target [, $has => $is [, $has => $is ] )
Remove relations between this object and $target. If $has => $is pairs are defined will only remove those relationships given.
You must commit $target after calling this method.