/**
  * @param NodeInterface $node
  *
  * @return string
  */
 protected function getEditionNodeRole(NodeInterface $node)
 {
     if (NodeInterface::TYPE_ERROR === $node->getNodeType()) {
         return TreeNodesPanelStrategy::ROLE_ACCESS_UPDATE_ERROR_NODE;
     }
     return TreeNodesPanelStrategy::ROLE_ACCESS_UPDATE_NODE;
 }
 /**
  * @param NodeInterface $node
  * @param Constraint    $constraint
  */
 public function validate($node, Constraint $constraint)
 {
     if ($node->getNodeType() === NodeInterface::TYPE_DEFAULT && $node->getNodeId() !== NodeInterface::ROOT_NODE_ID) {
         $parentId = $node->getParentId();
         $parent = $this->nodeRepository->findOneByNodeId($parentId);
         if (null === $parent || $parent->isDeleted()) {
             $nameParent = null === $parent ? '' : $parent->getName();
             $this->context->buildViolation($constraint->message)->setParameters(array('%nodeparent%' => $nameParent))->addViolation();
         }
     }
 }
 /**
  * @param FacadeInterface $facade
  * @param NodeInterface   $node
  *
  * @return FacadeInterface
  */
 protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
 {
     if ($site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
         $facade->templateSet = $site->getTemplateSet();
     }
     $facade->id = $node->getId();
     $facade->nodeId = $node->getNodeId();
     $facade->name = $node->getName();
     $facade->siteId = $node->getSiteId();
     $facade->deleted = $node->isDeleted();
     $facade->template = $node->getTemplate();
     $facade->nodeType = $node->getNodeType();
     $facade->parentId = $node->getParentId();
     $facade->path = $node->getPath();
     $facade->routePattern = $node->getRoutePattern();
     $facade->language = $node->getLanguage();
     $facade->metaDescription = $node->getMetaDescription();
     $facade->metaIndex = $node->getMetaIndex();
     $facade->metaFollow = $node->getMetaFollow();
     $facade->theme = $node->getTheme();
     $facade->themeSiteDefault = $node->hasDefaultSiteTheme();
     $facade->version = $node->getVersion();
     $facade->createdBy = $node->getCreatedBy();
     $facade->updatedBy = $node->getUpdatedBy();
     $facade->createdAt = $node->getCreatedAt();
     $facade->updatedAt = $node->getUpdatedAt();
     $facade->addRight('can_read', $this->authorizationChecker->isGranted(ContributionActionInterface::READ, $node));
     return $facade;
 }