View Javadoc

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 org.apache.chemistry.opencmis.commons.data.ContentStream;
22  import org.apache.chemistry.opencmis.commons.data.RenditionData;
23  
24  /**
25   * Rendition.
26   * 
27   * @cmis 1.0
28   */
29  public interface Rendition extends RenditionData {
30  
31      /**
32       * Returns the size of the rendition in bytes if available.
33       * 
34       * @return the size of the rendition in bytes or -1 if the size is not
35       *         available
36       */
37      long getLength();
38  
39      /**
40       * Returns the height in pixels if the rendition is an image.
41       * 
42       * @return the height in pixels or -1 if the height is not available or the
43       *         rendition is not an image
44       */
45      long getHeight();
46  
47      /**
48       * Returns the width in pixels if the rendition is an image.
49       * 
50       * @return the width in pixels or -1 if the width is not available or the
51       *         rendition is not an image
52       */
53      long getWidth();
54  
55      /**
56       * Returns the rendition document if the rendition is a stand-alone
57       * document.
58       * 
59       * @return the rendition document or {@code null} if there is no rendition
60       *         document
61       */
62      Document getRenditionDocument();
63  
64      /**
65       * Returns the rendition document using the provided
66       * {@link OperationContext} if the rendition is a stand-alone document.
67       * 
68       * @return the rendition document or {@code null} if there is no rendition
69       *         document
70       */
71      Document getRenditionDocument(OperationContext context);
72  
73      /**
74       * Returns the content stream of the rendition.
75       * 
76       * @return the content stream of the rendition or {@code null} if the
77       *         rendition has no content
78       */
79      ContentStream getContentStream();
80  
81      /**
82       * Returns the content URL of the rendition if the binding supports content
83       * URLs.
84       * 
85       * Depending on the repository and the binding, the server might not return
86       * the content but an error message. Authentication data is not attached.
87       * That is, a user may have to re-authenticate to get the content.
88       * 
89       * @return the content URL of the rendition or {@code null} if the binding
90       *         does not support content URLs
91       */
92      String getContentUrl();
93  }