Skip to content

Commit 4b97519

Browse files
committed
MERGE: Merge branch '4.0' into master
2 parents 0f8a0b2 + b6b533e commit 4b97519

18 files changed

Lines changed: 78 additions & 188 deletions

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ matrix:
1818

1919
before_install:
2020
- export NEOS_TARGET_VERSION=3.0
21-
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
2221
- cd ..
2322
- if [ "$ES" = 1 ]; then wget --no-check-certificate https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.6.zip && unzip elasticsearch-1.7.6.zip && mv elasticsearch-1.7.6 elasticsearch; fi
2423
- if [ "$ES" = 2 ]; then wget --no-check-certificate https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.6.zip && unzip elasticsearch-2.4.6.zip && mv elasticsearch-2.4.6 elasticsearch; fi

Classes/Command/NodeIndexCommandController.php

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,23 @@
1212
*/
1313

1414
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Indexer\Error\ErrorInterface;
15+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\NodeTypeMappingBuilderInterface;
1516
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\LoggerInterface;
1617
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Service\ErrorHandlingService;
1718
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Service\IndexWorkspaceTrait;
18-
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\NodeTypeMappingBuilderInterface;
1919
use Flowpack\ElasticSearch\Domain\Model\Mapping;
2020
use Flowpack\ElasticSearch\Transfer\Exception\ApiException;
2121
use Neos\ContentRepository\Domain\Factory\NodeFactory;
2222
use Neos\ContentRepository\Domain\Model\Workspace;
2323
use Neos\ContentRepository\Domain\Repository\NodeDataRepository;
2424
use Neos\ContentRepository\Domain\Repository\WorkspaceRepository;
2525
use Neos\ContentRepository\Domain\Service\ContentDimensionPresetSourceInterface;
26-
use Neos\ContentRepository\Domain\Service\Context;
27-
use Neos\ContentRepository\Domain\Service\ContextFactoryInterface;
2826
use Neos\ContentRepository\Search\Indexer\NodeIndexerInterface;
2927
use Neos\Flow\Annotations as Flow;
3028
use Neos\Flow\Cli\CommandController;
3129
use Neos\Flow\Configuration\ConfigurationManager;
3230
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
31+
use Neos\Neos\Controller\CreateContentContextTrait;
3332
use Symfony\Component\Yaml\Yaml;
3433

3534
/**
@@ -41,6 +40,8 @@ class NodeIndexCommandController extends CommandController
4140
{
4241
use IndexWorkspaceTrait;
4342

43+
use CreateContentContextTrait;
44+
4445
/**
4546
* @Flow\Inject
4647
* @var ErrorHandlingService
@@ -95,12 +96,6 @@ class NodeIndexCommandController extends CommandController
9596
*/
9697
protected $configurationManager;
9798

98-
/**
99-
* @Flow\Inject
100-
* @var ContextFactoryInterface
101-
*/
102-
protected $contextFactory;
103-
10499
/**
105100
* @var array
106101
*/
@@ -311,31 +306,6 @@ public function cleanupCommand()
311306
}
312307
}
313308

314-
/**
315-
* Create a ContentContext based on the given workspace name
316-
*
317-
* @param string $workspaceName Name of the workspace to set for the context
318-
* @param array $dimensions Optional list of dimensions and their values which should be set
319-
* @return Context
320-
*/
321-
protected function createContentContext($workspaceName, array $dimensions = [])
322-
{
323-
$contextProperties = [
324-
'workspaceName' => $workspaceName,
325-
'invisibleContentShown' => true,
326-
'inaccessibleContentShown' => true
327-
];
328-
329-
if ($dimensions !== []) {
330-
$contextProperties['dimensions'] = $dimensions;
331-
$contextProperties['targetDimensions'] = array_map(function ($dimensionValues) {
332-
return array_shift($dimensionValues);
333-
}, $dimensions);
334-
}
335-
336-
return $this->contextFactory->create($contextProperties);
337-
}
338-
339309
/**
340310
* Create a new index with the given $postfix.
341311
*

Classes/Driver/AbstractNodeTypeMappingBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
* source code.
1212
*/
1313

14+
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
1415
use Neos\Error\Messages\Result;
1516
use Neos\Flow\Annotations as Flow;
1617
use Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException;
1718
use Neos\Flow\Configuration\ConfigurationManager;
1819
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
19-
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
2020

2121
/**
2222
* Builds the mapping information for Content Repository Node Types in Elasticsearch
@@ -39,15 +39,15 @@ abstract class AbstractNodeTypeMappingBuilder implements NodeTypeMappingBuilderI
3939
protected $nodeTypeManager;
4040

4141
/**
42-
* @Flow\Inject
43-
* @var ConfigurationManager
42+
* @var Result
4443
*/
45-
protected $configurationManager;
44+
protected $lastMappingErrors;
4645

4746
/**
48-
* @var Result
47+
* @Flow\Inject
48+
* @var ConfigurationManager
4949
*/
50-
protected $lastMappingErrors;
50+
protected $configurationManager;
5151

