Skip to content

Commit

Permalink
TASK: Put check for live content stream into finder
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Jul 5, 2023
1 parent 8c5f9ce commit 2d720d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function onAfterCatchUp(): void

private function onBeforeNodeAggregateWasDisabled(NodeAggregateWasDisabled $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}

Expand Down Expand Up @@ -116,11 +116,6 @@ private function getState(): DocumentUriPathFinder
return $this->contentRepository->projectionState(DocumentUriPathFinder::class);
}

private function isLiveContentStream(ContentStreamId $contentStreamId): bool
{
return $contentStreamId->equals($this->getState()->getLiveContentStreamId());
}

private function tryGetNode(\Closure $closure): ?DocumentNodeInfo
{
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,9 @@ public function getDescendantsOfNode(DocumentNodeInfo $node): DocumentNodeInfos
]
);
}

public function isLiveContentStream(ContentStreamId $contentStreamId): bool
{
return $contentStreamId->equals($this->getLiveContentStreamId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private function whenRootWorkspaceWasCreated(RootWorkspaceWasCreated $event): vo

private function whenRootNodeAggregateWithNodeWasCreated(RootNodeAggregateWithNodeWasCreated $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
foreach ($event->coveredDimensionSpacePoints as $dimensionSpacePoint) {
Expand All @@ -248,7 +248,7 @@ private function whenRootNodeAggregateWithNodeWasCreated(RootNodeAggregateWithNo

private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDimensionsWereUpdated $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}

Expand Down Expand Up @@ -282,7 +282,7 @@ private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDim

private function whenNodeAggregateWithNodeWasCreated(NodeAggregateWithNodeWasCreated $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
if (!$this->isDocumentNodeType($event->nodeTypeName)) {
Expand Down Expand Up @@ -373,7 +373,7 @@ private function whenNodeAggregateWithNodeWasCreated(NodeAggregateWithNodeWasCre

private function whenNodeAggregateTypeWasChanged(NodeAggregateTypeWasChanged $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
if ($this->isShortcutNodeType($event->newNodeTypeName)) {
Expand All @@ -395,7 +395,7 @@ private function whenNodeAggregateTypeWasChanged(NodeAggregateTypeWasChanged $ev

private function whenNodePeerVariantWasCreated(NodePeerVariantWasCreated $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
$this->copyVariants(
Expand All @@ -408,7 +408,7 @@ private function whenNodePeerVariantWasCreated(NodePeerVariantWasCreated $event)

private function whenNodeGeneralizationVariantWasCreated(NodeGeneralizationVariantWasCreated $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
$this->copyVariants(
Expand All @@ -421,7 +421,7 @@ private function whenNodeGeneralizationVariantWasCreated(NodeGeneralizationVaria

private function whenNodeSpecializationVariantWasCreated(NodeSpecializationVariantWasCreated $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
$this->copyVariants(
Expand Down Expand Up @@ -462,7 +462,7 @@ private function copyVariants(

private function whenNodeAggregateWasDisabled(NodeAggregateWasDisabled $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
foreach ($event->affectedDimensionSpacePoints as $dimensionSpacePoint) {
Expand Down Expand Up @@ -493,7 +493,7 @@ private function whenNodeAggregateWasDisabled(NodeAggregateWasDisabled $event):

private function whenNodeAggregateWasEnabled(NodeAggregateWasEnabled $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
foreach ($event->affectedDimensionSpacePoints as $dimensionSpacePoint) {
Expand Down Expand Up @@ -524,7 +524,7 @@ private function whenNodeAggregateWasEnabled(NodeAggregateWasEnabled $event): vo

private function whenNodeAggregateWasRemoved(NodeAggregateWasRemoved $event): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
foreach ($event->affectedCoveredDimensionSpacePoints as $dimensionSpacePoint) {
Expand Down Expand Up @@ -554,7 +554,7 @@ private function whenNodeAggregateWasRemoved(NodeAggregateWasRemoved $event): vo

private function whenNodePropertiesWereSet(NodePropertiesWereSet $event, EventEnvelope $eventEnvelope): void
{
if (!$this->isLiveContentStream($event->contentStreamId)) {
if (!$this->getState()->isLiveContentStream($event->contentStreamId)) {
return;
}
$newPropertyValues = $event->propertyValues->getPlainValues();
Expand Down Expand Up @@ -625,7 +625,7 @@ private function whenNodePropertiesWereSet(NodePropertiesWereSet $event, EventEn

private function whenNodeAggregateWasMoved(NodeAggregateWasMoved $event): void
{
if (!$this->isLiveContentStream($event->getContentStreamId())) {
if (!$this->getState()->isLiveContentStream($event->getContentStreamId())) {
return;
}

Expand Down Expand Up @@ -762,11 +762,6 @@ private function isShortcutNodeType(NodeTypeName $nodeTypeName): bool
return $nodeType->isOfType('Neos.Neos:Shortcut');
}

private function isLiveContentStream(ContentStreamId $contentStreamId): bool
{
return $contentStreamId->equals($this->getState()->getLiveContentStreamId());
}

private function tryGetNode(\Closure $closure): ?DocumentNodeInfo
{
try {
Expand Down Expand Up @@ -952,7 +947,7 @@ private function connectNodeWithSiblings(

private function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $event): void
{
if ($this->isLiveContentStream($event->contentStreamId)) {
if ($this->getState()->isLiveContentStream($event->contentStreamId)) {
$this->updateNodeQuery(
'SET dimensionspacepointhash = :newDimensionSpacePointHash
WHERE dimensionspacepointhash = :originalDimensionSpacePointHash',
Expand All @@ -976,7 +971,7 @@ private function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $ev

private function whenDimensionShineThroughWasAdded(DimensionShineThroughWasAdded $event): void
{
if ($this->isLiveContentStream($event->contentStreamId)) {
if ($this->getState()->isLiveContentStream($event->contentStreamId)) {
try {
$this->dbal->executeStatement('INSERT INTO ' . $this->tableNamePrefix . '_uri (
nodeaggregateid,
Expand Down

0 comments on commit 2d720d7

Please sign in to comment.