Difference between revisions of "API:EPrints/DataObj/SubObject"
(Created page with "<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment'...") |
|||
Line 19: | Line 19: | ||
This virtual class provides some utility methods to objects that are sub-objects of other data objects. | This virtual class provides some utility methods to objects that are sub-objects of other data objects. | ||
− | It expects to find | + | It expects to find <tt>datasetid</tt> and <tt>objectid</tt> fields to identify the parent object. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
Revision as of 22:21, 31 December 2021
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
Contents
NAME
EPrints::DataObj::SubObject - virtual class to support sub-objects
DESCRIPTION
This virtual class provides some utility methods to objects that are sub-objects of other data objects.
It expects to find datasetid and objectid fields to identify the parent object.
CORE METADATA FIELDS
NONE
METHODS
Constructor Methods
new_from_data
$dataobj = EPrints::DataObj::SubObject->new_from_data( $session, $data, [ $dataset ] )
Constructs and returns a new sub-object from the $data provided.
Looks for a special _parent element in $data and uses it to set the parent object, if defined.
$dataset is determined from the class if not provided.
create_from_data
$dataobj = EPrints::DataObj::SubObject->create_from_data( $session, $data, [ $dataset ] )
Creates and returns a new sub-object from the $data provided.
Looks for a special _parent element in $data and uses it to create default values for datasetid and objectid if parent is available and those fields exist on the object.
$dataset is determined from the class if not provided.
Object Methods
get_parent
$parent = $dataobj->get_parent( [ $datasetid, $objectid ] )
Gets and caches the parent data object. If $datasetid and/or $objectid are specified uses these values rather than the stored values.
Subsequent calls to get_parent will return the cached object, regardless of $datasetid and $objectid.
Has alias:
$dataobj->parent
set_parent
$parent = $dataobj->set_parent( $parent )
Sets _parent attribute to the provide $parent data object.
get_parent_dataset_id
$id = $dataobj->get_parent_dataset_id
Returns the ID of the dataset two which the parent data object belongs.
get_parent_id
$id = $dataobj->get_parent_id
Returns the ID of the parent data object.
permit
$r = $dataobj->permit( $priv, [ $user ] )
Checks parent data object for as well as this data object gives permission for $priv. If $user specified then permissions must also be applicable to that user.
Returns true if permitted, otherwise returns false
has_owner
$dataobj->has_owner( $user )
Check whether the $user provided is the owner of this sub-object, which is determined by checking the owner of the parent data object.
Returns true if parent data object exists and has $user as the owner. Otherwise, returns false.
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.