5252
/**
5353
* Called by the Flow object framework after creating the object and resolving all dependencies.

Classes/Driver/NodeTypeMappingBuilderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Flowpack\ElasticSearch\Domain\Model\Index;
1515
use Flowpack\ElasticSearch\Mapping\MappingCollection;
16-
use Neos\Flow\Error\Result;
16+
use Neos\Error\Messages\Result;
1717

1818
/**
1919
* NodeTypeMappingBuilder Interface

Classes/Driver/Version1/Mapping/NodeTypeMappingBuilder.php

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,65 +16,17 @@
1616
use Flowpack\ElasticSearch\Domain\Model\Mapping;
1717
use Flowpack\ElasticSearch\Mapping\MappingCollection;
1818
use Neos\ContentRepository\Domain\Model\NodeType;
19-
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
2019
use Neos\Error\Messages\Result;
2120
use Neos\Error\Messages\Warning;
2221
use Neos\Flow\Annotations as Flow;
23-
use Neos\Flow\Configuration\ConfigurationManager;
24-
use Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException;
25-
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
2622

2723
/**
2824
* NodeTypeMappingBuilder for Elasticsearch version 1.x
29-
* Builds the mapping information for ContentRepository Node Types in Elasticsearch
25+
*
3026
* @Flow\Scope("singleton")
3127
*/
3228
class NodeTypeMappingBuilder extends AbstractNodeTypeMappingBuilder
3329
{
34-
/**
35-
* The default configuration for a given property type in NodeTypes.yaml, if no explicit elasticSearch section defined there.
36-
*
37-
* @var array
38-
*/
39-
protected $defaultConfigurationPerType;
40-
41-
/**
42-
* @Flow\Inject
43-
* @var NodeTypeManager
44-
*/
45-
protected $nodeTypeManager;
46-
47-
/**
48-
* @Flow\Inject
49-
* @var ConfigurationManager
50-
*/
51-
protected $configurationManager;
52-
53-
/**
54-
* Called by the Flow object framework after creating the object and resolving all dependencies.
55-
*
56-
* @param integer $cause Creation cause
57-
* @throws InvalidConfigurationTypeException
58-
*/
59-
public function initializeObject($cause)
60-
{
61-
if ($cause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
62-
$settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.ContentRepository.Search');
63-
$this->defaultConfigurationPerType = $settings['defaultConfigurationPerType'];
64-
}
65-
}
66-
67-
/**
68-
* Converts a ContentRepository Node Type name into a name which can be used for an Elasticsearch Mapping
69-
*
70-
* @param string $nodeTypeName
71-
* @return string
72-
*/
73-
public function convertNodeTypeNameToMappingName($nodeTypeName)
74-
{
75-
return str_replace('.', '-', $nodeTypeName);
76-
}
77-
7830
/**
7931
* Builds a Mapping Collection from the configured node types
8032
*

Classes/Driver/Version2/Mapping/NodeTypeMappingBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* source code.
1212
*/
1313

14-
use Neos\Flow\Annotations as Flow;
1514
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\Version1;
15+
use Neos\Flow\Annotations as Flow;
1616

1717
/**
1818
* NodeTypeMappingBuilder for Elasticsearch version 2.x

Classes/Driver/Version5/DocumentDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* source code.
1212
*/
1313

14-
use Neos\Flow\Annotations as Flow;
1514
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\Version2;
15+
use Neos\Flow\Annotations as Flow;
1616

1717
/**
1818
* Document driver for Elasticsearch version 5.x

Classes/Driver/Version5/IndexDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* source code.
1212
*/
1313

14-
use Neos\Flow\Annotations as Flow;
1514
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\Version1;
15+
use Neos\Flow\Annotations as Flow;
1616

1717
/**
1818
* Index management driver for Elasticsearch version 5.x

Classes/Driver/Version5/IndexerDriver.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
* source code.
1212
*/
1313

14-
use Neos\ContentRepository\Domain\Model\NodeInterface;
15-
use Neos\Flow\Annotations as Flow;
16-
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\AbstractNodeTypeMappingBuilder;
1714
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\Version2;
1815
use Flowpack\ElasticSearch\Domain\Model\Document as ElasticSearchDocument;
16+
use Neos\ContentRepository\Domain\Model\NodeInterface;
17+
use Neos\Flow\Annotations as Flow;
1918

2019
/**
2120
* Indexer driver for Elasticsearch version 5.x

Classes/Driver/Version5/Mapping/NodeTypeMappingBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
* source code.
1212
*/
1313

14-
use Neos\Flow\Annotations as Flow;
15-
use Neos\ContentRepository\Domain\Model\NodeType;
16-
use Neos\Error\Messages\Warning;
1714
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\Version2;
1815
use Flowpack\ElasticSearch\Domain\Model\Index;
1916
use Flowpack\ElasticSearch\Domain\Model\Mapping;
2017
use Flowpack\ElasticSearch\Mapping\MappingCollection;
18+
use Neos\ContentRepository\Domain\Model\NodeType;
2119
use Neos\Error\Messages\Result;
20+
use Neos\Error\Messages\Warning;
21+
use Neos\Flow\Annotations as Flow;
2222
use Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException;
2323
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
2424

0 commit comments

Comments
 (0)