API:EPrints/DataObj/SubObject

From EPrints Documentation
Revision as of 22:19, 31 December 2021 by Pod2wiki (talk | contribs) (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'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::DataObj::SubObject - virtual class to support sub-objects

User Comments


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 with.

User Comments


CORE METADATA FIELDS

NONE

User Comments


METHODS

User Comments


Constructor Methods

User Comments


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.

User Comments


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.

User Comments


Object Methods

User Comments


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
 

User Comments


set_parent

$parent = $dataobj->set_parent( $parent )

Sets _parent attribute to the provide $parent data object.

User Comments


get_parent_dataset_id

$id = $dataobj->get_parent_dataset_id

Returns the ID of the dataset two which the parent data object belongs.

User Comments


get_parent_id

$id = $dataobj->get_parent_id

Returns the ID of the parent data object.

User Comments


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

User Comments


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.

User Comments


COPYRIGHT

© Copyright 2022 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/.

User Comments