|
1
|
|
|
<?php |
|
2
|
|
|
namespace EWW\Dpf\Services\ElasticSearch; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
class ElasticsearchMapper |
|
18
|
|
|
{ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* [$documentRepository description] |
|
22
|
|
|
* @var \EWW\Dpf\Domain\Repository\DocumentRepository |
|
23
|
|
|
* @inject |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $documentRepository = null; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* clientConfigurationManager |
|
29
|
|
|
* |
|
30
|
|
|
* @var \EWW\Dpf\Configuration\ClientConfigurationManager |
|
31
|
|
|
* @inject |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $clientConfigurationManager; |
|
34
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* document2json |
|
38
|
|
|
* @param Document $document [description] |
|
|
|
|
|
|
39
|
|
|
* @return json Elasticsearch json format |
|
|
|
|
|
|
40
|
|
|
*/ |
|
41
|
|
|
public function getElasticsearchJson($document) |
|
42
|
|
|
{ |
|
43
|
|
|
// document 2 json |
|
44
|
|
|
//$fedoraHost = $this->clientConfigurationManager->getFedoraHost(); |
|
45
|
|
|
|
|
46
|
|
|
// load xslt from fedora |
|
47
|
|
|
//$xsltDoc = 'http://' . $fedoraHost . '/fedora/objects/qucosa:XSLT/datastreams/METS-MODS-XML2JSON/content'; |
|
48
|
|
|
|
|
49
|
|
|
$xsltDoc = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:dpf/Resources/Private/mets-mods-xml2json.xsl'); |
|
50
|
|
|
|
|
51
|
|
|
// xslt |
|
52
|
|
|
$xsl = new \DOMDocument; |
|
53
|
|
|
|
|
54
|
|
|
$xsl->load($xsltDoc); |
|
55
|
|
|
|
|
56
|
|
|
$exporter = new \EWW\Dpf\Services\MetsExporter(); |
|
57
|
|
|
$fileData = $document->getFileData(); |
|
58
|
|
|
$exporter->setFileData($fileData); |
|
59
|
|
|
|
|
60
|
|
|
// slub:info |
|
61
|
|
|
$exporter->setSlubInfo($document->getSlubInfoData()); |
|
62
|
|
|
|
|
63
|
|
|
$exporter->setMods($document->getXmlData()); |
|
64
|
|
|
|
|
65
|
|
|
$exporter->setObjId($document->getObjectIdentifier()); |
|
66
|
|
|
|
|
67
|
|
|
$exporter->buildMets(); |
|
68
|
|
|
$metsXml = $exporter->getMetsData(); |
|
69
|
|
|
|
|
70
|
|
|
$xml = new \DOMDocument; |
|
71
|
|
|
$xml->loadXML($metsXml); |
|
72
|
|
|
|
|
73
|
|
|
// xslt processing |
|
74
|
|
|
$proc = new \XSLTProcessor; |
|
75
|
|
|
$proc->importStyleSheet($xsl); // XSL Document importieren |
|
76
|
|
|
|
|
77
|
|
|
$json = $proc->transformToXML($xml); |
|
78
|
|
|
|
|
79
|
|
|
return $json; |
|
|
|
|
|
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
} |
|
83
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths