/
NodeServiceInterface.php
99 lines (88 loc) · 2.89 KB
/
NodeServiceInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
namespace Neos\ContentRepository\Domain\Service;
/*
* This file is part of the Neos.ContentRepository package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\NodeType;
/**
* Provides generic methods to manage and work with Nodes
*
* @api
*/
interface NodeServiceInterface
{
/**
* Sets default node property values on the given node.
*
* @param NodeInterface $node
* @return void
*/
public function setDefaultValues(NodeInterface $node);
/**
* Creates missing child nodes for the given node.
*
* @param NodeInterface $node
* @return void
*/
public function createChildNodes(NodeInterface $node);
/**
* Removes all properties not configured in the current Node Type.
*
* @param NodeInterface $node
* @return void
*/
public function cleanUpProperties(NodeInterface $node);
/**
* Removes all auto created child nodes that existed in the previous nodeType.
*
* @param NodeInterface $node
* @param NodeType $oldNodeType
* @return void
*/
public function cleanUpAutoCreatedChildNodes(NodeInterface $node, NodeType $oldNodeType);
/**
* @param NodeInterface $node
* @param NodeType $nodeType
* @return boolean
*/
public function isNodeOfType(NodeInterface $node, NodeType $nodeType);
/**
* Checks if the given node path exists in any possible context already.
*
* @param string $nodePath
* @return boolean
*/
public function nodePathExistsInAnyContext($nodePath);
/**
* Checks if the given node path can be used for the given node.
*
* @param string $nodePath
* @param NodeInterface $node
* @return boolean
*/
public function nodePathAvailableForNode($nodePath, NodeInterface $node);
/**
* Normalizes the given node path to a reference path and returns an absolute path.
*
* @param string $path The non-normalized path
* @param string $referencePath a reference path in case the given path is relative.
* @return string The normalized absolute path
* @throws \InvalidArgumentException if the node path was invalid.
*/
public function normalizePath($path, $referencePath = null);
/**
* Generates a possible node name, optionally based on a suggested "ideal" name.
*
* @param string $parentPath
* @param string $idealNodeName Can be any string, doesn't need to be a valid node name.
* @return string valid node name that is possible as child of the given $parentNode
*/
public function generateUniqueNodeName($parentPath, $idealNodeName = null);
}