public function testSetContentStreamAllowedSetsProperty()
 {
     $contentStreamAllowed = ContentStreamAllowed::cast(ContentStreamAllowed::ALLOWED);
     $this->documentTypeDefinition->setContentStreamAllowed($contentStreamAllowed);
     $this->assertAttributeSame($contentStreamAllowed, 'contentStreamAllowed', $this->documentTypeDefinition);
 }
 /**
  * Object constructor sets defaults
  *
  * @param string $id The type definition id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->contentStreamAllowed = ContentStreamAllowed::cast(ContentStreamAllowed::NOTALLOWED);
 }
 public function convertTypeDefinitionDataProvider()
 {
     $folderTypeDefinition = new FolderTypeDefinition('cmis:folder');
     $folderTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_FOLDER));
     $typeMutability = new TypeMutability();
     $typeMutability->setCanCreate(true);
     $typeMutability->setCanUpdate(true);
     $typeMutability->setCanDelete(true);
     $documentTypeDefinition = new DocumentTypeDefinition('cmis:document');
     $documentTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_DOCUMENT));
     $documentTypeDefinition->setContentStreamAllowed(ContentStreamAllowed::cast(ContentStreamAllowed::ALLOWED));
     $documentTypeDefinition->setDescription('description');
     $documentTypeDefinition->setDisplayName('displayName');
     $documentTypeDefinition->setIsControllableACL(true);
     $documentTypeDefinition->setIsVersionable(true);
     $documentTypeDefinition->setIsControllablePolicy(true);
     $documentTypeDefinition->setIsCreatable(true);
     $documentTypeDefinition->setIsFileable(true);
     $documentTypeDefinition->setIsFulltextIndexed(true);
     $documentTypeDefinition->setIsIncludedInSupertypeQuery(true);
     $documentTypeDefinition->setIsQueryable(true);
     $documentTypeDefinition->setLocalName('localName');
     $documentTypeDefinition->setLocalNamespace('localNamespace');
     $documentTypeDefinition->setParentTypeId('parentTypeId');
     $documentTypeDefinition->setQueryName('queryName');
     $documentTypeDefinition->setTypeMutability($typeMutability);
     $relationshipTypeDefinition = new RelationshipTypeDefinition('cmis:relationship');
     $relationshipTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_RELATIONSHIP));
     $relationshipTypeDefinition->setAllowedSourceTypeIds(array('foo'));
     $relationshipTypeDefinition->setAllowedTargetTypeIds(array('bar'));
     $policyTypeDefinition = new PolicyTypeDefinition('cmis:policy');
     $policyTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_POLICY));
     $itemTypeDefinition = new ItemTypeDefinition('cmis:item');
     $itemTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_ITEM));
     $secondaryTypeDefinition = new SecondaryTypeDefinition('cmis:secondary');
     $secondaryTypeDefinition->setBaseTypeId(BaseTypeId::cast(BaseTypeId::CMIS_SECONDARY));
     return array('Folder type definition' => array($folderTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:folder', JSONConstants::JSON_TYPE_BASE_ID => BaseTypeId::CMIS_FOLDER)), 'Document type definition' => array($documentTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:document', JSONConstants::JSON_TYPE_BASE_ID => BaseTypeId::CMIS_DOCUMENT, JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED => ContentStreamAllowed::ALLOWED, JSONConstants::JSON_TYPE_DESCRIPTION => 'description', JSONConstants::JSON_TYPE_DISPLAYNAME => 'displayName', JSONConstants::JSON_TYPE_LOCALNAME => 'localName', JSONConstants::JSON_TYPE_LOCALNAMESPACE => 'localNamespace', JSONConstants::JSON_TYPE_PARENT_ID => 'parentTypeId', JSONConstants::JSON_TYPE_QUERYNAME => 'queryName', JSONConstants::JSON_TYPE_CONTROLABLE_ACL => true, JSONConstants::JSON_TYPE_VERSIONABLE => true, JSONConstants::JSON_TYPE_CONTROLABLE_POLICY => true, JSONConstants::JSON_TYPE_CREATABLE => true, JSONConstants::JSON_TYPE_FILEABLE => true, JSONConstants::JSON_TYPE_FULLTEXT_INDEXED => true, JSONConstants::JSON_TYPE_INCLUDE_IN_SUPERTYPE_QUERY => true, JSONConstants::JSON_TYPE_QUERYABLE => true, JSONConstants::JSON_TYPE_TYPE_MUTABILITY => array(JSONConstants::JSON_TYPE_TYPE_MUTABILITY_UPDATE => true, JSONConstants::JSON_TYPE_TYPE_MUTABILITY_CREATE => true, JSONConstants::JSON_TYPE_TYPE_MUTABILITY_DELETE => true), JSONConstants::JSON_TYPE_PROPERTY_DEFINITIONS => array(array()))), 'Relationship type definition' => array($relationshipTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:relationship', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:relationship', JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES => array('foo', false, null, ''), JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES => array('bar', false, null, ''))), 'Policy type definition' => array($policyTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:policy', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:policy')), 'Item type definition' => array($itemTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:item', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:item')), 'Secondary type definition' => array($secondaryTypeDefinition, array(JSONConstants::JSON_TYPE_ID => 'cmis:secondary', JSONConstants::JSON_TYPE_BASE_ID => 'cmis:secondary')));
 }
 /**
  * Convert specific type definition data so it can be populated to the type definition
  *
  * @param MutableTypeDefinitionInterface $typeDefinition The type definition to set the data to
  * @param array $data The data that contains the values that should be applied to the object
  * @return MutableTypeDefinitionInterface The type definition with the specific data applied
  */
 private function convertTypeDefinitionSpecificData(array $data, MutableTypeDefinitionInterface $typeDefinition)
 {
     if ($typeDefinition instanceof MutableDocumentTypeDefinitionInterface) {
         if (!empty($data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED])) {
             $data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED] = ContentStreamAllowed::cast($data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED]);
         }
     } elseif ($typeDefinition instanceof MutableRelationshipTypeDefinitionInterface) {
         if (isset($data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES]) && is_array($data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES])) {
             $allowedSourceTypeIds = array();
             foreach ($data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] as $allowedSourceTypeId) {
                 $allowedSourceTypeId = (string) $allowedSourceTypeId;
                 if (!empty($allowedSourceTypeId)) {
                     $allowedSourceTypeIds[] = $allowedSourceTypeId;
                 }
             }
             $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] = $allowedSourceTypeIds;
         }
         if (isset($data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES]) && is_array($data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES])) {
             $allowedTargetTypeIds = array();
             foreach ($data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES] as $allowedTargetTypeId) {
                 $allowedTargetTypeId = (string) $allowedTargetTypeId;
                 if (!empty($allowedTargetTypeId)) {
                     $allowedTargetTypeIds[] = $allowedTargetTypeId;
                 }
             }
             $data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES] = $allowedTargetTypeIds;
         }
     }
     return $data;
 }