@param UnpublishNode $command
@param Pbjx          $pbjx

@return NodeUnpublished
179979
protected function createNodeUnpublished(UnpublishNode $command, Pbjx $pbjx): NodeUnpublished
    {
        /** @var NodeUnpublished $event */
        $event = $this->createEventFromCommand($command, 'unpublished');
        return $event;
    }
803217
public function handleCommand(Command $command, Pbjx $pbjx): void
    {
        /** @var CommandHandlerTrait|CommandHandler $this */
        $method = $this->getMethodForCommand($command);

        if (empty($method)) {
            throw InvalidHandler::forCommand($command, $this, 'getMethodForCommand returned an empty string');
        }

        if (!is_callable([$this, $method])) {
            $message = <<<MSG
The CommandHandler needs the following code to operate:

    /**
     * @param Command \$command
     * @param Pbjx    \$pbjx
     *
     * @throws \Exception
     */
    protected function $method(Command \$command, Pbjx \$pbjx): void
    {
    }

MSG;
            throw InvalidHandler::forCommand($command, $this, $message);
        }

        $this->$method($command, $pbjx);
    }
21083
private void sendUnpublishedStatus(IPlayItem item) {
        Status unpublished = new Status(StatusCodes.NS_PLAY_UNPUBLISHNOTIFY);
        unpublished.setClientid(streamId);
        unpublished.setDetails(item.getName());

        doPushMessage(unpublished);
    }
943709
protected function bindFromNode(Message $message, Node $node, Pbjx $pbjx): void
    {
        $node->freeze();
        $pbjxEvent = new BindFromNodeEvent($message, $node);
        $pbjx->trigger($message, 'bind_from_node', $pbjxEvent, false);
    }
447147
protected function handle(GetNodeBatchRequest $request, Pbjx $pbjx): GetNodeBatchResponse
    {
        $response = $this->createGetNodeBatchResponse($request, $pbjx);
        $nodeRefs = $request->get('node_refs');

        if (empty($nodeRefs)) {
            return $response;
        }

        $context = $this->createNcrContext($request);
        $nodes = $this->ncr->getNodes($nodeRefs, $request->get('consistent_read'), $context);
        foreach ($nodes as $nodeRef => $node) {
            $this->assertIsNodeSupported($node);
            $response->addToMap('nodes', $nodeRef, $node);
        }

        $missing = array_keys(array_diff_key(array_flip(array_map('strval', $nodeRefs)), $nodes));
        $missing = array_map(function ($str) {
            return NodeRef::fromString($str);
        }, $missing);
        $response->addToSet('missing_node_refs', $missing);

        return $response;
    }
466168
public function unpublishArticles(ArticleUnpublishMessage $message): array
    {
        $path = sprintf('sites/%d/articles/unpublish', $message->getSiteId());
        $data = ['api_unpublish_articles_global' => $message->build()];

        $response = $this->getClient()->sendRequest(RequestStatus::POST, $path, $data);

        /** @var Article[] $models */
        $models = $this->getModelFactory()->createMany(Article::class, $response);

        return $models;
    }
332066
protected function ensureSlugIsAvailable(PbjxEvent $pbjxEvent, NodeRef $nodeRef, string $slug): void
    {
        $pbjx = $pbjxEvent::getPbjx();
        $command = $pbjxEvent->getMessage();

        try {
            $request = $this->createGetNodeRequest($command, $nodeRef, $pbjx)
                ->set('consistent_read', true)
                ->set('qname', $nodeRef->getQName()->toString())
                ->set('slug', $slug);

            $response = $pbjx->copyContext($command, $request)->request($request);
        } catch (RequestHandlingFailed $e) {
            if (Code::NOT_FOUND === $e->getResponse()->get('error_code')) {
                // this is what we want
                return;
            }

            throw $e;
        } catch (\Throwable $t) {
            throw $t;
        }

        /** @var Node $node */
        $node = $response->get('node');

        if ($nodeRef->getId() === (string)$node->get('_id')) {
            // this is the same node.
            return;
        }

        throw new NodeAlreadyExists(
            sprintf(
                'The [%s] with slug [%s] already exists so [%s] cannot continue.',
                $node::schema()->getCurie()->getMessage(),
                $slug,
                $command->generateMessageRef()
            )
        );
    }
575486
def unpublish_branch(self, branch):
        """"""

        try:
            return self.git_exec(
                ['push', self.remote.name, ':{0}'.format(branch)])
        except GitCommandError:
            _, _, log = self.git_exec(
                ['fetch', self.remote.name, '--prune'],
                with_extended_output=True)
            abort('Unpublish failed. Fetching.', log=log, type='unpublish')
966279
public function moveNode(MoveAggregateRootNodeCommand $move_node_command)
    {
        $this->guardCommandPreConditions($move_node_command);

        $node_moved_event = $this->processCommand(
            $move_node_command,
            [ 'data' => [ 'parent_node_id' => $move_node_command->getParentNodeId() ] ]
        );

        if (!$node_moved_event instanceof AggregateRootNodeMovedEvent) {
            throw new UnsupportedEventTypeError(
                sprintf(
                    'Corrupt event type detected. Events that reflect nodes being moved must descend from %s.',
                    AggregateRootNodeMovedEvent::CLASS
                )
            );
        }

        $this->applyEvent($node_moved_event);
    }
