@@ 67-95 (lines=29) @@ | ||
64 | * was set to <code>null</code> |
|
65 | * @throws CmisRuntimeException Exception is thrown if the created object is not a document |
|
66 | */ |
|
67 | public function createDocument( |
|
68 | array $properties, |
|
69 | StreamInterface $contentStream, |
|
70 | VersioningState $versioningState, |
|
71 | array $policies = array(), |
|
72 | array $addAces = array(), |
|
73 | array $removeAces = array(), |
|
74 | OperationContextInterface $context = null |
|
75 | ) { |
|
76 | $newObjectId = $this->getSession()->createDocument( |
|
77 | $properties, |
|
78 | $this, |
|
79 | $contentStream, |
|
80 | $versioningState, |
|
81 | $policies, |
|
82 | $addAces, |
|
83 | $removeAces |
|
84 | ); |
|
85 | ||
86 | $document = $this->getNewlyCreatedObject($newObjectId, $context); |
|
87 | ||
88 | if ($document === null) { |
|
89 | return null; |
|
90 | } elseif (!$document instanceof DocumentInterface) { |
|
91 | throw new CmisRuntimeException('Newly created object is not a document! New id: ' . $document->getId()); |
|
92 | } |
|
93 | ||
94 | return $document; |
|
95 | } |
|
96 | ||
97 | /** |
|
98 | * Creates a new document from a source document in this folder. |
|
@@ 126-154 (lines=29) @@ | ||
123 | * was set to <code>null</code> |
|
124 | * @throws CmisRuntimeException Exception is thrown if the created object is not a document |
|
125 | */ |
|
126 | public function createDocumentFromSource( |
|
127 | ObjectIdInterface $source, |
|
128 | array $properties, |
|
129 | VersioningState $versioningState, |
|
130 | array $policies = array(), |
|
131 | array $addAces = array(), |
|
132 | array $removeAces = array(), |
|
133 | OperationContextInterface $context = null |
|
134 | ) { |
|
135 | $newObjectId = $this->getSession()->createDocumentFromSource( |
|
136 | $source, |
|
137 | $properties, |
|
138 | $this, |
|
139 | $versioningState, |
|
140 | $policies, |
|
141 | $addAces, |
|
142 | $removeAces |
|
143 | ); |
|
144 | ||
145 | $document = $this->getNewlyCreatedObject($newObjectId, $context); |
|
146 | ||
147 | if ($document === null) { |
|
148 | return null; |
|
149 | } elseif (!$document instanceof DocumentInterface) { |
|
150 | throw new CmisRuntimeException('Newly created object is not a document! New id: ' . $document->getId()); |
|
151 | } |
|
152 | ||
153 | return $document; |
|
154 | } |
|
155 | ||
156 | /** |
|
157 | * Creates a new subfolder in this folder. |
|
@@ 170-188 (lines=19) @@ | ||
167 | * was set to <code>null</code> |
|
168 | * @throws CmisRuntimeException Exception is thrown if the created object is not a folder |
|
169 | */ |
|
170 | public function createFolder( |
|
171 | array $properties, |
|
172 | array $policies = array(), |
|
173 | array $addAces = array(), |
|
174 | array $removeAces = array(), |
|
175 | OperationContextInterface $context = null |
|
176 | ) { |
|
177 | $newObjectId = $this->getSession()->createFolder($properties, $this, $policies, $addAces, $removeAces); |
|
178 | ||
179 | $folder = $this->getNewlyCreatedObject($newObjectId, $context); |
|
180 | ||
181 | if ($folder === null) { |
|
182 | return null; |
|
183 | } elseif (!$folder instanceof FolderInterface) { |
|
184 | throw new CmisRuntimeException('Newly created object is not a folder! New id: ' . $folder->getId()); |
|
185 | } |
|
186 | ||
187 | return $folder; |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * Creates a new item in this folder. |
|
@@ 203-221 (lines=19) @@ | ||
200 | * @return ItemInterface|null the new item object |
|
201 | * @throws CmisRuntimeException Exception is thrown if the created object is not a item |
|
202 | */ |
|
203 | public function createItem( |
|
204 | array $properties, |
|
205 | array $policies = array(), |
|
206 | array $addAces = array(), |
|
207 | array $removeAces = array(), |
|
208 | OperationContextInterface $context = null |
|
209 | ) { |
|
210 | $newObjectId = $this->getSession()->createItem($properties, $this, $policies, $addAces, $removeAces); |
|
211 | ||
212 | $item = $this->getNewlyCreatedObject($newObjectId, $context); |
|
213 | ||
214 | if ($item === null) { |
|
215 | return null; |
|
216 | } elseif (!$item instanceof ItemInterface) { |
|
217 | throw new CmisRuntimeException('Newly created object is not a item! New id: ' . $item->getId()); |
|
218 | } |
|
219 | ||
220 | return $item; |
|
221 | } |
|
222 | ||
223 | /** |
|
224 | * Creates a new policy in this folder. |
|
@@ 236-254 (lines=19) @@ | ||
233 | * @return PolicyInterface|null the new policy object |
|
234 | * @throws CmisRuntimeException Exception is thrown if the created object is not a policy |
|
235 | */ |
|
236 | public function createPolicy( |
|
237 | array $properties, |
|
238 | array $policies = array(), |
|
239 | array $addAces = array(), |
|
240 | array $removeAces = array(), |
|
241 | OperationContextInterface $context = null |
|
242 | ) { |
|
243 | $newObjectId = $this->getSession()->createPolicy($properties, $this, $policies, $addAces, $removeAces); |
|
244 | ||
245 | $policy = $this->getNewlyCreatedObject($newObjectId, $context); |
|
246 | ||
247 | if ($policy === null) { |
|
248 | return null; |
|
249 | } elseif (!$policy instanceof PolicyInterface) { |
|
250 | throw new CmisRuntimeException('Newly created object is not a policy! New id: ' . $policy->getId()); |
|
251 | } |
|
252 | ||
253 | return $policy; |
|
254 | } |
|
255 | ||
256 | /** |
|
257 | * Deletes this folder and all subfolders. |