Skip to content
Snippets Groups Projects
Commit f741ca9e authored by Dorian Merz's avatar Dorian Merz
Browse files

Merge branch 'instance/fid' into instance/fid_adlr

parents b73c0e38 9805d7a3
No related merge requests found
......@@ -112,9 +112,13 @@ $config = [
],
'resolver_driver' => [
'factories' => [
'ezb' => 'finc\Resolver\Driver\Factory::getEzb',
'redi' => 'finc\Resolver\Driver\Factory::getRedi'
'finc\Resolver\Driver\Ezb' => 'finc\Resolver\Driver\FincResolverDriverFactory',
'finc\Resolver\Driver\Redi' => 'finc\Resolver\Driver\FincResolverDriverFactory'
],
'aliases' => [
'ezb' => 'finc\Resolver\Driver\Ezb',
'redi' => 'finc\Resolver\Driver\Redi'
]
],
'hierarchy_treedataformatter' => [
'factories' => [
......
......@@ -460,6 +460,18 @@ trait SolrDefaultFincTrait
return isset($this->fields['collection']) ? $this->fields['collection'] : [];
}
/**
* refs #15271
* Check for Multipart resource record level 'set' MARC21 LEADER Pos 19
*
* @return boolean True if record has multiple parts, otherwise False
* @access public
*/
public function isMultiPartSet()
{
return $this->getMultiPart() == 'a' ? true : false;
}
/**
* Get the content of field multipart_set.
*
......
<?php
/**
* Resolver Driver Factory Class
*
* PHP version 5
*
* Copyright (C) Villanova University 2014.
* Copyright (C) Leipzig University Library 2019.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
......@@ -19,58 +16,54 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Resolver_Drivers
* @author Demian Katz <demian.katz@villanova.edu>
* @author Dorian Merz <merz@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:hierarchy_components Wiki
*/
namespace finc\Resolver\Driver;
use Zend\ServiceManager\ServiceManager;
use VuFind\Resolver\Driver\DriverInterface;
use Zend\Config\Config;
use Zend\ServiceManager\Factory\FactoryInterface;
use Interop\Container\ContainerInterface;
/**
* Resolver Driver Factory Class
*
* @category VuFind
* @package Resolver_Drivers
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:hierarchy_components Wiki
*
* @codeCoverageIgnore
*/
class Factory
class FincResolverDriverFactory implements FactoryInterface
{
/**
* Factory for Ezb record driver.
* Create an object
*
* @param ContainerInterface $container Service manager
* @param string $requestedName Service being created
* @param null|array $options Extra options (optional)
*
* @param ServiceManager $sm Service manager.
* @return object
*
* @return Ezb
* @throws ServiceNotFoundException if unable to resolve the service.
* @throws ServiceNotCreatedException if an exception is raised when
* creating a service.
* @throws ContainerException if any other error occurs
*/
public static function getEzb(ServiceManager $sm)
{
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('Resolver');
return new Ezb(
$config->Ezb,
$sm->getServiceLocator()->get('VuFind\Http')->createClient()
public function __invoke(ContainerInterface $container, $requestedName,
array $options = null
) {
$resolverConfig = $this->getResolverConfig($container,$requestedName);
$client = $container->get('VuFindHttp\HttpService')->createClient();
return new $requestedName(
$resolverConfig,
$client
);
}
/**
* Factory for Redi record driver.
*
* @param ServiceManager $sm Service manager.
*
* @return finc\Resolver\Driver\Redi
*/
public static function getRedi(ServiceManager $sm)
{
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('Resolver');
return new Redi(
$config->Redi->url,
$sm->getServiceLocator()->get('VuFind\Http')->createClient()
);
protected function getResolverConfig(ContainerInterface $container,$requestedName) {
/** @var Config $resolverConfig */
$resolverConfig = $container->get('VuFind\Config')->get('Resolver');
$name = $requestedName;
if ($config = $resolverConfig->get($name)) return $config;
$parts = explode('\\',$requestedName);
$name = array_pop($parts);
if ($config = $resolverConfig->get($name)) return $config;
$name = strtolower($name);
if ($config = $resolverConfig->get($name)) return $config;
return null;
}
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment