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.GregorianCalendar;
22 import java.util.List;
23
24 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
25
26 /**
27 * Accessors to CMIS object properties.
28 * <p>
29 * A property might not be available because either the repository didn't
30 * provide it or a property filter was used to retrieve this object.
31 * <p>
32 * The property values represent a snapshot of the object when it was loaded.
33 * The object and its properties may be out-of-date if the object has been
34 * modified in the repository.
35 */
36 public interface CmisObjectProperties {
37
38 /**
39 * Returns a list of all available CMIS properties.
40 *
41 * @return all available CMIS properties
42 */
43 List<Property<?>> getProperties();
44
45 /**
46 * Returns a property.
47 *
48 * @param id
49 * the ID of the property
50 *
51 * @return the property or {@code null} if the property hasn't been
52 * requested or hasn't been provided by the repository
53 */
54 <T> Property<T> getProperty(String id);
55
56 /**
57 * Returns the value of a property.
58 *
59 * @param id
60 * the ID of the property
61 *
62 * @return the property value or {@code null} if the property hasn't been
63 * requested, hasn't been provided by the repository, or the
64 * property value isn't set
65 */
66 <T> T getPropertyValue(String id);
67
68 // convenience accessors
69
70 /**
71 * Returns the name of this CMIS object (CMIS property {@code cmis:name}).
72 *
73 * @return the name of the object or {@code null} if the property hasn't
74 * been requested or hasn't been provided by the repository
75 *
76 * @cmis 1.0
77 */
78 String getName();
79
80 /**
81 * Returns the description of this CMIS object (CMIS property
82 * {@code cmis:description}).
83 *
84 * @return the description of the object or {@code null} if the property
85 * hasn't been requested, hasn't been provided by the repository, or
86 * the property value isn't set
87 *
88 * @cmis 1.1
89 */
90 String getDescription();
91
92 /**
93 * Returns the user who created this CMIS object (CMIS property
94 * {@code cmis:createdBy}).
95 *
96 * @return the creator of the object or {@code null} if the property hasn't
97 * been requested or hasn't been provided by the repository
98 *
99 * @cmis 1.0
100 */
101 String getCreatedBy();
102
103 /**
104 * Returns the timestamp when this CMIS object has been created (CMIS
105 * property {@code cmis:creationDate}).
106 *
107 * @return the creation time of the object or {@code null} if the property
108 * hasn't been requested or hasn't been provided by the repository
109 *
110 * @cmis 1.0
111 */
112 GregorianCalendar getCreationDate();
113
114 /**
115 * Returns the user who modified this CMIS object (CMIS property
116 * {@code cmis:lastModifiedBy}).
117 *
118 * @return the last modifier of the object or {@code null} if the property
119 * hasn't been requested or hasn't been provided by the repository
120 *
121 * @cmis 1.0
122 */
123 String getLastModifiedBy();
124
125 /**
126 * Returns the timestamp when this CMIS object has been modified (CMIS
127 * property {@code cmis:lastModificationDate}).
128 *
129 * @return the last modification date of the object or {@code null} if the
130 * property hasn't been requested or hasn't been provided by the
131 * repository
132 *
133 * @cmis 1.0
134 */
135 GregorianCalendar getLastModificationDate();
136
137 /**
138 * Returns the id of the base type of this CMIS object (CMIS property
139 * {@code cmis:baseTypeId}).
140 *
141 * @return the base type id of the object or {@code null} if the property
142 * hasn't been requested or hasn't been provided by the repository
143 *
144 * @cmis 1.0
145 */
146 BaseTypeId getBaseTypeId();
147
148 /**
149 * Returns the base type of this CMIS object (object type identified by
150 * {@code cmis:baseTypeId}).
151 *
152 * @return the base type of the object or {@code null} if the property
153 * {@code cmis:baseTypeId} hasn't been requested or hasn't been
154 * provided by the repository
155 *
156 * @cmis 1.0
157 */
158 ObjectType getBaseType();
159
160 /**
161 * Returns the type of this CMIS object (object type identified by
162 * {@code cmis:objectTypeId}).
163 *
164 * @return the type of the object or {@code null} if the property
165 * {@code cmis:objectTypeId} hasn't been requested or hasn't been
166 * provided by the repository
167 *
168 * @cmis 1.0
169 */
170 ObjectType getType();
171
172 /**
173 * Returns the secondary types of this CMIS object (object types identified
174 * by {@code cmis:secondaryObjectTypeIds}).
175 *
176 * @return the secondary types of the object or {@code null} if the property
177 * {@code cmis:secondaryObjectTypeIds} hasn't been requested or
178 * hasn't been provided by the repository
179 * @cmis 1.1
180 */
181 List<SecondaryType> getSecondaryTypes();
182
183 /**
184 * Returns a list of primary and secondary object types that define the
185 * given property.
186 *
187 * @param id
188 * the ID of the property
189 *
190 * @return a list of object types that define the given property or
191 * {@code null} if the property couldn't be found in the object
192 * types that are attached to this object
193 *
194 */
195 List<ObjectType> findObjectType(String id);
196
197 /**
198 * Returns the change token (CMIS property {@code cmis:changeToken}).
199 *
200 * @return the change token of the object or {@code null} if the property
201 * hasn't been requested or hasn't been provided or isn't supported
202 * by the repository
203 *
204 * @cmis 1.0
205 */
206 String getChangeToken();
207 }