1365374
protected function ensureStreamDoesNotExist(PbjxEvent $pbjxEvent, NodeRef $nodeRef): void
    {
        $pbjx = $pbjxEvent::getPbjx();
        $message = $pbjxEvent->getMessage();

        $streamId = $this->createStreamId($nodeRef);
        $slice = $pbjx->getEventStore()->getStreamSlice(
            $streamId,
            null,
            1,
            true,
            true,
            $this->createEventStoreContext($message, $streamId)
        );

        if ($slice->count()) {
            throw new NodeAlreadyExists(
                sprintf(
                    'The [%s] with id [%s] already exists so [%s] cannot continue.',
                    $nodeRef->getLabel(),
                    $nodeRef->getId(),
                    $message->generateMessageRef()
                )
            );
        }
    }
944074
public static void unPublishPort(final OtpLocalNode node) {
        OtpTransport s = null;

        try {
            s = node.createTransport((String) null, EpmdPort.get());
            @SuppressWarnings("resource")
            final OtpOutputStream obuf = new OtpOutputStream();
            obuf.write2BE(node.alive().length() + 1);
            obuf.write1(stopReq);
            obuf.writeN(node.alive().getBytes());
            obuf.writeToAndFlush(s.getOutputStream());
            // don't even wait for a response (is there one?)
            if (traceLevel >= traceThreshold) {
                System.out.println("-> UNPUBLISH " + node + " port="
                        + node.port());
                System.out.println("<- OK (assumed)");
            }
        } catch (final Exception e) {/* ignore all failures */
        } finally {
            try {
                if (s != null) {
                    s.close();
                }
            } catch (final IOException e) { /* ignore close failure */
            }
            s = null;
        }
    }
1236979
protected function unpublishElements(ReadSiteInterface $site, OutputInterface $output)
    {
        $elementPublisherManager = $this->getContainer()->get($this->getManagerName());

        $output->writeln("\n<info>Unpublishing ".$this->getElementType()."s for siteId " . $site->getSiteId() . "</info>");

        $unpublishResult = $elementPublisherManager->unpublishElements($site);

        if (AutoPublishManagerInterface::ERROR_NO_PUBLISHED_STATUS == $unpublishResult) {
            $output->writeln("<error>There is no published status defined.</error>");

        } elseif (AutoPublishManagerInterface::ERROR_NO_UNPUBLISHED_STATUS == $unpublishResult) {
            $output->writeln("<error>There is no status defined to unpublish ".$this->getElementType()."s.</error>");

        } elseif (is_array($unpublishResult)) {
            foreach ($unpublishResult as $element) {
                $output->writeln("<comment>-> " . $element['name'] . " (v" . $element['version'] . " " . $element['language'] . ") unpublished</comment>");
            }
        }
    }
521818
public function setBlamesOnNodeForPublish(PublishEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        $this->setBlamesOnNode(
            $document,
            $event->getNode(),
            $event->getLocale(),
            $event->getAccessor(),
            $document->getChanger()
        );
    }
181915
protected function createPublishNode(Node $node, Event $event, Pbjx $pbjx): PublishNode
    {
        $curie = $node::schema()->getCurie();
        $commandCurie = "{$curie->getVendor()}:{$curie->getPackage()}:command:publish-{$curie->getMessage()}";

        /** @var PublishNode $class */
        $class = MessageResolver::resolveCurie(SchemaCurie::fromString($commandCurie));
        return $class::create();
    }
227379
public function onCreateNodeAfterHandle(PbjxEvent $pbjxEvent): void
    {
        $command = $pbjxEvent->getMessage();
        if (!$command->has('node')) {
            return;
        }

        /** @var Node $node */
        $node = $command->get('node');
        if ($this->shouldIgnoreNode($node)) {
            return;
        }

        /** @var CacheItemInterface[] $cacheItems */
        $cacheItems = $this->cache->getItems($this->getIdempotencyKeys($node));

        foreach ($cacheItems as $cacheItem) {
            $cacheItem->set(true)->expiresAfter($this->getCacheTtl($node));
            $this->cache->saveDeferred($cacheItem);
        }
    }
402849
protected function createNodeUnlocked(UnlockNode $command, Pbjx $pbjx): NodeUnlocked
    {
        /** @var NodeUnlocked $event */
        $event = $this->createEventFromCommand($command, 'unlocked');
        return $event;
    }
1293204
public static void serializePublishCommands(State state, QueryBasedHivePublishEntity queryBasedHivePublishEntity) {
    state.setProp(HiveAvroORCQueryGenerator.SERIALIZED_PUBLISH_TABLE_COMMANDS,
        GSON.toJson(queryBasedHivePublishEntity));
  }