/**
  * Convert PropertyData into a property API object
  *
  * @param ObjectTypeInterface $objectType
  * @param SecondaryTypeInterface[] $secondaryTypes
  * @param PropertyDataInterface $propertyData
  * @return PropertyInterface
  * @throws CmisRuntimeException
  */
 protected function convertProperty(ObjectTypeInterface $objectType, array $secondaryTypes, PropertyDataInterface $propertyData)
 {
     $definition = $objectType->getPropertyDefinition($propertyData->getId());
     // search secondary types
     if ($definition === null && !empty($secondaryTypes)) {
         foreach ($secondaryTypes as $secondaryType) {
             $propertyDefinitions = $secondaryType->getPropertyDefinitions();
             if (!empty($propertyDefinitions)) {
                 $definition = $secondaryType->getPropertyDefinition($propertyData->getId());
                 if ($definition !== null) {
                     break;
                 }
             }
         }
     }
     // the type might have changed -> reload type definitions
     if ($definition === null) {
         $reloadedObjectType = $this->session->getTypeDefinition($objectType->getId(), false);
         $definition = $reloadedObjectType->getPropertyDefinition($propertyData->getId());
         if ($definition === null && !empty($secondaryTypes)) {
             foreach ($secondaryTypes as $secondaryType) {
                 $reloadedSecondaryType = $this->session->getTypeDefinition($secondaryType->getId(), false);
                 $propertyDefinitions = $reloadedSecondaryType->getPropertyDefinitions();
                 if (!empty($propertyDefinitions)) {
                     $definition = $reloadedSecondaryType->getPropertyDefinition($propertyData->getId());
                     if ($definition !== null) {
                         break;
                     }
                 }
             }
         }
     }
     if ($definition === null) {
         // property without definition
         throw new CmisRuntimeException(sprintf('Property "%s" doesn\'t exist!', $propertyData->getId()));
     }
     return $this->createProperty($definition, $propertyData->getValues());
 }
Esempio n. 2
0
 /**
  * Fetches the relationships from or to an object from the repository.
  *
  * @param ObjectIdInterface $objectId
  * @param boolean $includeSubRelationshipTypes
  * @param RelationshipDirection $relationshipDirection
  * @param ObjectTypeInterface $type
  * @param OperationContextInterface|null $context
  * @return RelationshipInterface[]
  */
 public function getRelationships(ObjectIdInterface $objectId, $includeSubRelationshipTypes, RelationshipDirection $relationshipDirection, ObjectTypeInterface $type, OperationContextInterface $context = null)
 {
     if ($context === null) {
         $context = $this->getDefaultContext();
     }
     // TODO: Implement cache!
     return $this->getBinding()->getRelationshipService()->getObjectRelationships($this->getRepositoryId(), $objectId->getId(), $includeSubRelationshipTypes, $relationshipDirection, $type->getId());
 }