From 16687de2e0f130761b8821d9b0e2df630f3c4c9e Mon Sep 17 00:00:00 2001 From: DiegoPino Date: Fri, 30 Oct 2015 14:20:49 -0300 Subject: [PATCH] ISLANDORA-1522 global UUID setting enforcement Addresses https://jira.duraspace.org/browse/ISLANDORA-1522 Added local methods(override) to handle global UUID settings. Changed default valued for $create_uuid to NULL to allow developers to override the global setting if needed. This pull is part of a series of other pulls to make this change apply to other modules --- includes/tuque_wrapper.inc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index ef2a2991..138be9b2 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -125,6 +125,29 @@ class IslandoraFedoraRepository extends FedoraRepository { throw $e; } } + + /** + * Constructs a Fedora Object. + * @see FedoraRepository::constructObject + */ + public function constructObject($id = NULL, $create_uuid = NULL) { + // Enforces uuid when set, but allows to override if called + // with $create_uuid set to bool. + $create_uuid = is_null($create_uuid) ? variable_get('islandora_basic_collection_generate_uuid', FALSE) : $create_uuid; + return parent::constructObject($id, $create_uuid); + } + + /** + * Get the next PID(s) from Repo. + * + * @see FedoraRepository::getNextIdentifier() + */ + public function getNextIdentifier($namespace = NULL, $create_uuid = NULL, $count = 1) { + // Enforces uuid when set, but allows to override if called + // with $create_uuid set to bool. + $create_uuid = is_null($create_uuid) ? variable_get('islandora_basic_collection_generate_uuid', FALSE) : $create_uuid; + return parent::getNextIdentifier($namespace, $create_uuid, $count); + } } class IslandoraRepositoryQuery extends RepositoryQuery {}