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 import java.util.Map; 23 24 import org.apache.chemistry.opencmis.commons.data.Ace; 25 import org.apache.chemistry.opencmis.commons.data.Acl; 26 import org.apache.chemistry.opencmis.commons.data.AllowableActions; 27 import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; 28 import org.apache.chemistry.opencmis.commons.enums.AclPropagation; 29 import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel; 30 31 /** 32 * Base CMIS object. 33 * <p> 34 * See CMIS Domain Model - section 2.1.2. 35 */ 36 public interface CmisObject extends ObjectId, CmisObjectProperties { 37 38 // object 39 40 /** 41 * Returns the allowable actions if they have been fetched for this object. 42 */ 43 AllowableActions getAllowableActions(); 44 45 /** 46 * Returns the relationships if they have been fetched for this object. 47 */ 48 List<Relationship> getRelationships(); 49 50 /** 51 * Returns the ACL if it has been fetched for this object. 52 */ 53 Acl getAcl(); 54 55 // object service 56 57 /** 58 * Deletes this object. 59 * 60 * @param allVersions 61 * if this object is a document this parameter defines if just 62 * this version or all versions should be deleted 63 */ 64 void delete(boolean allVersions); 65 66 /** 67 * Updates the properties that are provided. 68 * 69 * @param properties 70 * the properties to update 71 * 72 * @return the updated object (a repository might have created a new object) 73 */ 74 CmisObject updateProperties(Map<String, ?> properties); 75 76 /** 77 * Updates the properties that are provided. 78 * 79 * @param properties 80 * the properties to update 81 * @param refresh 82 * indicates if the object should be refresh after the update 83 * 84 * @return the object id of the updated object (a repository might have 85 * created a new object) 86 * 87 */ 88 ObjectId updateProperties(Map<String, ?> properties, boolean refresh); 89 90 // renditions 91 92 /** 93 * Returns the renditions if they have been fetched for this object. 94 */ 95 List<Rendition> getRenditions(); 96 97 // policy service 98 99 /** 100 * Applies policies to this object. 101 */ 102 void applyPolicy(ObjectId... policyIds); 103 104 /** 105 * Remove policies from this object. 106 */ 107 void removePolicy(ObjectId... policyIds); 108 109 /** 110 * Returns the applied policies if they have been fetched for this object. 111 */ 112 List<Policy> getPolicies(); 113 114 // ACL service 115 116 /** 117 * Adds and removes ACEs to the object. 118 * 119 * @return the new ACL of this object 120 */ 121 Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation); 122 123 /** 124 * Adds ACEs to the object. 125 */ 126 Acl addAcl(List<Ace> addAces, AclPropagation aclPropagation); 127 128 /** 129 * Removes ACEs to the object. 130 */ 131 Acl removeAcl(List<Ace> removeAces, AclPropagation aclPropagation); 132 133 // extensions 134 135 /** 136 * Returns the extensions for the given level. 137 */ 138 List<CmisExtensionElement> getExtensions(ExtensionLevel level); 139 140 // adapters 141 142 /** 143 * Returns an adapter based on the given interface. 144 */ 145 <T> T getAdapter(Class<T> adapterInterface); 146 147 /** 148 * Returns a transient object adapter. 149 * 150 * @see TransientCmisObject 151 */ 152 TransientCmisObject getTransientObject(); 153 154 // session handling 155 156 /** 157 * Returns the timestamp (in milliseconds) of the last refresh. 158 */ 159 long getRefreshTimestamp(); 160 161 /** 162 * Reloads the data from the repository. 163 */ 164 void refresh(); 165 166 /** 167 * Reloads the data from the repository if the last refresh did not occur 168 * within <code>durationInMillis</code>. 169 */ 170 void refreshIfOld(long durationInMillis); 171 }