Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Session often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Session, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
53 | class Session implements SessionInterface |
||
54 | { |
||
55 | /** |
||
56 | * @var CmisBindingInterface |
||
57 | */ |
||
58 | protected $binding; |
||
59 | |||
60 | /** |
||
61 | * @var Cache |
||
62 | */ |
||
63 | protected $cache; |
||
64 | |||
65 | /** |
||
66 | * @var OperationContextInterface |
||
67 | */ |
||
68 | private $defaultContext; |
||
69 | |||
70 | /** |
||
71 | * @var CmisBindingsHelper |
||
72 | */ |
||
73 | protected $cmisBindingHelper; |
||
74 | |||
75 | /** |
||
76 | * @var ObjectFactoryInterface |
||
77 | */ |
||
78 | private $objectFactory; |
||
79 | |||
80 | /** |
||
81 | * @var RepositoryInfoInterface |
||
82 | */ |
||
83 | protected $repositoryInfo; |
||
84 | |||
85 | /** |
||
86 | * @var array |
||
87 | */ |
||
88 | protected $parameters = array(); |
||
89 | |||
90 | /** |
||
91 | * @var Cache |
||
92 | */ |
||
93 | protected $typeDefinitionCache; |
||
94 | |||
95 | /** |
||
96 | * @var Cache |
||
97 | */ |
||
98 | protected $objectTypeCache; |
||
99 | |||
100 | /** |
||
101 | * @var Updatability[] |
||
102 | */ |
||
103 | protected static $createUpdatability = array(); |
||
104 | |||
105 | /** |
||
106 | * @var Updatability[] |
||
107 | */ |
||
108 | protected static $createAndCheckoutUpdatability = array(); |
||
109 | |||
110 | /** |
||
111 | * @param array $parameters |
||
112 | * @param ObjectFactoryInterface|null $objectFactory |
||
113 | * @param Cache|null $cache |
||
114 | * @param Cache|null $typeDefinitionCache |
||
115 | * @param Cache|null $objectTypeCache |
||
116 | * @param CmisBindingsHelper|null $cmisBindingHelper |
||
117 | * @throws CmisInvalidArgumentException |
||
118 | * @throws IllegalStateException |
||
119 | */ |
||
120 | 11 | public function __construct( |
|
166 | |||
167 | /** |
||
168 | * Create an object factory based on the SessionParameter::OBJECT_FACTORY_CLASS. If not set it returns an instance |
||
169 | * of ObjectFactory. |
||
170 | * |
||
171 | * @return ObjectFactoryInterface |
||
172 | * @throws \RuntimeException |
||
173 | */ |
||
174 | 9 | protected function createObjectFactory() |
|
197 | |||
198 | /** |
||
199 | * Returns an instance of the ObjectFactory. |
||
200 | * This methods is primarily required for unit testing. |
||
201 | * |
||
202 | * @return ObjectFactory |
||
203 | */ |
||
204 | 6 | protected function createDefaultObjectFactoryInstance() |
|
208 | |||
209 | /** |
||
210 | * Create a cache instance based on the given session parameter SessionParameter::CACHE_CLASS. |
||
211 | * If no session parameter SessionParameter::CACHE_CLASS is defined, the default Cache implementation will be used. |
||
212 | * |
||
213 | * @return Cache |
||
214 | * @throws \InvalidArgumentException |
||
215 | */ |
||
216 | 9 | protected function createCache() |
|
243 | |||
244 | /** |
||
245 | * Returns an instance of the Doctrine ArrayCache. |
||
246 | * This methods is primarily required for unit testing. |
||
247 | * |
||
248 | * @return CacheProvider |
||
249 | */ |
||
250 | 7 | protected function createDefaultCacheInstance() |
|
254 | |||
255 | /** |
||
256 | * Get the cache instance |
||
257 | * |
||
258 | * @return CacheProvider |
||
259 | */ |
||
260 | 3 | public function getCache() |
|
264 | |||
265 | /** |
||
266 | * Applies ACL changes to an object and dependent objects. Only direct ACEs can be added and removed. |
||
267 | * |
||
268 | * @param ObjectIdInterface $objectId the ID the object |
||
269 | * @param AceInterface[] $addAces of ACEs to be added or <code>null</code> if no ACEs should be added |
||
270 | * @param AceInterface[] $removeAces list of ACEs to be removed or <code>null</code> if no ACEs should be removed |
||
271 | * @param AclPropagation|null $aclPropagation value that defines the propagation of the ACE changes; |
||
272 | * <code>null</code> is equal to AclPropagation.REPOSITORYDETERMINED |
||
273 | * @return AclInterface the new ACL of the object |
||
274 | */ |
||
275 | public function applyAcl( |
||
283 | |||
284 | /** |
||
285 | * Applies a set of policies to an object. |
||
286 | * |
||
287 | * @param ObjectIdInterface $objectId the ID the object |
||
288 | * @param ObjectIdInterface[] $policyIds the IDs of the policies to be applied |
||
289 | * @return mixed |
||
290 | */ |
||
291 | public function applyPolicies(ObjectIdInterface $objectId, array $policyIds) |
||
295 | |||
296 | /** |
||
297 | * Updates multiple objects in one request. |
||
298 | * |
||
299 | * @param CmisObjectInterface[] $objects |
||
300 | * @param mixed[] $properties |
||
301 | * @param string[] $addSecondaryTypeIds |
||
302 | * @param string[] $removeSecondaryTypeIds |
||
303 | * @return BulkUpdateObjectIdAndChangeTokenInterface[] |
||
304 | */ |
||
305 | public function bulkUpdateProperties( |
||
313 | |||
314 | /** |
||
315 | * Clears all cached data. |
||
316 | */ |
||
317 | public function clear() |
||
321 | |||
322 | /** |
||
323 | * Creates a new document. The stream in contentStream is consumed but not closed by this method. |
||
324 | * |
||
325 | * @param string[] $properties The property values that MUST be applied to the newly-created document object. |
||
326 | * @param ObjectIdInterface|null $folderId If specified, the identifier for the folder that MUST be the parent |
||
327 | * folder for the newly-created document object. This parameter MUST be specified if the repository does NOT |
||
328 | * support the optional "unfiling" capability. |
||
329 | * @param StreamInterface|null $contentStream The content stream that MUST be stored for the newly-created document |
||
330 | * object. The method of passing the contentStream to the server and the encoding mechanism will be specified |
||
331 | * by each specific binding. MUST be required if the type requires it. |
||
332 | * @param VersioningState|null $versioningState An enumeration specifying what the versioning state of the |
||
333 | * newly-created object MUST be. Valid values are: |
||
334 | * <code>none</code> |
||
335 | * (default, if the object-type is not versionable) The document MUST be created as a non-versionable |
||
336 | * document. |
||
337 | * <code>checkedout</code> |
||
338 | * The document MUST be created in the checked-out state. The checked-out document MAY be |
||
339 | * visible to other users. |
||
340 | * <code>major</code> |
||
341 | * (default, if the object-type is versionable) The document MUST be created as a major version. |
||
342 | * <code>minor</code> |
||
343 | * The document MUST be created as a minor version. |
||
344 | * @param PolicyInterface[] $policies A list of policy ids that MUST be applied to the newly-created |
||
345 | * document object. |
||
346 | * @param AceInterface[] $addAces A list of ACEs that MUST be added to the newly-created document object, |
||
347 | * either using the ACL from folderId if specified, or being applied if no folderId is specified. |
||
348 | * @param AceInterface[] $removeAces A list of ACEs that MUST be removed from the newly-created document |
||
349 | * object, either using the ACL from folderId if specified, or being ignored if no folderId is specified. |
||
350 | * @return ObjectIdInterface|null the object ID of the new document or <code>null</code> if the document could not |
||
351 | * be created. |
||
352 | * @throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentException</code> if empty |
||
353 | * property list is given |
||
354 | */ |
||
355 | public function createDocument( |
||
391 | |||
392 | /** |
||
393 | * Creates a new document from a source document. |
||
394 | * |
||
395 | * @param ObjectIdInterface $source The identifier for the source document. |
||
396 | * @param string[] $properties The property values that MUST be applied to the object. This list of properties |
||
397 | * SHOULD only contain properties whose values differ from the source document. |
||
398 | * @param ObjectIdInterface|null $folderId If specified, the identifier for the folder that MUST be the parent |
||
399 | * folder for the newly-created document object. This parameter MUST be specified if the repository does NOT |
||
400 | * support the optional "unfiling" capability. |
||
401 | * @param VersioningState|null $versioningState An enumeration specifying what the versioning state of the |
||
402 | * newly-created object MUST be. Valid values are: |
||
403 | * <code>none</code> |
||
404 | * (default, if the object-type is not versionable) The document MUST be created as a non-versionable |
||
405 | * document. |
||
406 | * <code>checkedout</code> |
||
407 | * The document MUST be created in the checked-out state. The checked-out document MAY be |
||
408 | * visible to other users. |
||
409 | * <code>major</code> |
||
410 | * (default, if the object-type is versionable) The document MUST be created as a major version. |
||
411 | * <code>minor</code> |
||
412 | * The document MUST be created as a minor version. |
||
413 | * @param PolicyInterface[] $policies A list of policy ids that MUST be applied to the newly-created |
||
414 | * document object. |
||
415 | * @param AceInterface[] $addAces A list of ACEs that MUST be added to the newly-created document object, |
||
416 | * either using the ACL from folderId if specified, or being applied if no folderId is specified. |
||
417 | * @param AceInterface[] $removeAces A list of ACEs that MUST be removed from the newly-created document |
||
418 | * object, either using the ACL from folderId if specified, or being ignored if no folderId is specified. |
||
419 | * @return ObjectIdInterface|null the object ID of the new document or <code>null</code> if the document could not |
||
420 | * be created. |
||
421 | * @throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentException</code> if empty |
||
422 | * property list is given |
||
423 | */ |
||
424 | public function createDocumentFromSource( |
||
473 | |||
474 | /** |
||
475 | * Creates a new folder. |
||
476 | * |
||
477 | * @param string[] $properties |
||
478 | * @param ObjectIdInterface $folderId |
||
479 | * @param PolicyInterface[] $policies |
||
480 | * @param AceInterface[] $addAces |
||
481 | * @param AceInterface[] $removeAces |
||
482 | * @return ObjectIdInterface the object ID of the new folder |
||
483 | * @throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentException</code> if empty |
||
484 | * property list is given |
||
485 | */ |
||
486 | View Code Duplication | public function createFolder( |
|
509 | |||
510 | /** |
||
511 | * Creates a new item. |
||
512 | * |
||
513 | * @param string[] $properties |
||
514 | * @param ObjectIdInterface $folderId |
||
515 | * @param PolicyInterface[] $policies |
||
516 | * @param AceInterface[] $addAces |
||
517 | * @param AceInterface[] $removeAces |
||
518 | * @return ObjectIdInterface the object ID of the new item |
||
519 | * @throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentException</code> if empty |
||
520 | * property list is given |
||
521 | */ |
||
522 | View Code Duplication | public function createItem( |
|
545 | |||
546 | /** |
||
547 | * Creates an object ID from a String. |
||
548 | * |
||
549 | * @param string $id |
||
550 | * @return ObjectIdInterface the object ID object |
||
551 | */ |
||
552 | public function createObjectId($id) |
||
556 | |||
557 | /** |
||
558 | * Creates a new operation context object with the given properties. |
||
559 | * |
||
560 | * @param string[] $filter the property filter, a comma separated string of query names or "*" for all |
||
561 | * properties or <code>null</code> to let the repository determine a set of properties |
||
562 | * @param boolean $includeAcls indicates whether ACLs should be included or not |
||
563 | * @param boolean $includeAllowableActions indicates whether Allowable Actions should be included or not |
||
564 | * @param boolean $includePolicies indicates whether policies should be included or not |
||
565 | * @param IncludeRelationships|null $includeRelationships enum that indicates if and which |
||
566 | * relationships should be includes |
||
567 | * @param string[] $renditionFilter the rendition filter or <code>null</code> for no renditions |
||
568 | * @param boolean $includePathSegments indicates whether path segment or the relative path segment should |
||
569 | * be included or not |
||
570 | * @param string|null $orderBy the object order, a comma-separated list of query names and the ascending |
||
571 | * modifier "ASC" or the descending modifier "DESC" for each query name |
||
572 | * @param boolean $cacheEnabled flag that indicates if the object cache should be used |
||
573 | * @param integer $maxItemsPerPage the max items per page/batch |
||
574 | * @return OperationContextInterface the newly created operation context object |
||
575 | */ |
||
576 | public function createOperationContext( |
||
606 | |||
607 | /** |
||
608 | * Creates a new policy. |
||
609 | * |
||
610 | * @param string[] $properties |
||
611 | * @param ObjectIdInterface $folderId |
||
612 | * @param PolicyInterface[] $policies |
||
613 | * @param AceInterface[] $addAces |
||
614 | * @param AceInterface[] $removeAces |
||
615 | * @return ObjectIdInterface the object ID of the new policy |
||
616 | */ |
||
617 | public function createPolicy( |
||
626 | |||
627 | /** |
||
628 | * Creates a query statement for a query of one primary type joined by zero or more secondary types. |
||
629 | * |
||
630 | * Generates something like this: |
||
631 | * `SELECT d.cmis:name,s.SecondaryStringProp FROM cmis:document AS d JOIN MySecondaryType AS s ON |
||
632 | * d.cmis:objectId=s.cmis:objectId WHERE d.cmis:name LIKE ? ORDER BY d.cmis:name,s.SecondaryIntegerProp` |
||
633 | * |
||
634 | * @param string[] $selectPropertyIds the property IDs in the SELECT statement, |
||
635 | * if <code>null</code> all properties are selected |
||
636 | * @param string[] $fromTypes a Map of type aliases (keys) and type IDs (values), the Map must contain |
||
637 | * exactly one primary type and zero or more secondary types |
||
638 | * @param string|null $whereClause an optional WHERE clause with placeholders ('?'), see QueryStatement for details |
||
639 | * @param string[] $orderByPropertyIds an optional list of properties IDs for the ORDER BY clause |
||
640 | * @return QueryStatementInterface a new query statement object |
||
641 | * @throws CmisInvalidArgumentException |
||
642 | */ |
||
643 | 2 | public function createQueryStatement( |
|
658 | |||
659 | /** |
||
660 | * Creates a new relationship between 2 objects. |
||
661 | * |
||
662 | * @param string[] $properties |
||
663 | * @param PolicyInterface[] $policies |
||
664 | * @param AceInterface[] $addAces |
||
665 | * @param AceInterface[] $removeAces |
||
666 | * @return ObjectIdInterface|null the object ID of the new relationship or <code>null</code> if the relationship |
||
667 | * could not be created |
||
668 | */ |
||
669 | public function createRelationship( |
||
693 | |||
694 | /** |
||
695 | * Creates a new type. |
||
696 | * |
||
697 | * @param TypeDefinitionInterface $type |
||
698 | * @return ObjectTypeInterface the new type definition |
||
699 | * @throws CmisNotSupportedException If repository version 1.0 |
||
700 | */ |
||
701 | View Code Duplication | public function createType(TypeDefinitionInterface $type) |
|
711 | |||
712 | /** |
||
713 | * Deletes an object and, if it is a document, all versions in the version series. |
||
714 | * |
||
715 | * @param ObjectIdInterface $objectId the ID of the object |
||
716 | * @param boolean $allVersions if this object is a document this parameter defines |
||
717 | * if only this version or all versions should be deleted |
||
718 | */ |
||
719 | public function delete(ObjectIdInterface $objectId, $allVersions = true) |
||
728 | |||
729 | /** |
||
730 | * Deletes a type. |
||
731 | * |
||
732 | * @param string $typeId the ID of the type to delete |
||
733 | * @throws CmisNotSupportedException If repository version 1.0 |
||
734 | */ |
||
735 | View Code Duplication | public function deleteType($typeId) |
|
744 | |||
745 | /** |
||
746 | * Fetches the ACL of an object from the repository. |
||
747 | * |
||
748 | * @param ObjectIdInterface $objectId the ID the object |
||
749 | * @param boolean $onlyBasicPermissions if <code>true</code> the repository should express the ACL only with the |
||
750 | * basic permissions defined in the CMIS specification; if <code>false</code> the repository can express the |
||
751 | * ACL with basic and repository specific permissions |
||
752 | * @return AclInterface the ACL of the object |
||
753 | */ |
||
754 | public function getAcl(ObjectIdInterface $objectId, $onlyBasicPermissions) |
||
758 | |||
759 | /** |
||
760 | * Returns the underlying binding object. |
||
761 | * |
||
762 | * @return CmisBindingInterface the binding object |
||
763 | */ |
||
764 | 8 | public function getBinding() |
|
768 | |||
769 | /** |
||
770 | * Returns all checked out documents with the given OperationContext. |
||
771 | * |
||
772 | * @param OperationContextInterface|null $context |
||
773 | * @return DocumentInterface[] |
||
774 | */ |
||
775 | public function getCheckedOutDocs(OperationContextInterface $context = null) |
||
779 | |||
780 | /** |
||
781 | * @return CmisBindingsHelper |
||
782 | */ |
||
783 | 8 | protected function getCmisBindingHelper() |
|
787 | |||
788 | /** |
||
789 | * Returns the content changes. |
||
790 | * |
||
791 | * @param string $changeLogToken the change log token to start from or <code>null</code> to start from |
||
792 | * the first available event in the repository |
||
793 | * @param boolean $includeProperties indicates whether changed properties should be included in the result or not |
||
794 | * @param integer|null $maxNumItems maximum numbers of events |
||
795 | * @param OperationContextInterface|null $context the OperationContext |
||
796 | * @return ChangeEventsInterface the change events |
||
797 | */ |
||
798 | public function getContentChanges( |
||
819 | |||
820 | /** |
||
821 | * Retrieves the main content stream of a document. |
||
822 | * |
||
823 | * @param ObjectIdInterface $docId the ID of the document |
||
824 | * @param string|null $streamId the stream ID |
||
825 | * @param integer|null $offset the offset of the stream or <code>null</code> to read the stream from the beginning |
||
826 | * @param integer|null $length the maximum length of the stream or <code>null</code> to read to the end of the |
||
827 | * stream |
||
828 | * @return StreamInterface|null the content stream or <code>null</code> if the |
||
829 | * document has no content stream |
||
830 | */ |
||
831 | public function getContentStream(ObjectIdInterface $docId, $streamId = null, $offset = null, $length = null) |
||
843 | |||
844 | /** |
||
845 | * Returns the current default operation parameters for filtering, paging and caching. |
||
846 | * |
||
847 | * @return OperationContextInterface the default operation context |
||
848 | */ |
||
849 | 1 | public function getDefaultContext() |
|
853 | |||
854 | /** |
||
855 | * Returns the latest change log token. |
||
856 | * |
||
857 | * In contrast to the repository info, this change log token is *not cached*. |
||
858 | * This method requests the token from the repository every single time it is called. |
||
859 | * |
||
860 | * @return string|null the latest change log token or <code>null</code> if the repository doesn't provide one |
||
861 | */ |
||
862 | public function getLatestChangeLogToken() |
||
866 | |||
867 | /** |
||
868 | * Returns the latest version in a version series. |
||
869 | * |
||
870 | * @param ObjectIdInterface $objectId the document ID of an arbitrary version in the version series |
||
871 | * @param boolean $major if <code>true</code> the latest major version will be returned, |
||
872 | * otherwise the very last version will be returned |
||
873 | * @param OperationContextInterface|null $context the OperationContext to use |
||
874 | * @return DocumentInterface the latest document version |
||
875 | */ |
||
876 | public function getLatestDocumentVersion( |
||
883 | |||
884 | /** |
||
885 | * Get the current locale to be used for this session. |
||
886 | * |
||
887 | * @return \Locale the current locale, may be <code>null</code> |
||
888 | */ |
||
889 | public function getLocale() |
||
893 | |||
894 | /** |
||
895 | * @param ObjectIdInterface $objectId the object ID |
||
896 | * @param OperationContextInterface|null $context the OperationContext to use |
||
897 | * @return CmisObjectInterface the requested object |
||
898 | * @throws CmisObjectNotFoundException - if an object with the given ID doesn't exist |
||
899 | */ |
||
900 | public function getObject(ObjectIdInterface $objectId, OperationContextInterface $context = null) |
||
933 | |||
934 | /** |
||
935 | * Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext |
||
936 | * has caching turned off, it will load the object from the repository and puts it into the cache. |
||
937 | * This method might return a stale object if the object has been found in the cache and has been changed in or |
||
938 | * removed from the repository. Use CmisObject::refresh() and CmisObject::refreshIfOld() to update the object |
||
939 | * if necessary. |
||
940 | * |
||
941 | * @param string $path the object path |
||
942 | * @param OperationContextInterface|null $context the OperationContext to use |
||
943 | * @return CmisObjectInterface Returns a CMIS object from the session cache. |
||
944 | * @throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentException</code> |
||
945 | * if path is empty. |
||
946 | * @throws CmisObjectNotFoundException - if an object with the given path doesn't exist |
||
947 | */ |
||
948 | public function getObjectByPath($path, OperationContextInterface $context = null) |
||
977 | |||
978 | /** |
||
979 | * Gets a factory object that provides methods to create the objects used by this API. |
||
980 | * |
||
981 | * @return ObjectFactoryInterface the repository info |
||
982 | */ |
||
983 | 3 | public function getObjectFactory() |
|
987 | |||
988 | /** |
||
989 | * Fetches the relationships from or to an object from the repository. |
||
990 | * |
||
991 | * @param ObjectIdInterface $objectId |
||
992 | * @param boolean $includeSubRelationshipTypes |
||
993 | * @param RelationshipDirection $relationshipDirection |
||
994 | * @param ObjectTypeInterface $type |
||
995 | * @param OperationContextInterface|null $context |
||
996 | * @return RelationshipInterface[] |
||
997 | */ |
||
998 | 1 | public function getRelationships( |
|
1020 | |||
1021 | /** |
||
1022 | * Returns the repository info of the repository associated with this session. |
||
1023 | * |
||
1024 | * @return RepositoryInfoInterface the repository info |
||
1025 | */ |
||
1026 | 1 | public function getRepositoryInfo() |
|
1030 | |||
1031 | /** |
||
1032 | * Returns the repository id. |
||
1033 | * |
||
1034 | * @return string the repository id |
||
1035 | */ |
||
1036 | 1 | public function getRepositoryId() |
|
1040 | |||
1041 | /** |
||
1042 | * Gets the root folder of the repository with the given OperationContext. |
||
1043 | * |
||
1044 | * @param OperationContextInterface|null $context |
||
1045 | * @return FolderInterface the root folder object |
||
1046 | * @throws CmisRuntimeException |
||
1047 | */ |
||
1048 | public function getRootFolder(OperationContextInterface $context = null) |
||
1063 | |||
1064 | /** |
||
1065 | * Gets the type children of a type. |
||
1066 | * |
||
1067 | * @param string $typeId the type ID or <code>null</code> to request the base types |
||
1068 | * @param boolean $includePropertyDefinitions indicates whether the property definitions should be included or not |
||
1069 | * @return TypeDefinitionListInterface the type iterator |
||
1070 | * @throws CmisObjectNotFoundException - if a type with the given type ID doesn't exist |
||
1071 | */ |
||
1072 | public function getTypeChildren($typeId, $includePropertyDefinitions) |
||
1082 | |||
1083 | /** |
||
1084 | * Gets the definition of a type. |
||
1085 | * |
||
1086 | * @param string $typeId the ID of the type |
||
1087 | * @param boolean $useCache specifies if the type definition should be first looked up in the type definition |
||
1088 | * cache, if it is set to <code>false</code> or the type definition is not in the cache, the type definition is |
||
1089 | * loaded from the repository |
||
1090 | * @return ObjectTypeInterface the type definition |
||
1091 | * @throws CmisObjectNotFoundException - if a type with the given type ID doesn't exist |
||
1092 | */ |
||
1093 | public function getTypeDefinition($typeId, $useCache = true) |
||
1103 | |||
1104 | /** |
||
1105 | * Gets the type descendants of a type. |
||
1106 | * |
||
1107 | * @param string $typeId the type ID or <code>null</code> to request the base types |
||
1108 | * @param integer $depth indicates whether the property definitions should be included or not |
||
1109 | * @param boolean $includePropertyDefinitions the tree depth, must be greater than 0 or -1 for infinite depth |
||
1110 | * @return TypeDefinitionContainerInterface[] A tree that contains ObjectTypeInterface objects |
||
1111 | * @see ObjectTypeInterface ObjectTypeInterface contained in returned Tree |
||
1112 | * @throws CmisObjectNotFoundException - if a type with the given type ID doesn't exist |
||
1113 | */ |
||
1114 | public function getTypeDescendants($typeId, $depth, $includePropertyDefinitions) |
||
1123 | |||
1124 | /** |
||
1125 | * Sends a query to the repository using the given OperationContext. (See CMIS spec "2.1.10 Query".) |
||
1126 | * |
||
1127 | * @param string $statement the query statement (CMIS query language) |
||
1128 | * @param boolean $searchAllVersions specifies whether non-latest document versions should be included or not, |
||
1129 | * <code>true</code> searches all document versions, <code>false</code> only searches latest document versions |
||
1130 | * @param OperationContextInterface|null $context the operation context to use |
||
1131 | * @return QueryResultInterface[] |
||
1132 | * @throws CmisInvalidArgumentException If statement is empty |
||
1133 | */ |
||
1134 | public function query($statement, $searchAllVersions = false, OperationContextInterface $context = null) |
||
1169 | |||
1170 | /** |
||
1171 | * Builds a CMIS query and returns the query results as an iterator of CmisObject objects. |
||
1172 | * |
||
1173 | * @param string $typeId the ID of the object type |
||
1174 | * @param string|null $where the WHERE part of the query |
||
1175 | * @param boolean $searchAllVersions specifies whether non-latest document versions should be included or not, |
||
1176 | * <code>true</code> searches all document versions, <code>false</code> only searches latest document versions |
||
1177 | * @param OperationContextInterface|null $context the operation context to use |
||
1178 | * @return CmisObjectInterface[] |
||
1179 | * @throws CmisInvalidArgumentException If type id is empty |
||
1180 | */ |
||
1181 | public function queryObjects( |
||
1241 | |||
1242 | /** |
||
1243 | * Removes the given object from the cache. |
||
1244 | * |
||
1245 | * Note about specific implementation: in order to avoid an over-engineered |
||
1246 | * taggable cache mechanism and with it, extensive traversal of objects when |
||
1247 | * creating tags, objects are not tagged in the cache. In addition, objects |
||
1248 | * are added to the cache with a secondary identification; the context - and |
||
1249 | * the context is not available here when removing a single object from the |
||
1250 | * cache. Instead, we opt to simply flush the entire cache and let it refill. |
||
1251 | * |
||
1252 | * @param ObjectIdInterface $objectId |
||
1253 | */ |
||
1254 | public function removeObjectFromCache(ObjectIdInterface $objectId) |
||
1258 | |||
1259 | /** |
||
1260 | * Removes a set of policies from an object. This operation is not atomic. |
||
1261 | * If it fails some policies might already be removed. |
||
1262 | * |
||
1263 | * @param ObjectIdInterface $objectId the ID the object |
||
1264 | * @param ObjectIdInterface[] $policyIds the IDs of the policies to be removed |
||
1265 | */ |
||
1266 | public function removePolicy(ObjectIdInterface $objectId, array $policyIds) |
||
1270 | |||
1271 | /** |
||
1272 | * Removes the direct ACEs of an object and sets the provided ACEs. |
||
1273 | * The changes are local to the given object and are not propagated to dependent objects. |
||
1274 | * |
||
1275 | * @param ObjectIdInterface $objectId |
||
1276 | * @param AceInterface[] $aces |
||
1277 | * @return AclInterface the new ACL of the object |
||
1278 | */ |
||
1279 | public function setAcl(ObjectIdInterface $objectId, array $aces) |
||
1283 | |||
1284 | /** |
||
1285 | * Sets the current session parameters for filtering, paging and caching. |
||
1286 | * |
||
1287 | * @param OperationContextInterface $context the OperationContext to be used for the session; |
||
1288 | * if null, a default context is used |
||
1289 | */ |
||
1290 | public function setDefaultContext(OperationContextInterface $context) |
||
1294 | |||
1295 | /** |
||
1296 | * Updates an existing type. |
||
1297 | * |
||
1298 | * @param TypeDefinitionInterface $type the type definition updates |
||
1299 | * @return ObjectTypeInterface the updated type definition |
||
1300 | */ |
||
1301 | public function updateType(TypeDefinitionInterface $type) |
||
1305 | |||
1306 | /** |
||
1307 | * Converts a type definition into an object type. If the object type is |
||
1308 | * cached, it returns the cached object. Otherwise it creates an object type |
||
1309 | * object and puts it into the cache. |
||
1310 | * |
||
1311 | * @param TypeDefinitionInterface $typeDefinition |
||
1312 | * @return ObjectTypeInterface |
||
1313 | */ |
||
1314 | private function convertTypeDefinition(TypeDefinitionInterface $typeDefinition) |
||
1319 | } |
||
1320 |