1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.chemistry.opencmis.client.api;
20
21 import java.util.List;
22
23 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
24 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
25 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
26
27 /**
28 * Object Type.
29 * <p>
30 * See CMIS Domain Model - section 2.1.3.
31 */
32 public interface ObjectType extends TypeDefinition {
33
34 String DOCUMENT_BASETYPE_ID = BaseTypeId.CMIS_DOCUMENT.value();
35 String FOLDER_BASETYPE_ID = BaseTypeId.CMIS_FOLDER.value();
36 String RELATIONSHIP_BASETYPE_ID = BaseTypeId.CMIS_RELATIONSHIP.value();
37 String POLICY_BASETYPE_ID = BaseTypeId.CMIS_POLICY.value();
38
39 /**
40 * Indicates if this is base object type (i.e. if {@code getId()} returns
41 * ...{@code _BASETYPE_ID}.
42 *
43 * @return {@code true} if this type is a base type, {@code false} if this
44 * type is a derived type.
45 */
46 boolean isBaseType();
47
48 /**
49 * Get the type's base type, if the type is a derived (non-base) type.
50 *
51 * @return the base type this type is derived from, or {@code null} if it is
52 * a base type ({@code isBase()==true}).
53 * @throws CmisRuntimeException
54 */
55 ObjectType getBaseType(); // null if isBase == true
56
57 /**
58 * Get the type's parent type, if the type is a derived (non-base) type.
59 *
60 * @return the parent type from which this type is derived, or {@code null}
61 * if it is a base type ( {@code isBase()==true}).
62 * @throws CmisRuntimeException
63 */
64 ObjectType getParentType();
65
66 /**
67 * Get the list of types directly derived from this type (which will return
68 * this type on {@code getParent()}).
69 *
70 * @return a {@code List} of types which are directly derived from this
71 * type.
72 */
73 ItemIterable<ObjectType> getChildren();
74
75 /**
76 * Get the list of all types somehow derived from this type.
77 *
78 * @param depth
79 * the depth to which the derived types should be resolved.
80 * @return a {@code Tree} of types which are derived from this type (direct
81 * and via their parents).
82 */
83 List<Tree<ObjectType>> getDescendants(int depth);
84
85 }