This project has retired. For details please refer to its Attic page.
StoredObject xref

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.inmemory.storedobj.api;
20  
21  import java.math.BigInteger;
22  import java.util.GregorianCalendar;
23  import java.util.List;
24  import java.util.Map;
25  
26  import org.apache.chemistry.opencmis.commons.data.Acl;
27  import org.apache.chemistry.opencmis.commons.data.AllowableActions;
28  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
29  import org.apache.chemistry.opencmis.commons.data.ObjectList;
30  import org.apache.chemistry.opencmis.commons.data.PropertyData;
31  import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
32  import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
33  
34  /**
35   * Stored Object interface is common part that all objects handled by CMIS
36   * (Documents, Folders, Relations, Policies, ACLs) share. Objects that implement
37   * this interface are always concrete and can live in the object store. A stored
38   * object always has an id, a name and properties.
39   * 
40   * @author Jens
41   */
42  
43  public interface StoredObject {
44  
45      /**
46       * Retrieve the id of this object.
47       * 
48       * @return id of this object
49       */
50      String getId();
51  
52      /**
53       * Retrieve the name of this object
54       * 
55       * @return name of this object
56       */
57      String getName();
58  
59      /**
60       * Set the name of this document. This method does not persist the object.
61       * 
62       * @param name
63       *            name that is assigned to this object
64       */
65      void setName(String name);
66  
67      /**
68       * Retrieve the type of this document.
69       * 
70       * @return Id of the type identifying the type of this object
71       */
72      String getTypeId();
73  
74      /**
75       * Set the type of this document. This method does not persist the object.
76       * 
77       * @param type
78       *            id of the type this object gets assigned.
79       */
80      void setTypeId(String type);
81  
82      /**
83       * Retrieve the user who created the document
84       * 
85       * @return user who created the document.
86       */
87      String getCreatedBy();
88  
89      /**
90       * Set the user who last modified the object. This method does not persist
91       * the object.
92       * 
93       * @param createdBy
94       *            user who last modified the document
95       */
96      void setCreatedBy(String createdBy);
97  
98      /**
99       * Retrieve the user who last modified the document
100      * 
101      * @return user who last modified the document.
102      */
103     String getModifiedBy();
104 
105     /**
106      * Set the user who last modified the object. This method does not persist
107      * the object.
108      * 
109      * @param modifiedBy
110      *            user who last modified the document
111      */
112     void setModifiedBy(String modifiedBy);
113 
114     GregorianCalendar getCreatedAt();
115 
116     /**
117      * Assign date and time when the object was created. Usually you should not
118      * call this method externally. This method does not persist the object.
119      * 
120      * @param createdAt
121      *            date the object was created
122      */
123     void setCreatedAt(GregorianCalendar createdAt);
124 
125     /**
126      * Retrieve date and time when the object was last modified.
127      * 
128      * @return date the object was last modified
129      */
130     GregorianCalendar getModifiedAt();
131 
132     /**
133      * Assign current date and time when the object was last modified. Usually
134      * you should not call this method externally. This method does not persist
135      * the object.
136      */
137     void setModifiedAtNow();
138 
139     /**
140      * Get the repository id of this object where the object is stored.
141      * 
142      * @return
143      */
144     String getRepositoryId();
145 
146     /**
147      * Assign a repository where this object will be stored. This method does
148      * not persist the object.
149      * 
150      * @param repositoryId
151      *            id of the repository
152      */
153     void setRepositoryId(String repositoryId);
154 
155     /**
156      * Retrieve the list of properties
157      * 
158      * @return
159      */
160     Map<String, PropertyData<?>> getProperties();
161 
162     /**
163      * Assign the properties to an object. This method does not persist the
164      * object.
165      * 
166      * @param props
167      *            properties to be assigned
168      */
169     void setProperties(Map<String, PropertyData<?>> props);
170 
171     /**
172      * Retrieve a change token uniquely identifying the state of the object when
173      * it was persisted (used for optimistic locking)
174      * 
175      * @return String identifying the change token
176      */
177     String getChangeToken();
178 
179     /**
180      * Persist the object so that it can be later retrieved by its id. Assign an
181      * id to the object
182      */
183     void persist();
184 
185     /**
186      * Rename an object
187      * 
188      * @param newName
189      *            the new name of the object
190      */
191     void rename(String newName);
192 
193     /**
194      * Create all system base properties that need to be stored with every
195      * object in the repository This method is called when a new object is
196      * created to record all of the capturing data like the creation time,
197      * creator etc.
198      * 
199      * @param properties
200      *            The properties passed by the client, containing, name, type,
201      *            etc
202      * @param user
203      *            The user creating the document
204      */
205     void createSystemBasePropertiesWhenCreated(Map<String, PropertyData<?>> properties, String user);
206 
207     /**
208      * Update all system base properties that need to be stored with every
209      * object in the repository This method is called when an object is is
210      * updated to record all of the capturing data like the modification time,
211      * updating user etc.
212      * 
213      * @param properties
214      *            The properties passed by the client, containing, name, type,
215      *            etc
216      * @param user
217      *            The user creating the document
218      */
219     void updateSystemBasePropertiesWhenModified(Map<String, PropertyData<?>> properties, String user);
220 
221     void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
222             List<String> requestedIds);
223 
224     /**
225      * Set all properties which are not system properties. These are the
226      * properties as defined in Type system definition. This method is called
227      * when an object is created or updated. The implementation must ignore the
228      * system properties.
229      * 
230      * @param properties
231      *            Set of properties as set by the client, including system
232      *            parameters
233      */
234     void setCustomProperties(Map<String, PropertyData<?>> properties);
235     
236     /**
237      * get the Acl of the stored object
238      */
239     Acl getAcl();
240     
241     /**
242      * get the relationships of the object
243      * 
244      * @param includeSubRelationshipTypes
245      *            if true, relationships of a sub type will be returned as well
246      * @param relationshipDirection
247      * 			whether relationships where the object is the source, or the target or all 
248      *          are returned
249      * @param typeId
250      * 			the type of the relationship, may be null
251      * @param filter
252      * 			a property filter, "*" means all properties
253      * @param includeAllowableActions
254      * 			whether allowable actions should be returned
255      * @param maxItems
256      * @param skipCount
257      * @param extension
258      * @param user
259      * 			the id of the user calling the method 
260      */
261 	ObjectList getObjectRelationships(
262 			Boolean includeSubRelationshipTypes,
263 			RelationshipDirection relationshipDirection, String typeId,
264 			String filter, Boolean includeAllowableActions,
265 			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension, String user);
266 	
267 	/*
268      * get the allowable actions  of the object
269      */
270 	AllowableActions getAllowableActions(String user);
271 
272 }