com.ibm.workplace.wcm.api
Interface Rendition

All Superinterfaces:
java.lang.Iterable<java.lang.String>

public interface Rendition
extends java.lang.Iterable<java.lang.String>

Represents a rendition for a DigitalAsset. A rendition may be any conversion/reduction/cropping/etc of a given asset into another form of the asset, including a thumbnail.

Renditions must have a non-null resource name.

Since:
v8.5.x

Method Summary
 byte[] getBytes()
          Returns the contents of the resource contained within this rendition as a byte array.
 int getHeight()
          Get height of the rendition in pixels.
 java.io.InputStream getInputStream()
          Returns the contents of the resource contained within this rendition as a input stream.
 java.lang.String getMimeType()
          Returns the mime-type of the resource file.
 java.lang.String getProperty(java.lang.String property)
          Gets the property requested
 java.lang.String getRenditionName()
          Returns the name of this rendition.
 java.lang.String getResourceName()
          Returns the name of the resource contained within this rendition.
 java.lang.String getResourceURI(boolean isServerRelative)
          Returns the URI of the resource relative to either the component or the server depending on the provided boolean parameter.
 java.lang.String getResourceURL()
          Returns the component relative URI to the resource.
 long getSize()
          Returns the size in bytes of the file contained within this component.
 int getWidth()
          Get width of the rendition in pixels.
 java.util.Iterator<java.lang.String> iterator()
          Get an iterator over all meta data property names of this asset.
 java.lang.String removeProperty(java.lang.String property)
          Removes the property.
 void setProperty(java.lang.String property, java.lang.String value)
          Sets the provided value to the property specified.
 

Method Detail

getRenditionName

java.lang.String getRenditionName()
                                  throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
                                         com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
Returns the name of this rendition.

Returns:
the rendition name, not null
Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException - if the user does not have access to the resource
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException - if the resource name cannot be retrieved

getResourceName

java.lang.String getResourceName()
                                 throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
                                        com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
Returns the name of the resource contained within this rendition.

Returns:
the resource name, not null
Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException - if the user does not have access to the resource
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException - if the resource name cannot be retrieved

getBytes

byte[] getBytes()
                throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
                       com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
Returns the contents of the resource contained within this rendition as a byte array.

Returns:
the file content as a byte array
Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException - if the user does not have access to the file TODO: can that occur?
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException - if the file cannot be retrieved

getInputStream

java.io.InputStream getInputStream()
                                   throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
                                          com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
Returns the contents of the resource contained within this rendition as a input stream.

Returns:
the file content as a input stream
Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException - if the user does not have access to the file TODO: can that occur?
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException - if the file cannot be retrieved or is externally managed

getMimeType

java.lang.String getMimeType()
Returns the mime-type of the resource file.

Returns null if no resource file has been set.

Returns:
the mime-type

getSize

long getSize()
             throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
                    com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
Returns the size in bytes of the file contained within this component.

Returns -1 if a file has not been specified.

Returns:
the file size in bytes
Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException - if the user does not have access to the file
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException - if the file cannot be retrieved

getResourceURL

java.lang.String getResourceURL()
Returns the component relative URI to the resource.

Returns null if no resource has been set.

Returns:
the component relative URI or PoC URI to the resource.

getResourceURI

java.lang.String getResourceURI(boolean isServerRelative)
Returns the URI of the resource relative to either the component or the server depending on the provided boolean parameter. A secure context URL will be returned only if the current user is authenticated and the boolean parameter for server relative URI is true.

As an example, a full URL to a resource uploaded as a rendition could look like this:
http://hostname:port/wps/wcm/myconnect/d07a7274-781d-42cc-936e-e83dd15aaa9e/desktop/image.jpeg?MOD=AJPERES&CVID=l-Ayhuw&id=1510530926202

Using the above example, a server relative URI can look like this:
/wps/wcm/myconnect/d07a7274-781d-42cc-936e-e83dd15aaa9e/desktop/image.jpeg?MOD=AJPERES&CVID=l-Ayhuw&id=1510530926202

With respect to the full URL from above, a component relative URI would look like this:
/desktop/image.jpeg

Parameters:
isServerRelative - boolean value which determines if the returned URI is to be server or component relative
Returns:
the component or server relative URI to the resource.

getWidth

int getWidth()
Get width of the rendition in pixels.

Returns:
width of the rendition in pixels, -1 if width is not available

getHeight

int getHeight()
Get height of the rendition in pixels.

Returns:
height of the rendition in pixels, -1 if width is not available

setProperty

void setProperty(java.lang.String property,
                 java.lang.String value)
                 throws java.lang.IllegalArgumentException
Sets the provided value to the property specified. If a property with the same name already exists the value will get replaced with the new value. If the value is null it has the same effect as removing the property.

Parameters:
property - - the property name, not null
value - - the property value
Throws:
java.lang.IllegalArgumentException - if property name is null

getProperty

java.lang.String getProperty(java.lang.String property)
                             throws java.lang.IllegalArgumentException
Gets the property requested

Parameters:
property - - the property name, not null
Returns:
the property value
Throws:
java.lang.IllegalArgumentException - if property name is null

removeProperty

java.lang.String removeProperty(java.lang.String property)
                                throws java.lang.IllegalArgumentException
Removes the property.

Parameters:
property - - the property name, not null
Returns:
the property value removed, null if property was not found/
Throws:
java.lang.IllegalArgumentException - if property name is null

iterator

java.util.Iterator<java.lang.String> iterator()
Get an iterator over all meta data property names of this asset.

Specified by:
iterator in interface java.lang.Iterable<java.lang.String>
Returns:
iterator over all meta data property names of this asset.