コード例 #1
0
 /**
  * Initializes the NodeTypeDefinition from the given DOM
  * @param DOMElement NodeTypeElement
  */
 public function __construct(DOMElement $node, jackalope_NodeType_NodeTypeManager $nodeTypeManager)
 {
     $this->nodeTypeManager = $nodeTypeManager;
     $this->name = $node->getAttribute('name');
     $this->isAbstract = jackalope_Helper::getBoolAttribute($node, 'isAbstract');
     $this->isMixin = jackalope_Helper::getBoolAttribute($node, 'isMixin');
     $this->isQueryable = jackalope_Helper::getBoolAttribute($node, 'isQueryable');
     $this->hasOrderableChildNodes = jackalope_Helper::getBoolAttribute($node, 'hasOrderableChildNodes');
     $this->primaryItemName = $node->getAttribute('primaryItemName');
     if (empty($this->primaryItemName)) {
         $this->primaryItemName = null;
     }
     $xp = new DOMXPath($node->ownerDocument);
     $supertypes = $xp->query('supertypes/supertype', $node);
     foreach ($supertypes as $supertype) {
         array_push($this->declaredSuperTypeNames, $supertype->nodeValue);
     }
     $properties = $xp->query('propertyDefinition', $node);
     foreach ($properties as $property) {
         array_push($this->declaredPropertyDefinitions, jackalope_Factory::get('NodeType_PropertyDefinition', array($property, $nodeTypeManager)));
     }
     $declaredNodeDefinitions = $xp->query('childNodeDefinition', $node);
     foreach ($declaredNodeDefinitions as $nodeDefinition) {
         array_push($this->declaredNodeDefinitions, jackalope_Factory::get('NodeType_NodeDefinition', array($nodeDefinition, $this->nodeTypeManager)));
     }
 }
コード例 #2
0
ファイル: ItemDefinition.php プロジェクト: vjousse/jackalope
 public function __construct(DOMElement $node, jackalope_NodeType_NodeTypeManager $nodeTypeManager)
 {
     $this->nodeTypeManager = $nodeTypeManager;
     $this->declaringNodeType = $node->getAttribute('declaringNodeType');
     $this->name = $node->getAttribute('name');
     $this->isAutoCreated = jackalope_Helper::getBoolAttribute($node, 'isAutoCreated');
     $this->isMandatory = jackalope_Helper::getBoolAttribute($node, 'mandatory');
     $this->isProtected = jackalope_Helper::getBoolAttribute($node, 'isProtected');
     $this->onParentVersion = PHPCR_Version_OnParentVersionAction::valueFromName($node->getAttribute('onParentVersion'));
 }
コード例 #3
0
ファイル: NodeDefinition.php プロジェクト: vjousse/jackalope
 public function __construct(DOMElement $node, jackalope_NodeType_NodeTypeManager $nodeTypeManager)
 {
     parent::__construct($node, $nodeTypeManager);
     $this->allowsSameNameSiblings = jackalope_Helper::getBoolAttribute($node, 'sameNameSiblings');
     $this->defaultPrimaryTypeName = $node->getAttribute('defaultPrimaryType');
     if (empty($this->defaultPrimaryTypeName)) {
         $this->defaultPrimaryTypeName = null;
     }
     $xp = new DOMXpath($node->ownerDocument);
     $requiredPrimaryTypes = $xp->query('requiredPrimaryTypes/requiredPrimaryType', $node);
     if (0 < $requiredPrimaryTypes->length) {
         foreach ($requiredPrimaryTypes as $requiredPrimaryType) {
             array_push($this->requiredPrimaryTypeNames, $requiredPrimaryType->nodeValue);
         }
     } else {
         array_push($this->requiredPrimaryTypeNames, self::DEFAULT_PRIMARY_NODE);
     }
 }
コード例 #4
0
 public function __construct(DOMElement $node, jackalope_NodeType_NodeTypeManager $nodeTypeManager)
 {
     parent::__construct($node, $nodeTypeManager);
     $this->requiredType = PHPCR_PropertyType::valueFromName($node->getAttribute('requiredType'));
     $this->isMultiple = jackalope_Helper::getBoolAttribute($node, 'multiple');
     $this->isFullTextSearchable = jackalope_Helper::getBoolAttribute($node, 'fullTextSearchable');
     $this->isQueryOrderable = jackalope_Helper::getBoolAttribute($node, 'queryOrderable');
     $xp = new DOMXpath($node->ownerDocument);
     $valueConstraints = $xp->query('valueConstraints/valueConstraint', $node);
     foreach ($valueConstraints as $valueConstraint) {
         array_push($this->valueConstraints, $valueConstraint->nodeValue);
     }
     $availableQueryOperators = $xp->query('availableQueryOperators/availableQueryOperator', $node);
     foreach ($availableQueryOperators as $availableQueryOperator) {
         array_push($this->availableQueryOperators, $availableQueryOperator->nodeValue);
     }
     $defaultValues = $xp->query('defaultValues/defaultValue', $node);
     foreach ($defaultValues as $defaultValue) {
         array_push($this->defaultValues, jackalope_Factory::get('Value', array(PHPCR_PropertyType::valueFromType($defaultValue->nodeValue), $defaultValue->nodeValue)));
     }
 }
コード例 #5
0
ファイル: ObjectManager.php プロジェクト: vjousse/jackalope
 /**
  * Verifies the path to be absolute and well-formed
  *
  * @param string $path the path to verify 
  * @return  bool    Always true :)
  * @throws PHPCR_RepositoryException    If the path is not absolute or well-formed
  */
 public function verifyAbsolutePath($path)
 {
     if (!jackalope_Helper::isAbsolutePath($path)) {
         throw new PHPCR_RepositoryException('Path is not absolute: ' . $path);
     }
     if (!jackalope_Helper::isValidPath($path)) {
         throw new PHPCR_RepositoryException('Path is not well-formed (TODO: match against spec): ' . $path);
     }
     return true;
 }
コード例 #6
0
ファイル: Session.php プロジェクト: vjousse/jackalope
 /**
  * Returns true if a property exists at absPath and this Session has read
  * access to it; otherwise returns false.
  *
  * @param string $absPath An absolute path.
  * @return boolean a boolean
  * @throws PHPCR_RepositoryException if absPath is not a well-formed absolute path.
  * @api
  */
 public function propertyExists($absPath)
 {
     // TODO: what about $absPath == '/' here? if not then ::itemExists is faulty
     if (!jackalope_Helper::isAbsolutePath($absPath) || !jackalope_Helper::isValidPath($absPath)) {
         throw new PHPCR_RepositoryException("Path is invalid: {$absPath}");
     }
     try {
         //OPTIMIZE: avoid throwing and catching errors would improve performance if many node exists calls are made
         //would need to communicate to the lower layer that we do not want exceptions
         $this->getProperty($absPath);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }